diff --git a/client/galaxy/scripts/mvc/history/hda-li.js b/client/galaxy/scripts/mvc/history/hda-li.js index d598edfb857..80053e23308 100644 --- a/client/galaxy/scripts/mvc/history/hda-li.js +++ b/client/galaxy/scripts/mvc/history/hda-li.js @@ -45,10 +45,8 @@ HDAListItemView.prototype.templates = (function(){ '', '
', '', - '<% _.each(dataset.tags, function(tag){ %>', - '<% if (tag.startsWith("name.")){ %>', - '<%- tag.substring(5) %>', - '<% } %>', + '<% _.each(dataset.nametags, function(tag){ %>', + '<%- tag %>', '<% }); %>', '', '' diff --git a/lib/galaxy/managers/hdas.py b/lib/galaxy/managers/hdas.py index 904be611729..ffa325bd768 100644 --- a/lib/galaxy/managers/hdas.py +++ b/lib/galaxy/managers/hdas.py @@ -261,7 +261,7 @@ class HDASerializer( # datasets._UnflattenedMetadataDatasetAssociationSerialize 'state', 'extension', 'deleted', 'purged', 'visible', - 'tags', + 'nametags', 'type', 'url', 'create_time', @@ -286,6 +286,7 @@ class HDASerializer( # datasets._UnflattenedMetadataDatasetAssociationSerialize 'creating_job', 'rerunnable', + 'tags', 'uuid', 'permissions', 'file_name', @@ -331,7 +332,7 @@ class HDASerializer( # datasets._UnflattenedMetadataDatasetAssociationSerialize 'misc_blurb' : self._remap_from( 'blurb' ), 'file_ext' : self._remap_from( 'extension' ), 'file_path' : self._remap_from( 'file_name' ), - + 'nametags' : self.serialize_nametags, 'resubmitted' : lambda i, k, **c: self.hda_manager.has_been_resubmitted( i ), 'display_apps' : self.serialize_display_apps, 'display_types' : self.serialize_old_display_applications, @@ -385,6 +386,19 @@ class HDASerializer( # datasets._UnflattenedMetadataDatasetAssociationSerialize return display_apps + def serialize_nametags( self, hda, key, trans=None, **context ): + """ + Return list of 'name.' child tags attached to this dataset. + TODO: investigate faster ways to fetch children of .name + """ + nametags = [] + for tag in hda.tags: + if tag.tag.name.startswith('name.'): + nametags.append(tag.tag.name[5:]) + return nametags + + return [tag for tag in hda.tags if tag.tag.name.startswith('name.')] + def serialize_old_display_applications( self, hda, key, trans=None, **context ): """ Return dictionary containing old-style display app urls. diff --git a/static/maps/mvc/history/hda-li.js.map b/static/maps/mvc/history/hda-li.js.map index 06800689cc7..0bad59d3c19 100644 --- a/static/maps/mvc/history/hda-li.js.map +++ b/static/maps/mvc/history/hda-li.js.map @@ -1 +1 @@ -{"version":3,"file":"hda-li.js","sources":["../../../src/mvc/history/hda-li.js"],"names":["define","DATASET_LI","BASE_MVC","_l","_super","DatasetListItemView","HDAListItemView","extend","className","prototype","initialize","attributes","options","call","this","toString","modelString","model","templates","titleBarTemplate","wrapTemplate","warnings","_","hidden","titleBar"],"mappings":"AAAAA,QACI,yBACA,eACA,sBACD,SAAUC,EAAYC,EAAUC,GAEnC,YAGA,IAAIC,GAASH,EAAWI,oBAMpBC,EAAkBF,EAAOG,QAGzBC,UAAcJ,EAAOK,UAAUD,UAAY,mBAE3CE,WAAa,SAAUC,EAAYC,GAC/BR,EAAOK,UAAUC,WAAWG,KAAMC,KAAMH,EAAYC,IAKxDG,SAAW,WACP,GAAIC,GAAgBF,KAAW,MAAIA,KAAKG,MAAQ,GAAK,YACrD,OAAO,mBAAqBD,EAAc,MAgD9C,OA1CJV,GAAgBG,UAAUS,UAAa,WAEnC,GAAIC,GAAmBjB,EAASkB,cAE5B,6CACI,mCACA,sBAEI,+CACA,gDACJ,SACA,QACA,0BACI,4CACI,sCACI,gEACJ,UACJ,YACJ,UACJ,UACD,WAECC,EAAWC,EAAEf,UAAYH,EAAOK,UAAUS,UAAUG,UACpDE,OAASrB,EAASkB,cAEd,gCACI,+CACIjB,EAAI,gCACR,SACJ,WACD,YAGP,OAAOmB,GAAEf,UAAYH,EAAOK,UAAUS,WAClCM,SAAWL,EACXE,SAAWA,QAQXf,gBAAmBA"} \ No newline at end of file +{"version":3,"file":"hda-li.js","sources":["../../../src/mvc/history/hda-li.js"],"names":["define","DATASET_LI","BASE_MVC","_l","_super","DatasetListItemView","HDAListItemView","extend","className","prototype","initialize","attributes","options","call","this","toString","modelString","model","templates","titleBarTemplate","wrapTemplate","warnings","_","hidden","titleBar"],"mappings":"AAAAA,QACI,yBACA,eACA,sBACD,SAAUC,EAAYC,EAAUC,GAEnC,YAGA,IAAIC,GAASH,EAAWI,oBAMpBC,EAAkBF,EAAOG,QAGzBC,UAAcJ,EAAOK,UAAUD,UAAY,mBAE3CE,WAAa,SAAUC,EAAYC,GAC/BR,EAAOK,UAAUC,WAAWG,KAAMC,KAAMH,EAAYC,IAKxDG,SAAW,WACP,GAAIC,GAAgBF,KAAW,MAAIA,KAAKG,MAAQ,GAAK,YACrD,OAAO,mBAAqBD,EAAc,MA8C9C,OAxCJV,GAAgBG,UAAUS,UAAa,WAEnC,GAAIC,GAAmBjB,EAASkB,cAE5B,6CACI,mCACA,sBAEI,+CACA,gDACJ,SACA,QACA,0BACI,gDACI,mDACJ,YACJ,UACJ,UACD,WAECC,EAAWC,EAAEf,UAAYH,EAAOK,UAAUS,UAAUG,UACpDE,OAASrB,EAASkB,cAEd,gCACI,+CACIjB,EAAI,gCACR,SACJ,WACD,YAGP,OAAOmB,GAAEf,UAAYH,EAAOK,UAAUS,WAClCM,SAAWL,EACXE,SAAWA,QAQXf,gBAAmBA"} \ No newline at end of file diff --git a/static/scripts/bundled/analysis.bundled.js b/static/scripts/bundled/analysis.bundled.js index d6bf38c884a..b9e254188a0 100644 --- a/static/scripts/bundled/analysis.bundled.js +++ b/static/scripts/bundled/analysis.bundled.js @@ -5,10 +5,10 @@ this.log(this+".initialize:",e),d.prototype.initialize.call(this,e),this.linkTar return o.isUndefined(e)||this.set("show_deleted",e),this.get("show_deleted")},includeHidden:function(e){return o.isUndefined(e)||this.set("show_hidden",e),this.get("show_hidden")},toString:function(){return"HistoryPrefs("+this.id+")"}},{storageKeyPrefix:"history:",historyStorageKey:function(e){if(!e)throw new Error("HistoryPrefs.historyStorageKey needs valid id: "+e);return t.storageKeyPrefix+e},get:function(e){return new t({id:t.historyStorageKey(e)})},clearAll:function(e){for(var i in sessionStorage)0===i.indexOf(t.storageKeyPrefix)&&sessionStorage.removeItem(i)}});return{HistoryPrefs:t}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(2))},function(e,t,i){var n,s;(function(o,a,r,l){n=[i(6),i(5)],s=function(e,t){"use strict";var i="list",n=o.View.extend(e.LoggableMixin).extend({_logNamespace:i,initialize:function(e){this.expanded=e.expanded||!1,this.log("\t expanded:",this.expanded),this.fxSpeed=void 0!==e.fxSpeed?e.fxSpeed:this.fxSpeed},fxSpeed:"fast",render:function(e){var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){var e=a(this.templates.el(this.model.toJSON(),this));return this.expanded&&this.$details(e).replaceWith(this._renderDetails().show()),e},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;0===t?(i._swapNewRender(e),i.trigger("rendered",i)):a(i).queue("fx",[function(e){i.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){i.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",r.isFunction(this.className)?this.className():this.className).append(e.children())},_setUpBehaviors:function(e){e=e||this.$el,e.find("[title]").tooltip({placement:"bottom"})},$details:function(e){return e=e||this.$el,e.find("> .details")},_renderDetails:function(){var e=a(this.templates.details(this.model.toJSON(),this));return this._setUpBehaviors(e),e},toggleExpanded:function(e){return e=void 0===e?!this.expanded:e,e?this.expand():this.collapse(),this},expand:function(){var e=this;return e._fetchModelDetails().always(function(){e._expand()})},_fetchModelDetails:function(){return this.model.hasDetails()?l.when():this.model.fetch()},_expand:function(){var e=this,t=e._renderDetails();e.$details().replaceWith(t),e.expanded=!0,e.$details().slideDown(e.fxSpeed,function(){e.trigger("expanded",e)})},collapse:function(){this.debug(this+"(ExpandableView).collapse");var e=this;e.expanded=!1,this.$details().slideUp(e.fxSpeed,function(){e.trigger("collapsed",e)})}}),s=n.extend(e.mixin(e.SelectableViewMixin,e.DraggableViewMixin,{tagName:"div",className:"list-item",initialize:function(t){n.prototype.initialize.call(this,t),e.SelectableViewMixin.initialize.call(this,t),e.DraggableViewMixin.initialize.call(this,t),this._setUpListeners()},_setUpListeners:function(){return this.on("selectable",function(e){e?this.$(".primary-actions").hide():this.$(".primary-actions").show()},this),this},_buildNewRender:function(){var e=n.prototype._buildNewRender.call(this);return e.children(".warnings").replaceWith(this._renderWarnings()),e.children(".title-bar").replaceWith(this._renderTitleBar()),e.children(".primary-actions").append(this._renderPrimaryActions()),e.find("> .title-bar .subtitle").replaceWith(this._renderSubtitle()),e},_swapNewRender:function(e){return n.prototype._swapNewRender.call(this,e),this.selectable&&this.showSelector(0),this.draggable&&this.draggableOn(),this.$el},_renderWarnings:function(){var e=this,t=a('
'),i=e.model.toJSON();return r.each(e.templates.warnings,function(n){t.append(a(n(i,e)))}),t},_renderTitleBar:function(){return a(this.templates.titleBar(this.model.toJSON(),this))},_renderPrimaryActions:function(){return[]},_renderSubtitle:function(){return a(this.templates.subtitle(this.model.toJSON(),this))},events:{"click .title-bar":"_clickTitleBar","keydown .title-bar":"_keyDownTitleBar","click .selector":"toggleSelect"},_clickTitleBar:function(e){e.stopPropagation(),e.altKey?(this.toggleSelect(e),this.selectable||this.showSelector()):this.toggleExpanded()},_keyDownTitleBar:function(e){var t=32,i=13;return!e||"keydown"!==e.type||e.keyCode!==t&&e.keyCode!==i||(this.toggleExpanded(),e.stopPropagation(),!1)},toString:function(){var e=this.model?this.model+"":"(no model)";return"ListItemView("+e+")"}}));s.prototype.templates=function(){var t=e.wrapTemplate(['
','
','
','',"
",'
','
','
',"
"]),i={},n=e.wrapTemplate(['
','','
','<%- element.name %>',"
",'
',"
"],"element"),s=e.wrapTemplate(['
']),o=e.wrapTemplate(['
']);return{el:t,warnings:i,titleBar:n,subtitle:s,details:o}}();var c=s.extend({foldoutStyle:"foldout",foldoutPanelClass:null,initialize:function(e){"drilldown"===this.foldoutStyle&&(this.expanded=!1),this.foldoutStyle=e.foldoutStyle||this.foldoutStyle,this.foldoutPanelClass=e.foldoutPanelClass||this.foldoutPanelClass,s.prototype.initialize.call(this,e),this.foldout=this._createFoldoutPanel()},_renderDetails:function(){if("drilldown"===this.foldoutStyle)return a();var e=s.prototype._renderDetails.call(this);return this._attachFoldout(this.foldout,e)},_createFoldoutPanel:function(){var e=this.model,t=this._getFoldoutPanelClass(e),i=this._getFoldoutPanelOptions(e),n=new t(r.extend(i,{model:e}));return n},_getFoldoutPanelClass:function(){return this.foldoutPanelClass},_getFoldoutPanelOptions:function(){return{foldoutStyle:this.foldoutStyle,fxSpeed:this.fxSpeed}},_attachFoldout:function(e,t){return t=t||this.$("> .details"),this.foldout=e.render(0),e.$("> .controls").hide(),t.append(e.$el)},expand:function(){var e=this;return e._fetchModelDetails().always(function(){"foldout"===e.foldoutStyle?e._expand():"drilldown"===e.foldoutStyle&&e._expandByDrilldown()})},_expandByDrilldown:function(){var e=this;e.listenTo(e.foldout,"close",function(){e.trigger("collapsed:drilldown",e,e.foldout)}),e.trigger("expanded:drilldown",e,e.foldout)}});return c.prototype.templates=function(){var t=e.wrapTemplate(['
',"
"],"collection");return r.extend({},s.prototype.templates,{details:t})}(),{ExpandableView:n,ListItemView:s,FoldoutListItemView:c}}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(3),i(1),i(2),i(1))},function(e,t,i){var n,s;(function(o,a){n=[i(4),i(55),i(7),i(23),i(17),i(30)],s=function(e,t,i,n,s,r){return n.extend({initialize:function(e){var i=this;this.deferred=new t,n.prototype.initialize.call(this,e),this.model.get("inputs")?this._buildForm(this.model.attributes):this.deferred.execute(function(e){i._buildModel(e,i.model.attributes,!0)}),this.model.get("listen_to_history")&&parent.Galaxy&&parent.Galaxy.currHistoryPanel&&this.listenTo(parent.Galaxy.currHistoryPanel.collection,"change",function(){i.model.get("onchange")()}),this.$el.on("remove",function(){i.remove()})},remove:function(){var e=this;this.$el.hide(),this.deferred.execute(function(){n.prototype.remove.call(e),Galaxy.emit.debug("tool-form-base::remove()","Destroy view.")})},_buildForm:function(e){var t=this;this.model.set(e),this.model.set({title:e.title||""+e.name+" "+e.description+" (Galaxy Version "+e.version+")",operations:!this.model.get("hide_operations")&&this._operations(),onchange:function(){t.deferred.reset(),t.deferred.execute(function(e){t.model.get("postchange")(e,t)})}}),this.model.get("customize")&&this.model.get("customize")(this),this.render(),this.model.get("collapsible")||this.$el.append(o("
").addClass("ui-margin-top-large").append(this._footer()))},_buildModel:function(t,n,s){var a=this,r=this.model.attributes;r.version=n.version,r.id=n.id;var l="",c={};r.job_id?l=Galaxy.root+"api/jobs/"+r.job_id+"/build_for_rerun":(l=Galaxy.root+"api/tools/"+r.id+"/build",Galaxy.params&&Galaxy.params.tool_id==r.id&&(c=o.extend({},Galaxy.params),r.version&&(c.tool_version=r.version))),e.get({url:l,data:c,success:function(e){return e.display?(a._buildForm(e),!s&&a.message.update({status:"success",message:"Now you are using '"+r.name+"' version "+r.version+", id '"+r.id+"'.",persistent:!1}),Galaxy.emit.debug("tool-form-base::_buildModel()","Initial tool model ready.",e),void t.resolve()):void(window.location=Galaxy.root)},error:function(e,n){var s=e&&e.err_msg||"Uncaught error.";401==n?window.location=Galaxy.root+"user/login?"+o.param({redirect:Galaxy.root+"?tool_id="+r.id}):a.$el.is(":empty")?a.$el.prepend(new i.Message({message:s,status:"danger",persistent:!0,large:!0}).$el):Galaxy.modal&&Galaxy.modal.show({title:"Tool request failed",body:s,buttons:{Close:function(){Galaxy.modal.hide()}}}),Galaxy.emit.debug("tool-form-base::_buildModel()","Initial tool model request failed.",e),t.reject()}})},_operations:function(){var t=this,n=this.model.attributes,s=new i.ButtonMenu({icon:"fa-cubes",title:!n.narrow&&"Versions"||null,tooltip:"Select another tool version"});if(!n.sustain_version&&n.versions&&n.versions.length>1)for(var o in n.versions){var a=n.versions[o];a!=n.version&&s.addMenu({title:"Switch to "+a,version:a,icon:"fa-cube",onclick:function(){var e=n.id.replace(n.version,this.version),i=this.version;t.deferred.reset(),t.deferred.execute(function(n){t._buildModel(n,{id:e,version:i})})}})}else s.$el.hide();var r=new i.ButtonMenu({icon:"fa-caret-down",title:!n.narrow&&"Options"||null,tooltip:"View available options"});return n.biostar_url&&(r.addMenu({icon:"fa-question-circle",title:"Question?",onclick:function(){window.open(n.biostar_url+"/p/new/post/")}}),r.addMenu({icon:"fa-search",title:"Search",onclick:function(){window.open(n.biostar_url+"/local/search/page/?q="+n.name)}})),r.addMenu({icon:"fa-share",title:"Share",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+Galaxy.root+"root?tool_id="+n.id)}}),Galaxy.user&&Galaxy.user.get("is_admin")&&(r.addMenu({icon:"fa-download",title:"Download",onclick:function(){window.location.href=Galaxy.root+"api/tools/"+n.id+"/download"}}),r.addMenu({icon:"fa-refresh",title:"Reload XML",onclick:function(){e.get({url:Galaxy.root+"api/tools/"+n.id+"/reload",success:function(e){t.message.update({persistent:!1,message:"Tool XML has been reloaded.",status:"success"})},error:function(e){t.message.update({persistent:!1,message:e.err_msg,status:"danger"})}})}})),n.requirements&&n.requirements.length>0&&r.addMenu({icon:"fa-info-circle",title:"Requirements",onclick:function(){!this.requirements_visible||t.portlet.collapsed?(this.requirements_visible=!0,t.portlet.expand(),t.message.update({persistent:!0,message:t._templateRequirements(n),status:"info"})):(this.requirements_visible=!1,t.message.update({message:""}))}}),n.sharable_url&&r.addMenu({icon:"fa-external-link",title:"See in Tool Shed",onclick:function(){window.open(n.sharable_url)}}),{menu:r,versions:s}},_footer:function(){var e=this.model.attributes,t=o("
").append(this._templateHelp(e));if(e.citations){var i=o("
"),n=new s.ToolCitationCollection;n.tool_id=e.id;var a=new r.CitationListView({el:i,collection:n});a.render(),n.fetch(),t.append(i)}return t},_templateHelp:function(e){var t=o("
").addClass("ui-form-help").append(e.help);return t.find("a").attr("target","_blank"),t},_templateRequirements:function(e){var t=e.requirements.length;if(t>0){var i="This tool requires ";a.each(e.requirements,function(e,n){i+=e.name+(e.version?" (Version "+e.version+")":"")+(n").attr("target","_blank").attr("href","https://wiki.galaxyproject.org/Tools/Requirements").text("here");return o("").append(i+". Click ").append(n).append(" for more information.")}return"No requirements found."}})}.apply(t,n),!(void 0!==s&&(e.exports=s))}).call(t,i(1),i(2))},function(e,t,i){var n,s;(function(o,a){n=[i(2),i(16),i(11),i(18)],s=function(e,t,i,n){"use strict";var s={hidden:!1,show:function(){this.set("hidden",!1)},hide:function(){this.set("hidden",!0)},toggle:function(){this.set("hidden",!this.get("hidden"))},is_visible:function(){return!this.attributes.hidden}},r=o.Model.extend({defaults:{name:null,label:null,type:null,value:null,html:null,num_samples:5},initialize:function(e){this.attributes.html=unescape(this.attributes.html)},copy:function(){return new r(this.toJSON())},set_value:function(e){this.set("value",e||"")}}),l=o.Collection.extend({model:r}),c=r.extend({}),d=r.extend({set_value:function(e){this.set("value",parseInt(e,10))},get_samples:function(){return d3.scale.linear().domain([this.get("min"),this.get("max")]).ticks(this.get("num_samples"))}}),h=d.extend({set_value:function(e){this.set("value",parseFloat(e))}}),u=r.extend({get_samples:function(){return e.map(this.get("options"),function(e){return e[0]})}});r.subModelTypes={integer:d,float:h,data:c,select:u};var p=o.Model.extend({defaults:{id:null,name:null,description:null,target:null,inputs:[],outputs:[]},urlRoot:Galaxy.root+"api/tools",initialize:function(t){this.set("inputs",new l(e.map(t.inputs,function(e){var t=r.subModelTypes[e.type]||r;return new t(e)})))},toJSON:function(){var e=o.Model.prototype.toJSON.call(this);return e.inputs=this.get("inputs").map(function(e){return e.toJSON()}),e},remove_inputs:function(e){var t=this,i=t.get("inputs").filter(function(t){return e.indexOf(t.get("type"))!==-1});t.get("inputs").remove(i)},copy:function(e){var t=new p(this.toJSON());if(e){var i=new o.Collection;t.get("inputs").each(function(e){e.get_samples()&&i.push(e)}),t.set("inputs",i)}return t},apply_search_results:function(t){return e.indexOf(t,this.attributes.id)!==-1?this.show():this.hide(),this.is_visible()},set_input_value:function(e,t){this.get("inputs").find(function(t){return t.get("name")===e}).set("value",t)},set_input_values:function(t){var i=this;e.each(e.keys(t),function(e){i.set_input_value(e,t[e])})},run:function(){return this._run()},rerun:function(e,t){return this._run({action:"rerun",target_dataset_id:e.id,regions:t})},get_inputs_dict:function(){var e={};return this.get("inputs").each(function(t){e[t.get("name")]=t.get("value")}),e},_run:function(n){var s=e.extend({tool_id:this.id,inputs:this.get_inputs_dict()},n),o=a.Deferred(),r=new t.ServerStateDeferred({ajax_settings:{url:this.urlRoot,data:JSON.stringify(s),dataType:"json",contentType:"application/json",type:"POST"},interval:2e3,success_fn:function(e){return"pending"!==e}});return a.when(r.go()).then(function(e){o.resolve(new i.DatasetCollection(e))}),o}});e.extend(p.prototype,s);var g=(o.View.extend({}),o.Collection.extend({model:p})),f=o.Model.extend(s),m=o.Model.extend({defaults:{elems:[],open:!1},clear_search_results:function(){e.each(this.attributes.elems,function(e){e.show()}),this.show(),this.set("open",!1)},apply_search_results:function(t){var i,n=!0;e.each(this.attributes.elems,function(e){e instanceof f?(i=e,i.hide()):e instanceof p&&e.apply_search_results(t)&&(n=!1,i&&i.show())}),n?this.hide():(this.show(),this.set("open",!0))}});e.extend(m.prototype,s);var v=o.Model.extend({defaults:{search_hint_string:"search tools",min_chars_for_search:3,clear_btn_url:"",visible:!0,query:"",results:null,clear_key:27},urlRoot:Galaxy.root+"api/tools",initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var e=this.attributes.query;if(e.length");e.append(k.tool_link(this.model.toJSON()));var t=this.model.get("form_style",null);if("upload1"===this.model.id)e.find("a").on("click",function(e){e.preventDefault(),Galaxy.upload.show()});else if("regular"===t){var i=this;e.find("a").on("click",function(e){e.preventDefault();var t=new n.View({id:i.model.id,version:i.model.get("version")});t.deferred.execute(function(){Galaxy.app.display(t)})})}return this.$el.append(e),this}}),b=y.extend({tagName:"div",className:"toolPanelLabel",render:function(){return this.$el.append(a("").text(this.model.attributes.text)),this}}),x=y.extend({tagName:"div",className:"toolSectionWrapper",initialize:function(){y.prototype.initialize.call(this),this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(k.panel_section(this.model.toJSON()));var t=this.$el.find(".toolSectionBody");return e.each(this.model.attributes.elems,function(e){if(e instanceof p){var i=new w({model:e,className:"toolTitle"});i.render(),t.append(i.$el)}else if(e instanceof f){var n=new b({model:e});n.render(),t.append(n.$el)}}),this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast")}}),C=o.View.extend({tagName:"div",id:"tool-search",className:"bar",events:{click:"focus_and_select","keyup :input":"query_changed","click #search-clear-btn":"clear"},render:function(){return this.$el.append(k.tool_search(this.model.toJSON())),this.model.is_visible()||this.$el.hide(),a("#messagebox").is(":visible")&&this.$el.css("top","95px"),this.$el.find("[title]").tooltip(),this},focus_and_select:function(){this.$el.find(":input").focus().select()},clear:function(){return this.model.clear_search(),this.$el.find(":input").val(""),this.focus_and_select(),!1},query_changed:function(e){return this.model.attributes.clear_key&&this.model.attributes.clear_key===e.which?(this.clear(),!1):void this.model.set("query",this.$el.find(":input").val())}}),$=o.View.extend({tagName:"div",className:"toolMenu",initialize:function(){this.model.get("tool_search").on("change:results",this.handle_search_results,this)},render:function(){var e=this,t=new C({model:this.model.get("tool_search")});return t.render(),e.$el.append(t.$el),this.model.get("layout").each(function(t){if(t instanceof m){var i=new x({model:t});i.render(),e.$el.append(i.$el)}else if(t instanceof p){var n=new w({model:t,className:"toolTitleNoSection"});n.render(),e.$el.append(n.$el)}else if(t instanceof f){var s=new b({model:t});s.render(),e.$el.append(s.$el)}}),e.$el.find("a.tool-link").click(function(t){var i=a(this).attr("class").split(/\s+/)[0],n=e.model.get("tools").get(i);e.trigger("tool_link_click",t,n)}),this},handle_search_results:function(){var e=this.model.get("tool_search").get("results");e&&0===e.length?a("#search-no-results").show():a("#search-no-results").hide()}}),E=o.View.extend({className:"toolForm",render:function(){this.$el.children().remove(),this.$el.append(k.tool_form(this.model.toJSON()))}}),k=(o.View.extend({className:"toolMenuAndView",initialize:function(){this.tool_panel_view=new $({collection:this.collection}),this.tool_form_view=new E},render:function(){this.tool_panel_view.render(),this.tool_panel_view.$el.css("float","left"),this.$el.append(this.tool_panel_view.$el),this.tool_form_view.$el.hide(),this.$el.append(this.tool_form_view.$el);var e=this;this.tool_panel_view.on("tool_link_click",function(t,i){t.preventDefault(),e.show_tool(i)})},show_tool:function(e){var t=this;e.fetch().done(function(){t.tool_form_view.model=e,t.tool_form_view.render(),t.tool_form_view.$el.show(),a("#left").width("650px")})}}),{tool_search:e.template(['',' ',''].join("")),panel_section:e.template(['",'