text: define("mvc/collection/collection-view",["exports","mvc/list/list-view","mvc/collection/collection-model","mvc/collection/collection-li","mvc/base-mvc","utils/localization"],function(e,t,n,i,l,a){"use strict";function s(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.get("collection_type");return"list"==t?(0,p.default)("list"):"paired"==t?(0,p.default)("dataset pair"):"list:paired"==t?(0,p.default)("list of pairs"):(0,p.default)("nested list")}function d(e){var t=e.get("element_count"),n="a "+o(e);if(t){var i;1==t?i="with 1 item":t&&(i="with "+t+" items"),n=n+" "+(0,p.default)(i)}return n}Object.defineProperty(e,"__esModule",{value:!0});var c=s(t),r=(s(n),s(i)),p=(s(l),s(a)),u=c.default.ModelListPanel,f=u.extend({_logNamespace:"collections",className:u.prototype.className+" dataset-collection-panel",DatasetDCEViewClass:r.default.DatasetDCEListItemView,modelCollectionKey:"elements",initialize:function(e){u.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank",this.dragItems=!0,this.hasUser=e.hasUser,this.panelStack=[],this.parentName=e.parentName,this.foldoutStyle=e.foldoutStyle||"foldout",this.downloadUrl=Galaxy.root+"api/dataset_collections/"+this.model.attributes.id+"/download"},getNestedDCDCEViewClass:function(){return r.default.NestedDCDCEListItemView.extend({foldoutPanelClass:f})},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var n=this;this.handleWarning(e),n.log("_queueNewRender:",e,t),n._swapNewRender(e),n.trigger("rendered",n)},handleWarning:function(e){var t=this.views.length,n=this.model.get("element_count");if(n&&n!==t){var i=(0,p.default)("displaying only "+t+" of "+n+" items");e.find(".elements-warning").html('<div class="warningmessagesmall">'+i+"</div>")}},_filterCollection:function(){return this.model.getVisibleContents()},_getItemViewClass:function(e){switch(e.get("element_type")){case"hda":return this.DatasetDCEViewClass;case"dataset_collection":return this.getNestedDCDCEViewClass()}throw new TypeError("Unknown element type:",e.get("element_type"))},_getItemViewOptions:function(e){var t=u.prototype._getItemViewOptions.call(this,e);return _.extend(t,{linkTarget:this.linkTarget,hasUser:this.hasUser,foldoutStyle:this.foldoutStyle})},_setUpItemViewListeners:function(e){var t=this;return u.prototype._setUpItemViewListeners.call(t,e),t.listenTo(e,{"expanded:drilldown":function(e,t){this._expandDrilldownPanel(t)},"collapsed:drilldown":function(e,t){this._collapseDrilldownPanel(t)}}),this},_expandDrilldownPanel:function(e){this.panelStack.push(e),this.$("> .controls").add(this.$list()).hide(),e.parentName=this.model.get("name"),this.$el.append(e.render().$el)},_collapseDrilldownPanel:function(e){this.panelStack.pop(),this.render()},events:{"click .navigation .back":"close"},close:function(e){this.remove(),this.trigger("close")},toString:function(){return"CollectionView("+(this.model?this.model.get("name"):"")+")"}});f.prototype.templates=_.extend(_.clone(u.prototype.templates),{controls:function(e,t){var n=d(t.model);return'\n        <div class="controls">\n            <div class="navigation">\n            <a class="back" href="javascript:void(0)">\n                <span class="fa fa-icon fa-angle-left"></span>\n                '+(0,p.default)("Back to ")+"\n                "+_.escape(t.parentName)+'\n            </a>\n            </div>\n            <div class="title">\n                <div class="name">'+(_.escape(e.name)||_.escape(e.element_identifier))+'</div>\n                <div class="subtitle">\n                    '+n+'\n                </div>\n            </div>\n            <div class="elements-warning">\n            </div>\n            <div class="tags-display"></div>\n            <div class="actions">\n                <a class="download-btn icon-btn" href="'+t.downloadUrl+'"\n                   title="" download="" data-original-title="Download Collection">\n                   <span class="fa fa-floppy-o"></span>\n                </a>\n            </div>\n        </div>'}}),e.default={collectionTypeDescription:o,collectionDescription:d,CollectionView:f}});