Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add public-only filter for data libraries #4232

Merged
merged 7 commits into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/galaxy/scripts/galaxy.library.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ var LibraryRouter = Backbone.Router.extend({
var LibraryPrefs = mod_baseMVC.SessionStorageModel.extend({
defaults : {
with_deleted : false,
without_restricted: false,
sort_order : 'asc',
sort_by : 'name',
library_page_size : 20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var LibraryListView = Backbone.View.extend({
var template = this.templateLibraryList();
var libraries_to_render = null;
var models = null;
var is_public = function(model){ return model.get('public') === true; }
$( ".tooltip" ).hide();
if ( typeof options !== 'undefined' ){
models = typeof options.models !== 'undefined' ? options.models : null;
Expand All @@ -77,12 +78,18 @@ var LibraryListView = Backbone.View.extend({
} else {
libraries_to_render = this.collection.where( { deleted: false } );
}
if ( Galaxy.libraries.preferences.get( 'without_restricted' ) ){
libraries_to_render = _.filter( libraries_to_render, is_public );
}
} else if ( models !== null ){
if ( Galaxy.libraries.preferences.get( 'with_deleted' ) ){
libraries_to_render = models;
} else {
var is_deleted = function(model){ return model.get('deleted') === false; }
libraries_to_render = _.filter(models, is_deleted );
libraries_to_render = _.filter( models, is_deleted );
}
if ( Galaxy.libraries.preferences.get( 'without_restricted' ) ) {
libraries_to_render = _.filter( libraries_to_render, is_public );
}
} else {
libraries_to_render = [];
Expand Down
21 changes: 20 additions & 1 deletion client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var LibraryToolbarView = Backbone.View.extend({
events: {
'click #create_new_library_btn' : 'createLibraryFromModal',
'click #include_deleted_chk' : 'includeDeletedChecked',
'click #exclude_restricted_chk' : 'excludeRestrictedChecked',
'click #lib_page_size_prompt' : 'showPageSizePrompt',
'keyup .library-search-input' : 'searchLibraries'
},
Expand All @@ -37,6 +38,7 @@ var LibraryToolbarView = Backbone.View.extend({
this.$el.html(toolbar_template( { admin_user: is_admin, anon_user: is_anonym } ) );
if ( is_admin ){
this.$el.find( '#include_deleted_chk' )[0].checked = Galaxy.libraries.preferences.get( 'with_deleted' );
this.$el.find( '#exclude_restricted_chk' )[0].checked = Galaxy.libraries.preferences.get( 'without_restricted' );
}
},

Expand Down Expand Up @@ -155,6 +157,18 @@ var LibraryToolbarView = Backbone.View.extend({
}
},

/**
* Include or exclude restricted libraries in the view.
*/
excludeRestrictedChecked: function( event ) {
if (event.target.checked){
Galaxy.libraries.preferences.set( { 'without_restricted': true } );
} else {
Galaxy.libraries.preferences.set( { 'without_restricted': false });
}
Galaxy.libraries.libraryListView.render();
},

/**
* Take the contents of the search field and send it to the list view
* to query the collection of libraries.
Expand Down Expand Up @@ -183,7 +197,12 @@ var LibraryToolbarView = Backbone.View.extend({
'<div class="checkbox toolbar-item" style="height: 20px;">',
'<label>',
'<input id="include_deleted_chk" type="checkbox">',
'&nbsp;include deleted ',
'include deleted ',
'</input>',
'</label>',
'<label>',
'<input id="exclude_restricted_chk" type="checkbox">',
'exclude restricted',
'</input>',
'</label>',
'</div>',
Expand Down
2 changes: 1 addition & 1 deletion static/maps/galaxy.library.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading