Files
galaxy/static/scripts/galaxy.tools.js
T

2 lines
2.7 KiB
JavaScript

define(["libs/underscore","mvc/tools"],function(a){var b=function(a,b){$("input[name='"+a+"'][type='checkbox']").attr("checked",!!b)};$(".tool-share-link").each(function(){var a=$(this).attr("href"),a=$(this).attr("data-link");$(this).click(function(){window.prompt("Copy to clipboard: Ctrl+C, Enter",a)})}),$("div.checkUncheckAllPlaceholder").each(function(){var a=$(this).attr("checkbox_name");select_link=$("<a class='action-button'></a>").text("Select All").click(function(){b(a,!0)}),unselect_link=$("<a class='action-button'></a>").text("Unselect All").click(function(){b(a,!1)}),$(this).append(select_link).append(" ").append(unselect_link)});var c={select_single:{icon_class:"fa-file-o",select_by:"Run tool on single input",allow_remap:!0},select_multiple:{icon_class:"fa-files-o",select_by:"Run tool in parallel across multiple datasets",allow_remap:!1,min_option_count:2},select_collection:{icon_class:"fa-folder-o",select_by:"Run tool in parallel across dataset collection",allow_remap:!1},multiselect_single:{icon_class:"fa-list-alt",select_by:"Run tool over multiple datasets",allow_remap:!0},multiselect_collection:{icon_class:"fa-folder-o",select_by:"Run tool over dataset collection",allow_remap:!1},select_single_collection:{icon_class:"fa-file-o",select_by:"Run tool on single collection",allow_remap:!0},select_map_over_collections:{icon_class:"fa-folder-o",select_by:"Map tool over compontents of nested collection",allow_remap:!1}},d=Backbone.View.extend({initialize:function(b){var d=b.default_option,e=null,f=b.switch_options;this.switchOptions=f,this.prefix=b.prefix;var g=(this.$el,this),h=0,i=0;a.each(this.switchOptions,function(b,f){var j=a.size(b.options),k=c[f],l=h++,m=!1;if(d==f?e=l:j<(k.min_option_count||1)&&(m=!0),!m){i++;var n=$('<i class="fa '+k.icon_class+' runOptionIcon" style="padding-left: 5px; padding-right: 2px;"></i>').click(function(){g.enableSelectBy(l,f)}).attr("title",k.select_by).data("index",l);g.formRow().find("label").append(n)}}),2>i&&g.formRow().find("i.runOptionIcon").hide(),null!=e&&g.enableSelectBy(e,d)},formRow:function(){return this.$el.closest(".form-row")},render:function(){},enableSelectBy:function(b,d){var e=c[d];e.allow_remap?$("div#remap-row").css("display","inherit"):$("div#remap-row").css("display","none"),this.formRow().find("i").each(function(a,c){var d=$(c),e=d.data("index");e==b?d.css("color","black"):d.css("color","Gray")});var f=this.$("select"),g=this.switchOptions[d];f.attr("name",this.prefix+g.name),f.attr("multiple",g.multiple);var h=this.$(".select2-container").length>0;f.html(""),a.each(g.options,function(a){var b=a[0],c=a[1],d=a[2];f.append($("<option />",{text:b,val:c,selected:d}))}),h&&f.select2()}});return{SwitchSelectView:d}});
//# sourceMappingURL=../maps/galaxy.tools.js.map