diff --git a/client/galaxy/scripts/mvc/collection/list-collection-creator.js b/client/galaxy/scripts/mvc/collection/list-collection-creator.js index 4f04ae04f80..c1f69d12f61 100644 --- a/client/galaxy/scripts/mvc/collection/list-collection-creator.js +++ b/client/galaxy/scripts/mvc/collection/list-collection-creator.js @@ -9,6 +9,11 @@ define([ "ui/hoverhighlight" ], function( HDCA, STATES, BASE_MVC, UI_MODAL, naturalSort, _l ){ /*============================================================================== +TODO: + use proper Element model and not just json + straighten out createFn, collection.createHDCA + possibly stop using modals for this + It would be neat to do a drag and drop ==============================================================================*/ /** A view for both DatasetDCEs and NestedDCDCEs @@ -327,15 +332,7 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten /** build and show an alert describing any elements that could not be included due to problems */ _invalidElementsAlert : function(){ - var message = _l( 'The following selections could not be included due to problems' ) + ':'; - message += '
"+JSON.stringify(c.responseJSON)+"":": "+d}b._showAlert(content,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(){"function"==typeof this.oncancel&&this.oncancel.call(this)},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(a){a.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(a){a.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(a){a.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(a,b){b=b||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(b).show().find(".alert-message").html(a)},_hideAlert:function(){this.$(".main-help").show(),this.$(".header .alert").hide()},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(a){a.preventDefault();var b=this.$list();this._checkForAutoscroll(b,a.originalEvent.clientY);var c=this._getNearestElement(a.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var d=$('');c.size()?c.before(d):b.append(d)},_checkForAutoscroll:function(a,b){var c=2,d=a.offset(),e=a.scrollTop(),f=b-d.top,g=d.top+a.outerHeight()-b;f>=0&&f
",f(["Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ","workflows in order to have analyses done on each member of the entire group. This interface allows ","you to create a collection and re-order the final collection."].join("")),"
","",f(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"
"].join("")),noElementsLeft:_.template(['"+JSON.stringify(c.responseJSON)+"":": "+d}b._showAlert(content,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(){"function"==typeof this.oncancel&&this.oncancel.call(this)},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(a){a.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(a){a.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(a){a.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(a,b){b=b||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(b).show().find(".alert-message").html(a)},_hideAlert:function(){this.$(".main-help").show(),this.$(".header .alert").hide()},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(a){a.preventDefault();var b=this.$list();this._checkForAutoscroll(b,a.originalEvent.clientY);var c=this._getNearestElement(a.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var d=$('');c.size()?c.before(d):b.append(d)},_checkForAutoscroll:function(a,b){var c=2,d=a.offset(),e=a.scrollTop(),f=b-d.top,g=d.top+a.outerHeight()-b;f>=0&&f
",f(["Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ","workflows in order to have analyses done on each member of the entire group. This interface allows ","you to create a collection and re-order the final collection."].join("")),"
","",f(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"
"].join("")),invalidElements:_.template([f("The following selections could not be included due to problems"),"",e(["Pair collections are permanent collections containing two datasets: one forward and one reverse. ","Often these are forward and reverse reads. The pair collections can be passed to tools and ","workflows in order to have analyses done on both datasets. This interface allows ","you to create a pair, name it, and swap which is forward and which reverse."].join("")),"
","",e(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"
"].join(""))}),toString:function(){return"PairCollectionCreator"}}),j=function(b,c){return c=c||{},c.title=e("Create a collection from a pair of datasets"),a.collectionCreatorModal(b,c,i)};return{PairCollectionCreator:i,pairCollectionCreatorModal:j,createPairCollection:f}}); +define(["mvc/collection/list-collection-creator","mvc/history/hdca-model","mvc/base-mvc","utils/localization"],function(a,b,c,d){function e(a){var b=a.toJSON(),c=i(b,{creationFn:function(b,c){return b=[{name:"forward",src:"hda",id:b[0].id},{name:"reverse",src:"hda",id:b[1].id}],a.createHDCA(b,"paired",c)}});return c}var f=Backbone.View.extend(c.LoggableMixin).extend({tagName:"li",className:"collection-element",initialize:function(a){this.element=a.element||{},this.identifier=a.identifier},render:function(){return this.$el.attr("data-element-id",this.element.id).html(this.template({identifier:this.identifier,element:this.element})),this},template:_.template(['<%= identifier %>','<%= element.name %>'].join("")),destroy:function(){this.off(),this.$el.remove()},toString:function(){return"DatasetCollectionElementView()"}}),g=a.ListCollectionCreator,h=g.extend({elementViewClass:f,collectionClass:b.HistoryPairDatasetCollection,className:"pair-collection-creator collection-creator flex-row-container",_mangleDuplicateNames:function(){},render:function(a,b){var c=this.workingElements.length;return 2===c?g.prototype.render.call(this,a,b):this._renderInvalid(a,b)},_renderInvalid:function(){return this.$el.empty().html(this.templates.invalidInitial({problems:this.invalidElements,elements:this.workingElements})),"function"==typeof this.oncancel&&this.$(".cancel-create.btn").show(),this.trigger("rendered",this),this},_renderList:function(){var a=this,b=jQuery(""),c=a.$list();_.each(this.elementViews,function(b){b.destroy(),a.removeElementView(b)}),b.append(a._createForwardElementView().$el),b.append(a._createReverseElementView().$el),c.empty().append(b.children()),_.invoke(a.elementViews,"render")},_createForwardElementView:function(){return this._createElementView(this.workingElements[0],{identifier:"forward"})},_createReverseElementView:function(){return this._createElementView(this.workingElements[1],{identifier:"reverse"})},_createElementView:function(a,b){var c=new this.elementViewClass(_.extend(b,{element:a}));return this.elementViews.push(c),c},swap:function(){this.workingElements=[this.workingElements[1],this.workingElements[0]],this._renderList()},events:_.extend(_.clone(g.prototype.events),{"click .swap":"swap"}),templates:_.extend(_.clone(g.prototype.templates),{middle:_.template(['",d(["Pair collections are permanent collections containing two datasets: one forward and one reverse. ","Often these are forward and reverse reads. The pair collections can be passed to tools and ","workflows in order to have analyses done on both datasets. This interface allows ","you to create a pair, name it, and swap which is forward and which reverse."].join("")),"
","",d(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"
"].join("")),invalidInitial:_.template(['