Skip to content

Commit

Permalink
show proper message when search has no results
Browse files Browse the repository at this point in the history
  • Loading branch information
martenson committed Oct 8, 2015
1 parent 2d4bd2e commit 39f5b7a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
11 changes: 9 additions & 2 deletions client/galaxy/scripts/mvc/library/library-librarylist-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,16 @@ var LibraryListView = Backbone.View.extend({
}
this.$el.html( template({
length: 1,
order: Galaxy.libraries.preferences.get( 'sort_order' )
order: Galaxy.libraries.preferences.get( 'sort_order' ),
search_term: Galaxy.libraries.libraryToolbarView.options.search_term
}));
Galaxy.libraries.libraryToolbarView.renderPaginator( this.options );
this.renderRows( libraries_to_render );
} else {
this.$el.html( template({
length: 0,
order: Galaxy.libraries.preferences.get( 'sort_order' )
order: Galaxy.libraries.preferences.get( 'sort_order' ),
search_term: Galaxy.libraries.libraryToolbarView.options.search_term
}));
Galaxy.libraries.libraryToolbarView.renderPaginator( this.options );
}
Expand Down Expand Up @@ -176,6 +178,7 @@ var LibraryListView = Backbone.View.extend({

searchLibraries: function(search_term){
var results = this.collection.search(search_term);
this.options.searching = true;
this.render({'models': results});
},

Expand All @@ -188,7 +191,11 @@ var LibraryListView = Backbone.View.extend({

tmpl_array.push('<div class="library_container table-responsive">');
tmpl_array.push('<% if(length === 0) { %>');
tmpl_array.push('<% if(search_term.length > 0) { %>');
tmpl_array.push('<div>There are no libraries matching your search. Try different keyword.</div>');
tmpl_array.push('<% } else{ %>');
tmpl_array.push('<div>There are no libraries visible to you here. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity" target="_blank">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/" target="_blank">Galaxy support site</a>.</div>');
tmpl_array.push('<% }%>');
tmpl_array.push('<% } else{ %>');
tmpl_array.push('<table class="grid table table-condensed">');
tmpl_array.push(' <thead>');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ function(mod_toastr,
var LibraryToolbarView = Backbone.View.extend({
el: '#center',

defaults: {
search_term: ''
}

events: {
'click #create_new_library_btn' : 'showLibraryModal',
'click #include_deleted_chk' : 'includeDeletedChecked',
Expand All @@ -18,7 +22,7 @@ var LibraryToolbarView = Backbone.View.extend({
},

initialize: function( options ){
this.options = _.defaults( this.options || {}, options );
this.options = _.defaults( this.options || {}, this.defaults, options );
this.render();
},

Expand Down Expand Up @@ -157,6 +161,7 @@ var LibraryToolbarView = Backbone.View.extend({
*/
searchLibraries: function(event){
var search_term = $(".library-search-input").val();
this.options.search_term = search_term;
Galaxy.libraries.libraryListView.searchLibraries(search_term);
},

Expand Down
2 changes: 1 addition & 1 deletion static/maps/mvc/library/library-librarylist-view.js.map

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

2 changes: 1 addition & 1 deletion static/maps/mvc/library/library-librarytoolbar-view.js.map

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

Loading

0 comments on commit 39f5b7a

Please sign in to comment.