mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Webpack: fix masthead in libraries; update Panel usage in base_panels.mako, galaxy.panels.mako
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
|
||||
|
||||
define([
|
||||
"galaxy.masthead",
|
||||
"layout/masthead",
|
||||
"utils/utils",
|
||||
"libs/toastr",
|
||||
"mvc/base-mvc",
|
||||
@@ -32,7 +32,7 @@ define([
|
||||
|
||||
// ============================================================================
|
||||
/**
|
||||
* The Data Libraries router. Takes care about triggering routes
|
||||
* The Data Libraries router. Takes care about triggering routes
|
||||
* and sends users to proper pieces of the application.
|
||||
*/
|
||||
var LibraryRouter = Backbone.Router.extend({
|
||||
@@ -140,7 +140,7 @@ var GalaxyLibrary = Backbone.View.extend({
|
||||
Galaxy.libraries.libraryToolbarView = new mod_librarytoolbar_view.LibraryToolbarView();
|
||||
Galaxy.libraries.libraryListView = new mod_librarylist_view.LibraryListView();
|
||||
});
|
||||
|
||||
|
||||
this.library_router.on('route:libraries_page', function( show_page ) {
|
||||
if ( Galaxy.libraries.libraryToolbarView === null ){
|
||||
Galaxy.libraries.libraryToolbarView = new mod_librarytoolbar_view.LibraryToolbarView();
|
||||
@@ -151,7 +151,7 @@ var GalaxyLibrary = Backbone.View.extend({
|
||||
});
|
||||
|
||||
this.library_router.on( 'route:folder_content', function( id ) {
|
||||
if (Galaxy.libraries.folderToolbarView){
|
||||
if (Galaxy.libraries.folderToolbarView){
|
||||
Galaxy.libraries.folderToolbarView.$el.unbind( 'click' );
|
||||
}
|
||||
Galaxy.libraries.folderToolbarView = new mod_foldertoolbar_view.FolderToolbarView( { id: id } );
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define([
|
||||
"galaxy.masthead",
|
||||
"layout/masthead",
|
||||
"utils/utils",
|
||||
"libs/toastr",
|
||||
"mvc/library/library-model",
|
||||
@@ -102,7 +102,7 @@ var FolderListView = Backbone.View.extend({
|
||||
upper_folder_id = path[ path.length-2 ][ 0 ];
|
||||
}
|
||||
|
||||
this.$el.html( template( {
|
||||
this.$el.html( template( {
|
||||
path: this.folderContainer.attributes.metadata.full_path,
|
||||
parent_library_id: this.folderContainer.attributes.metadata.parent_library_id,
|
||||
id: this.options.id,
|
||||
@@ -259,8 +259,8 @@ var FolderListView = Backbone.View.extend({
|
||||
},
|
||||
|
||||
/**
|
||||
* Sorts the underlying collection according to the parameters received.
|
||||
* Currently supports only sorting by name.
|
||||
* Sorts the underlying collection according to the parameters received.
|
||||
* Currently supports only sorting by name.
|
||||
*/
|
||||
sortFolder: function(sort_by, order){
|
||||
console.log('sorting');
|
||||
@@ -293,13 +293,13 @@ var FolderListView = Backbone.View.extend({
|
||||
that.makeDarkRow($row);
|
||||
} else {
|
||||
that.makeWhiteRow($row);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Check checkbox if user clicks on the whole row or
|
||||
* on the checkbox itself
|
||||
/**
|
||||
* Check checkbox if user clicks on the whole row or
|
||||
* on the checkbox itself
|
||||
*/
|
||||
selectClickedRow : function (event) {
|
||||
var checkbox = '';
|
||||
@@ -396,7 +396,7 @@ var FolderListView = Backbone.View.extend({
|
||||
|
||||
return _.template(tmpl_array.join(''));
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define([
|
||||
"galaxy.masthead",
|
||||
"layout/masthead",
|
||||
"utils/utils",
|
||||
"libs/toastr",
|
||||
"mvc/library/library-model",
|
||||
@@ -66,7 +66,7 @@ var FolderRowView = Backbone.View.extend({
|
||||
var dataset_id = $(event.target).closest('tr')[0].id;
|
||||
var dataset = Galaxy.libraries.folderListView.collection.get(dataset_id);
|
||||
dataset.url = dataset.urlRoot + dataset.id + '?undelete=true';
|
||||
dataset.destroy({
|
||||
dataset.destroy({
|
||||
success : function(model, response){
|
||||
Galaxy.libraries.folderListView.collection.remove(dataset_id);
|
||||
var updated_dataset = new mod_library_model.Item(response);
|
||||
@@ -76,7 +76,7 @@ var FolderRowView = Backbone.View.extend({
|
||||
var folder_id = that.model.get('folder_id');
|
||||
window.location='#folders/' + folder_id + '/datasets/' + that.id;
|
||||
}});
|
||||
},
|
||||
},
|
||||
error : function(model, response){
|
||||
if (typeof response.responseJSON !== "undefined"){
|
||||
mod_toastr.error('Dataset was not undeleted. ' + response.responseJSON.err_msg);
|
||||
@@ -103,7 +103,7 @@ var FolderRowView = Backbone.View.extend({
|
||||
Galaxy.libraries.folderListView.collection.add(updated_folder);
|
||||
Galaxy.libraries.folderListView.collection.sortByNameAsc();
|
||||
mod_toastr.success('Folder undeleted.');
|
||||
},
|
||||
},
|
||||
error : function(model, response){
|
||||
if (typeof response.responseJSON !== "undefined"){
|
||||
mod_toastr.error('Folder was not undeleted. ' + response.responseJSON.err_msg);
|
||||
@@ -157,7 +157,7 @@ var FolderRowView = Backbone.View.extend({
|
||||
tmpl_array.push('</tr>');
|
||||
|
||||
return _.template(tmpl_array.join(''));
|
||||
},
|
||||
},
|
||||
|
||||
templateRowDeletedFile: function(){
|
||||
tmpl_array = [];
|
||||
@@ -196,7 +196,7 @@ var FolderRowView = Backbone.View.extend({
|
||||
|
||||
return _.template(tmpl_array.join(''));
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define([
|
||||
"galaxy.masthead",
|
||||
"layout/masthead",
|
||||
"utils/utils",
|
||||
"libs/toastr",
|
||||
"mvc/library/library-model",
|
||||
@@ -63,7 +63,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
' to set your data to the format you think it should be.' +
|
||||
' You can also upload compressed files, which will automatically be decompressed.'
|
||||
},
|
||||
|
||||
|
||||
// genomes
|
||||
list_genomes : [],
|
||||
|
||||
@@ -99,7 +99,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
renderPaginator: function( options ){
|
||||
this.options = _.extend( this.options, options );
|
||||
var paginator_template = this.templatePaginator();
|
||||
this.$el.find( '#folder_paginator' ).html( paginator_template({
|
||||
this.$el.find( '#folder_paginator' ).html( paginator_template({
|
||||
id: this.options.id,
|
||||
show_page: parseInt( this.options.show_page ),
|
||||
page_count: parseInt( this.options.page_count ),
|
||||
@@ -281,7 +281,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
}
|
||||
|
||||
this.initChainCallControl( { length: datasets_to_import.length, action: 'to_history', history_name: history_name } );
|
||||
// set the used history as current so user will see the last one
|
||||
// set the used history as current so user will see the last one
|
||||
// that he imported into in the history panel on the 'analysis' page
|
||||
jQuery.getJSON( galaxy_config.root + 'history/set_as_current?id=' + history_id );
|
||||
this.chainCallImportingIntoHistory( datasets_to_import, history_name );
|
||||
@@ -360,7 +360,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
Galaxy.libraries.library_router.back();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// user should always have a history, even anonymous user
|
||||
if (self.histories.models.length > 0){
|
||||
self.fetchAndDisplayHistoryContents(self.histories.models[0].id);
|
||||
@@ -393,7 +393,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
// TODO: should not trigger routes outside of the router
|
||||
Galaxy.libraries.library_router.navigate( 'folders/' + that.id, { trigger: true } );
|
||||
}
|
||||
});
|
||||
});
|
||||
this.renderSelectBoxes();
|
||||
},
|
||||
|
||||
@@ -439,7 +439,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
renderSelectBoxes: function(){
|
||||
// This won't work properly unlesss we already have the data fetched.
|
||||
// See this.fetchExtAndGenomes()
|
||||
// TODO switch to common resources:
|
||||
// TODO switch to common resources:
|
||||
// https://trello.com/c/dIUE9YPl/1933-ui-common-resources-and-data-into-galaxy-object
|
||||
var that = this;
|
||||
this.select_genome = new mod_select.View( {
|
||||
@@ -469,7 +469,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
title : 'Please select folders or files',
|
||||
body : template_modal({}),
|
||||
buttons : {
|
||||
'Import' : function() {
|
||||
'Import' : function() {
|
||||
that.importFromJstreePath( that, options );
|
||||
},
|
||||
'Close' : function() {
|
||||
@@ -503,7 +503,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
that.renderJstree( options );
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -518,9 +518,9 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
var target = options.source || 'userdir';
|
||||
var disabled_jstree_element = this.options.disabled_jstree_element;
|
||||
this.jstree = new mod_library_model.Jstree();
|
||||
this.jstree.url = this.jstree.urlRoot +
|
||||
'?target=' + target +
|
||||
'&format=jstree' +
|
||||
this.jstree.url = this.jstree.urlRoot +
|
||||
'?target=' + target +
|
||||
'&format=jstree' +
|
||||
'&disable=' + disabled_jstree_element;
|
||||
this.jstree.fetch({
|
||||
success: function(model, response){
|
||||
@@ -583,8 +583,8 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
};
|
||||
this.initChainCallControl( { length: valid_paths.length, action: 'adding_datasets' } );
|
||||
this.chainCallImportingFolders( { paths: valid_paths,
|
||||
preserve_dirs: preserve_dirs,
|
||||
link_data: link_data,
|
||||
preserve_dirs: preserve_dirs,
|
||||
link_data: link_data,
|
||||
source: 'admin_path',
|
||||
file_type: file_type,
|
||||
dbkey: dbkey } );
|
||||
@@ -626,9 +626,9 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
|
||||
/**
|
||||
* Take the selected items from the jstree, create a request queue
|
||||
* and send them one by one to the server for importing into
|
||||
* the current folder.
|
||||
*
|
||||
* and send them one by one to the server for importing into
|
||||
* the current folder.
|
||||
*
|
||||
* jstree.js has to be loaded before
|
||||
* @see renderJstree
|
||||
*/
|
||||
@@ -653,8 +653,8 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
if ( selection_type === 'folder' ){
|
||||
var full_source = options.source + '_folder';
|
||||
this.chainCallImportingFolders( { paths: paths,
|
||||
preserve_dirs: preserve_dirs,
|
||||
link_data: link_data,
|
||||
preserve_dirs: preserve_dirs,
|
||||
link_data: link_data,
|
||||
source: full_source,
|
||||
file_type: file_type,
|
||||
dbkey: dbkey } );
|
||||
@@ -767,7 +767,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
}
|
||||
return true;
|
||||
}
|
||||
var promise = $.when( $.post( ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/libraries/datasets?encoded_folder_id=' + that.id +
|
||||
var promise = $.when( $.post( ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/libraries/datasets?encoded_folder_id=' + that.id +
|
||||
'&source=' + options.source +
|
||||
'&path=' + popped_item +
|
||||
'&file_type=' + options.file_type +
|
||||
@@ -789,7 +789,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
* @param {array} paths paths relative to Galaxy root folder
|
||||
* @param {boolean} preserve_dirs indicates whether to preserve folder structure
|
||||
* @param {boolean} link_data copy files to Galaxy or link instead
|
||||
* @param {str} source string representing what type of folder
|
||||
* @param {str} source string representing what type of folder
|
||||
* is the source of import
|
||||
*/
|
||||
chainCallImportingFolders: function( options ){
|
||||
@@ -825,7 +825,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
},
|
||||
|
||||
/**
|
||||
* Take the array of hdas and create a request for each.
|
||||
* Take the array of hdas and create a request for each.
|
||||
* Call them in chain and update progress bar in between each.
|
||||
* @param {array} hdas_set array of empty hda objects
|
||||
*/
|
||||
@@ -859,7 +859,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
},
|
||||
|
||||
/**
|
||||
* Take the array of lddas, create request for each and
|
||||
* Take the array of lddas, create request for each and
|
||||
* call them in chain. Update progress bar in between each.
|
||||
* @param {array} lddas_set array of lddas to delete
|
||||
*/
|
||||
@@ -953,7 +953,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
var items_total = dataset_ids.length + folder_ids.length
|
||||
this.progressStep = 100 / items_total;
|
||||
this.progress = 0;
|
||||
|
||||
|
||||
// prepare the dataset items to be added
|
||||
var items_to_delete = [];
|
||||
for (var i = dataset_ids.length - 1; i >= 0; i--) {
|
||||
@@ -1017,7 +1017,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
case "importdir":
|
||||
this.importFilesFromGalaxyFolderModal( { source: 'importdir' } );
|
||||
break;
|
||||
case "path":
|
||||
case "path":
|
||||
this.importFilesFromPathModal();
|
||||
break;
|
||||
case "userdir":
|
||||
@@ -1215,7 +1215,7 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
tmpl_array.push('<div class="alert alert-info jstree-files-message">All files you select will be imported into the current folder.</div>');
|
||||
tmpl_array.push('<div class="alert alert-info jstree-folders-message" style="display:none;">All files within the selected folders and their subfolders will be imported into the current folder.</div>');
|
||||
|
||||
|
||||
|
||||
tmpl_array.push('<div style="margin-bottom:1em;">');
|
||||
tmpl_array.push('<label class="radio-inline">');
|
||||
tmpl_array.push(' <input title="Switch to selecting files" type="radio" name="jstree-radio" value="jstree-disable-folders" checked="checked"> Files');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define([
|
||||
"galaxy.masthead",
|
||||
"layout/masthead",
|
||||
"mvc/base-mvc",
|
||||
"utils/utils",
|
||||
"libs/toastr",
|
||||
@@ -29,7 +29,7 @@ var LibraryListView = Backbone.View.extend({
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize and fetch the libraries from server.
|
||||
* Initialize and fetch the libraries from server.
|
||||
* Async render afterwards.
|
||||
* @param {object} options an object with options
|
||||
*/
|
||||
@@ -53,10 +53,10 @@ var LibraryListView = Backbone.View.extend({
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Render the libraries table either from the object's own collection,
|
||||
/**
|
||||
* Render the libraries table either from the object's own collection,
|
||||
* or from a given array of library models,
|
||||
* or render an empty list in case no data is given.
|
||||
* or render an empty list in case no data is given.
|
||||
*/
|
||||
render: function ( options ) {
|
||||
this.options = _.extend( this.options, options );
|
||||
@@ -119,7 +119,7 @@ var LibraryListView = Backbone.View.extend({
|
||||
$( "#center" ).css( 'overflow','auto' );
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Render all given models as rows in the library list
|
||||
* @param {array} libraries_to_render array of library models to render
|
||||
*/
|
||||
@@ -155,7 +155,7 @@ var LibraryListView = Backbone.View.extend({
|
||||
|
||||
/**
|
||||
* Sort the underlying collection according to the parameters received.
|
||||
* Currently supports only sorting by name.
|
||||
* Currently supports only sorting by name.
|
||||
*/
|
||||
sortLibraries: function(){
|
||||
if (Galaxy.libraries.preferences.get('sort_by') === 'name'){
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// dependencies
|
||||
define([
|
||||
"galaxy.masthead",
|
||||
"layout/masthead",
|
||||
"utils/utils",
|
||||
"libs/toastr"],
|
||||
function(mod_masthead,
|
||||
@@ -18,7 +18,7 @@ var LibraryRowView = Backbone.View.extend({
|
||||
},
|
||||
|
||||
edit_mode: false,
|
||||
|
||||
|
||||
element_visibility_config: {
|
||||
upload_library_btn: false,
|
||||
edit_library_btn: false,
|
||||
@@ -45,22 +45,22 @@ var LibraryRowView = Backbone.View.extend({
|
||||
},
|
||||
|
||||
repaint: function(library){
|
||||
/* need to hide manually because of the element removal in setElement
|
||||
/* need to hide manually because of the element removal in setElement
|
||||
invoked in render() */
|
||||
$(".tooltip").hide();
|
||||
/* we need to store the old element to be able to replace it with
|
||||
/* we need to store the old element to be able to replace it with
|
||||
new one */
|
||||
var old_element = this.$el;
|
||||
/* if user canceled the library param is undefined,
|
||||
/* if user canceled the library param is undefined,
|
||||
if user saved and succeeded the updated library is rendered */
|
||||
this.render(library);
|
||||
old_element.replaceWith(this.$el);
|
||||
/* now we attach new tooltips to the newly created row element */
|
||||
this.$el.find("[data-toggle]").tooltip();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Function modifies the visibility of buttons for
|
||||
* Function modifies the visibility of buttons for
|
||||
* the filling of the row template of given library.
|
||||
*/
|
||||
prepareButtons: function(library){
|
||||
@@ -273,7 +273,7 @@ var LibraryRowView = Backbone.View.extend({
|
||||
|
||||
return _.template(tmpl_array.join(''));
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view","libs/underscore"],function(a,b,c,d,e,f,g){var h=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},defaults:{page_count:null,show_page:null},initialize:function(a){this.options=g.defaults(this.options||{},a,this.defaults);var b=this;this.modal=null,this.collection=new e.Libraries,this.collection.fetch({success:function(){b.render()},error:function(a,b){d.error("undefined"!=typeof b.responseJSON?b.responseJSON.err_msg:"An error ocurred.")}})},render:function(a){this.options=g.extend(this.options,a),this.setElement("#libraries_element");var b=this.templateLibraryList(),c=null,d=null;if($(".tooltip").hide(),"undefined"!=typeof a&&(d="undefined"!=typeof a.models?a.models:null),null!==this.collection&&null===d)this.sortLibraries(),c=Galaxy.libraries.preferences.get("with_deleted")?this.collection.models:this.collection.where({deleted:!1});else if(null!==d)if(Galaxy.libraries.preferences.get("with_deleted"))c=d;else{var e=function(a){return a.get("deleted")===!1};c=g.filter(d,e)}else c=[];(null===this.options.show_page||this.options.show_page<1)&&(this.options.show_page=1),this.options.total_libraries_count=c.length;var f=Galaxy.libraries.preferences.get("library_page_size")*(this.options.show_page-1);this.options.page_count=Math.ceil(this.options.total_libraries_count/Galaxy.libraries.preferences.get("library_page_size")),this.options.total_libraries_count>0&&f<this.options.total_libraries_count?(c=c.slice(f,f+Galaxy.libraries.preferences.get("library_page_size")),this.options.libraries_shown=c.length,Galaxy.libraries.preferences.get("library_page_size")*this.options.show_page>this.options.total_libraries_count+Galaxy.libraries.preferences.get("library_page_size")&&(c=[]),this.$el.html(b({length:1,order:Galaxy.libraries.preferences.get("sort_order"),search_term:Galaxy.libraries.libraryToolbarView.options.search_term})),Galaxy.libraries.libraryToolbarView.renderPaginator(this.options),this.renderRows(c)):(this.$el.html(b({length:0,order:Galaxy.libraries.preferences.get("sort_order"),search_term:Galaxy.libraries.libraryToolbarView.options.search_term})),Galaxy.libraries.libraryToolbarView.renderPaginator(this.options)),$("#center [data-toggle]").tooltip(),$("#center").css("overflow","auto")},renderRows:function(a){for(var b=0;b<a.length;b++){var c=a[b];this.renderOne({library:c})}},renderOne:function(a){var b=a.library,c=new f.LibraryRowView(b);this.$el.find("#library_list_body").append(c.el)},sort_clicked:function(){Galaxy.libraries.preferences.set("asc"===Galaxy.libraries.preferences.get("sort_order")?{sort_order:"desc"}:{sort_order:"asc"}),this.render()},sortLibraries:function(){"name"===Galaxy.libraries.preferences.get("sort_by")&&("asc"===Galaxy.libraries.preferences.get("sort_order")?this.collection.sortByNameAsc():"desc"===Galaxy.libraries.preferences.get("sort_order")&&this.collection.sortByNameDesc())},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},searchLibraries:function(a){var b=$.trim(a);if(""!==b){var c=null;c=this.collection.search(a),this.options.searching=!0,this.render({models:c})}else this.options.searching=!1,this.render()},templateLibraryList:function(){return tmpl_array=[],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>"),tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a> <span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>'),tmpl_array.push(' <th style="width:22%;">description</th>'),tmpl_array.push(' <th style="width:22%;">synopsis</th> '),tmpl_array.push(' <th style="width:26%;"></th>'),tmpl_array.push(" </thead>"),tmpl_array.push(' <tbody id="library_list_body">'),tmpl_array.push(" </tbody>"),tmpl_array.push("</table>"),tmpl_array.push("<% }%>"),tmpl_array.push("</div>"),g.template(tmpl_array.join(""))}});return{LibraryListView:h}});
|
||||
define(["layout/masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view","libs/underscore"],function(a,b,c,d,e,f,g){var h=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},defaults:{page_count:null,show_page:null},initialize:function(a){this.options=g.defaults(this.options||{},a,this.defaults);var b=this;this.modal=null,this.collection=new e.Libraries,this.collection.fetch({success:function(){b.render()},error:function(a,b){d.error("undefined"!=typeof b.responseJSON?b.responseJSON.err_msg:"An error ocurred.")}})},render:function(a){this.options=g.extend(this.options,a),this.setElement("#libraries_element");var b=this.templateLibraryList(),c=null,d=null;if($(".tooltip").hide(),"undefined"!=typeof a&&(d="undefined"!=typeof a.models?a.models:null),null!==this.collection&&null===d)this.sortLibraries(),c=Galaxy.libraries.preferences.get("with_deleted")?this.collection.models:this.collection.where({deleted:!1});else if(null!==d)if(Galaxy.libraries.preferences.get("with_deleted"))c=d;else{var e=function(a){return a.get("deleted")===!1};c=g.filter(d,e)}else c=[];(null===this.options.show_page||this.options.show_page<1)&&(this.options.show_page=1),this.options.total_libraries_count=c.length;var f=Galaxy.libraries.preferences.get("library_page_size")*(this.options.show_page-1);this.options.page_count=Math.ceil(this.options.total_libraries_count/Galaxy.libraries.preferences.get("library_page_size")),this.options.total_libraries_count>0&&f<this.options.total_libraries_count?(c=c.slice(f,f+Galaxy.libraries.preferences.get("library_page_size")),this.options.libraries_shown=c.length,Galaxy.libraries.preferences.get("library_page_size")*this.options.show_page>this.options.total_libraries_count+Galaxy.libraries.preferences.get("library_page_size")&&(c=[]),this.$el.html(b({length:1,order:Galaxy.libraries.preferences.get("sort_order"),search_term:Galaxy.libraries.libraryToolbarView.options.search_term})),Galaxy.libraries.libraryToolbarView.renderPaginator(this.options),this.renderRows(c)):(this.$el.html(b({length:0,order:Galaxy.libraries.preferences.get("sort_order"),search_term:Galaxy.libraries.libraryToolbarView.options.search_term})),Galaxy.libraries.libraryToolbarView.renderPaginator(this.options)),$("#center [data-toggle]").tooltip(),$("#center").css("overflow","auto")},renderRows:function(a){for(var b=0;b<a.length;b++){var c=a[b];this.renderOne({library:c})}},renderOne:function(a){var b=a.library,c=new f.LibraryRowView(b);this.$el.find("#library_list_body").append(c.el)},sort_clicked:function(){Galaxy.libraries.preferences.set("asc"===Galaxy.libraries.preferences.get("sort_order")?{sort_order:"desc"}:{sort_order:"asc"}),this.render()},sortLibraries:function(){"name"===Galaxy.libraries.preferences.get("sort_by")&&("asc"===Galaxy.libraries.preferences.get("sort_order")?this.collection.sortByNameAsc():"desc"===Galaxy.libraries.preferences.get("sort_order")&&this.collection.sortByNameDesc())},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},searchLibraries:function(a){var b=$.trim(a);if(""!==b){var c=null;c=this.collection.search(a),this.options.searching=!0,this.render({models:c})}else this.options.searching=!1,this.render()},templateLibraryList:function(){return tmpl_array=[],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>"),tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a> <span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>'),tmpl_array.push(' <th style="width:22%;">description</th>'),tmpl_array.push(' <th style="width:22%;">synopsis</th> '),tmpl_array.push(' <th style="width:26%;"></th>'),tmpl_array.push(" </thead>"),tmpl_array.push(' <tbody id="library_list_body">'),tmpl_array.push(" </tbody>"),tmpl_array.push("</table>"),tmpl_array.push("<% }%>"),tmpl_array.push("</div>"),g.template(tmpl_array.join(""))}});return{LibraryListView:h}});
|
||||
//# sourceMappingURL=../../../maps/mvc/library/library-librarylist-view.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -114,12 +114,12 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
%if self.has_left_panel:
|
||||
var lp = new panels.LeftPanel({});
|
||||
var lp = new panels.LeftPanel({ el: '#left' });
|
||||
force_left_panel = function( x ) { lp.force_panel( x ) };
|
||||
%endif
|
||||
|
||||
%if self.has_right_panel:
|
||||
var rp = new panels.RightPanel({});
|
||||
var rp = new panels.RightPanel({ el: '#right' });
|
||||
window.handle_minwidth_hint = function( x ) { rp.handle_minwidth_hint( x ) };
|
||||
force_right_panel = function( x ) { rp.force_panel( x ) };
|
||||
%endif
|
||||
|
||||
@@ -149,13 +149,13 @@
|
||||
|
||||
## configure left panel
|
||||
%if self.galaxy_config['left_panel']:
|
||||
var lp = new panels.LeftPanel({});
|
||||
var lp = new panels.LeftPanel({ el: '#left' });
|
||||
force_left_panel = function( x ) { lp.force_panel( x ) };
|
||||
%endif
|
||||
|
||||
## configure right panel
|
||||
%if self.galaxy_config['right_panel']:
|
||||
var rp = new panels.RightPanel({});
|
||||
var rp = new panels.RightPanel({ el: '#right' });
|
||||
window.handle_minwidth_hint = function( x ) { rp.handle_minwidth_hint( x ) };
|
||||
force_right_panel = function( x ) { rp.force_panel( x ) };
|
||||
%endif
|
||||
|
||||
Reference in New Issue
Block a user