Skip to content

Commit 5fa5467

Browse files
committed
Allow collection builders to hide original datasets.
1 parent c9d06ae commit 5fa5467

20 files changed

+253
-226
lines changed

client/galaxy/scripts/mvc/collection/base-creator.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ var CollectionCreatorMixin = {
2121
}
2222
},
2323

24+
_changeHideOriginals: function( ev ) {
25+
this.hideOriginals = this.$( '.hide-originals' ).prop("checked");
26+
},
27+
2428
// ........................................................................ footer
2529
/** handle a collection name change */
2630
_changeName : function( ev ){
@@ -89,6 +93,23 @@ var CollectionCreatorMixin = {
8993
}
9094
},
9195

96+
_setUpCommonSettings : function( ) {
97+
this.hideOriginals = false;
98+
},
99+
100+
/** render the footer, completion controls, and cancel controls */
101+
_renderFooter : function( speed, callback ){
102+
var instance = this;
103+
var $footer = this.$( '.footer' ).empty().html( this.templates.footer() );
104+
_.each( this.footerSettings, function( property, selector ) {
105+
this.$( selector ).prop( 'checked', instance[ property ] );
106+
});
107+
if( typeof this.oncancel === 'function' ){
108+
this.$( '.cancel-create.btn' ).show();
109+
}
110+
return $footer;
111+
},
112+
92113
_creatorTemplates: {
93114
main : _.template([
94115
'<div class="header flex-row no-flex"></div>',

client/galaxy/scripts/mvc/collection/list-collection-creator.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten
179179
highlightClr : 'rgba( 64, 255, 255, 1.0 )'
180180
},
181181

182+
footerSettings : {
183+
'.hide-originals': 'hideOriginals'
184+
},
185+
182186
/** set up initial options, instance vars, behaviors */
183187
initialize : function( attributes ){
184188
this.metric( 'ListCollectionCreator.initialize', attributes );
@@ -191,6 +195,7 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten
191195
/** unordered, original list - cache to allow reversal */
192196
creator.initialElements = attributes.elements || [];
193197

198+
this._setUpCommonSettings();
194199
this._instanceSetUp();
195200
this._elementsSetUp();
196201
this._setUpBehaviors();
@@ -348,15 +353,6 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten
348353
return $middle;
349354
},
350355

351-
/** render the footer, completion controls, and cancel controls */
352-
_renderFooter : function( speed, callback ){
353-
var $footer = this.$( '.footer' ).empty().html( this.templates.footer() );
354-
if( typeof this.oncancel === 'function' ){
355-
this.$( '.cancel-create.btn' ).show();
356-
}
357-
return $footer;
358-
},
359-
360356
/** add any jQuery/bootstrap/custom plugins to elements rendered */
361357
_addPluginComponents : function(){
362358
this.$( '.help-content i' ).hoverhighlight( '.collection-creator', this.highlightClr );
@@ -513,7 +509,7 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten
513509
});
514510

515511
creator.blocking = true;
516-
return creator.creationFn( elements, name )
512+
return creator.creationFn( elements, name, creator.hideOriginals )
517513
.always( function(){
518514
creator.blocking = false;
519515
})
@@ -609,6 +605,7 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten
609605
// footer
610606
'change .collection-name' : '_changeName',
611607
'keydown .collection-name' : '_nameCheckForEnter',
608+
'change .hide-originals' : '_changeHideOriginals',
612609
'click .cancel-create' : '_cancelCreate',
613610
'click .create-collection' : '_clickCreate'//,
614611
},
@@ -777,6 +774,12 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten
777774
/** creation and cancel controls */
778775
footer : _.template([
779776
'<div class="attributes clear">',
777+
'<div class="clear">',
778+
'<label class="setting-prompt pull-right">',
779+
_l( 'Hide original elements' ), '?',
780+
'<input class="hide-originals pull-right" type="checkbox" />',
781+
'</label>',
782+
'</div>',
780783
'<div class="clear">',
781784
'<input class="collection-name form-control pull-right" ',
782785
'placeholder="', _l( 'Enter a name for your new collection' ), '" />',
@@ -948,7 +951,7 @@ var listCollectionCreatorModal = function _listCollectionCreatorModal( elements,
948951
function createListCollection( contents ){
949952
var elements = contents.toJSON(),
950953
promise = listCollectionCreatorModal( elements, {
951-
creationFn : function( elements, name ){
954+
creationFn : function( elements, name, hideSourceItems ){
952955
elements = elements.map( function( element ){
953956
return {
954957
id : element.id,
@@ -957,7 +960,7 @@ function createListCollection( contents ){
957960
src : ( element.history_content_type === 'dataset'? 'hda' : 'hdca' )
958961
};
959962
});
960-
return contents.createHDCA( elements, 'list', name );
963+
return contents.createHDCA( elements, 'list', name, hideSourceItems );
961964
}
962965
});
963966
return promise;

0 commit comments

Comments
 (0)