mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
library tweaks, help buttons, refactoring,
This commit is contained in:
@@ -161,10 +161,13 @@ class FolderContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrary
|
||||
|
||||
# Check whether user can modify the current folder
|
||||
can_modify_folder = is_admin or trans.app.security_agent.can_modify_library_item( current_user_roles, folder )
|
||||
|
||||
parent_library_id = None
|
||||
if folder.parent_library is not None:
|
||||
parent_library_id = trans.security.encode_id( folder.parent_library.id )
|
||||
metadata = dict( full_path=full_path,
|
||||
can_add_library_item=can_add_library_item,
|
||||
can_modify_folder=can_modify_folder )
|
||||
can_modify_folder=can_modify_folder,
|
||||
parent_library_id=parent_library_id )
|
||||
folder_container = dict( metadata=metadata, folder_contents=folder_contents )
|
||||
return folder_container
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class LibraryDatasetsController( BaseAPIController, UsesVisualizationMixin ):
|
||||
rval[ 'can_user_manage' ] = trans.app.security_agent.can_manage_dataset( current_user_roles, library_dataset.library_dataset_dataset_association.dataset) or trans.user_is_admin()
|
||||
return rval
|
||||
|
||||
@expose_api
|
||||
@expose_api_anonymous
|
||||
def show_version( self, trans, encoded_dataset_id, encoded_ldda_id, **kwd ):
|
||||
"""
|
||||
show_version( self, trans, encoded_dataset_id, encoded_ldda_id, **kwd ):
|
||||
|
||||
@@ -88,6 +88,13 @@ var LibraryDatasetView = Backbone.View.extend({
|
||||
this.ldda.fetch({
|
||||
success: function(){
|
||||
that.renderVersion();
|
||||
},
|
||||
error: function(model, response){
|
||||
if (typeof response.responseJSON !== "undefined"){
|
||||
mod_toastr.error(response.responseJSON.err_msg);
|
||||
} else {
|
||||
mod_toastr.error('An error ocurred :(');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -153,8 +160,12 @@ var LibraryDatasetView = Backbone.View.extend({
|
||||
var self = this;
|
||||
this.histories = new mod_library_model.GalaxyHistories();
|
||||
this.histories.fetch({
|
||||
success: function (){
|
||||
callback(self);
|
||||
success: function (histories){
|
||||
if (histories.length === 0){
|
||||
mod_toastr.warning('You have to create history first. Click this to do so.', '', {onclick: function() {window.location='/';}});
|
||||
} else {
|
||||
callback(self);
|
||||
}
|
||||
},
|
||||
error: function(model, response){
|
||||
if (typeof response.responseJSON !== "undefined"){
|
||||
@@ -645,7 +656,7 @@ var LibraryDatasetView = Backbone.View.extend({
|
||||
tmpl_array.push('<div class="library_style_container">');
|
||||
|
||||
tmpl_array.push(' <div id="library_toolbar">');
|
||||
tmpl_array.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>"><button data-toggle="tooltip" data-placement="top" title="Go to current dataset" class="btn btn-default primary-button" type="button"><span class="fa fa-file-o"></span> Latest dataset</span></button><a>');
|
||||
tmpl_array.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>"><button data-toggle="tooltip" data-placement="top" title="Go to latest dataset" class="btn btn-default primary-button" type="button"><span class="fa fa-caret-left fa-lg"></span> Latest dataset</span></button><a>');
|
||||
tmpl_array.push(' </div>');
|
||||
|
||||
// BREADCRUMBS
|
||||
|
||||
@@ -100,7 +100,7 @@ var FolderListView = Backbone.View.extend({
|
||||
upper_folder_id = path[path.length-2][0];
|
||||
}
|
||||
|
||||
this.$el.html(template({ path: this.folderContainer.attributes.metadata.full_path, id: this.options.id, upper_folder_id: upper_folder_id, order: this.sort}));
|
||||
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, upper_folder_id: upper_folder_id, order: this.sort}));
|
||||
|
||||
// initialize the library tooltips
|
||||
$("#center [data-toggle]").tooltip();
|
||||
@@ -304,7 +304,7 @@ var FolderListView = Backbone.View.extend({
|
||||
tmpl_array.push('</ol>');
|
||||
|
||||
// FOLDER CONTENT
|
||||
tmpl_array.push('<table id="folder_table" class="grid table table-condensed">');
|
||||
tmpl_array.push('<table data-library-id="<%- parent_library_id %>" id="folder_table" class="grid table table-condensed">');
|
||||
tmpl_array.push(' <thead>');
|
||||
tmpl_array.push(' <th class="button_heading"></th>');
|
||||
tmpl_array.push(' <th style="text-align: center; width: 20px; " title="Check to select all datasets"><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');
|
||||
|
||||
@@ -346,8 +346,12 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
self.histories.get(history_id).set({'contents' : history_contents});
|
||||
self.modal.$el.find('#selected_history_content').html(history_contents_template({history_contents: history_contents.models.reverse()}));
|
||||
},
|
||||
error: function(){
|
||||
mod_toastr.error('An error ocurred :(');
|
||||
error: function(model, response){
|
||||
if (typeof response.responseJSON !== "undefined"){
|
||||
mod_toastr.error(response.responseJSON.err_msg);
|
||||
} else {
|
||||
mod_toastr.error('An error ocurred :(');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -516,17 +520,36 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
},
|
||||
|
||||
showLibInfo: function(){
|
||||
var self = this;
|
||||
var template = this.templateLibInfoInModal();
|
||||
this.modal = Galaxy.modal;
|
||||
this.modal.show({
|
||||
closing_events : true,
|
||||
title : 'Library Information',
|
||||
body : template({library:library}),
|
||||
buttons : {
|
||||
'Close' : function() {Galaxy.modal.hide();}
|
||||
var library_id = Galaxy.libraries.folderListView.folderContainer.attributes.metadata.parent_library_id;
|
||||
var library = null;
|
||||
var that = this;
|
||||
if (Galaxy.libraries.libraryListView !== null){
|
||||
library = Galaxy.libraries.libraryListView.collection.get(library_id);
|
||||
} else {
|
||||
library = new mod_library_model.Library({id: library_id});
|
||||
library.fetch({
|
||||
success: function(){
|
||||
var template = that.templateLibInfoInModal();
|
||||
that.modal = Galaxy.modal;
|
||||
that.modal.show({
|
||||
closing_events : true,
|
||||
title : 'Library Information',
|
||||
body : template({library:library}),
|
||||
buttons : {
|
||||
'Close' : function() {Galaxy.modal.hide();}
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(model, response){
|
||||
if (typeof response.responseJSON !== "undefined"){
|
||||
mod_toastr.error(response.responseJSON.err_msg);
|
||||
} else {
|
||||
mod_toastr.error('An error ocurred :(');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
templateToolBar: function(){
|
||||
@@ -536,7 +559,8 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
tmpl_array.push('<div class="library_style_container">');
|
||||
// TOOLBAR START
|
||||
tmpl_array.push(' <div id="library_toolbar">');
|
||||
tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" class="logged-dataset-manipulation" title="Include deleted datasets" style="display:none;"><input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"> include deleted</input></span>');
|
||||
tmpl_array.push(' <span><strong>DATA LIBRARIES</strong></span>');
|
||||
tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" class="logged-dataset-manipulation" title="Include deleted datasets" style="display:none;"> | <input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"> include deleted | </input></span>');
|
||||
tmpl_array.push(' <div class="btn-group add-library-items" style="display:none;">');
|
||||
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button" type="button"><span class="fa fa-plus"></span> <span class="fa fa-folder"></span></button>');
|
||||
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button" type="button"><span class="fa fa-plus"></span> <span class="fa fa-file"></span></span></button>');
|
||||
@@ -553,7 +577,9 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
tmpl_array.push(' </ul>');
|
||||
tmpl_array.push(' </div>');
|
||||
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> Delete</button>');
|
||||
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');
|
||||
tmpl_array.push(' <button data-id="<%- id %>" data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');
|
||||
tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
|
||||
|
||||
tmpl_array.push(' </div>');
|
||||
// TOOLBAR END
|
||||
tmpl_array.push(' <div id="folder_items_element">');
|
||||
@@ -568,6 +594,13 @@ var FolderToolbarView = Backbone.View.extend({
|
||||
tmpl_array = [];
|
||||
|
||||
tmpl_array.push('<div id="lif_info_modal">');
|
||||
tmpl_array.push('<h2>Library name:</h2>');
|
||||
tmpl_array.push('<p><%- library.get("name") %></p>');
|
||||
tmpl_array.push('<h3>Library description:</h3>');
|
||||
tmpl_array.push('<p><%- library.get("description") %></p>');
|
||||
tmpl_array.push('<h3>Library synopsis:</h3>');
|
||||
tmpl_array.push('<p><%- library.get("synopsis") %></p>');
|
||||
|
||||
tmpl_array.push('</div>');
|
||||
|
||||
return _.template(tmpl_array.join(''));
|
||||
|
||||
@@ -29,15 +29,12 @@ var LibraryListView = Backbone.View.extend({
|
||||
|
||||
initialize : function(options){
|
||||
this.options = _.defaults(this.options || {}, options);
|
||||
var viewContext = this;
|
||||
|
||||
var that = this;
|
||||
this.rowViews = {};
|
||||
|
||||
this.collection = new mod_library_model.Libraries();
|
||||
|
||||
this.collection.fetch({
|
||||
success: function(){
|
||||
viewContext.render();
|
||||
that.render();
|
||||
},
|
||||
error: function(model, response){
|
||||
if (typeof response.responseJSON !== "undefined"){
|
||||
@@ -53,10 +50,6 @@ var LibraryListView = Backbone.View.extend({
|
||||
* or from a given array of library models,
|
||||
* or renders an empty list in case no data is given. */
|
||||
render: function (options) {
|
||||
/**
|
||||
* need to hide manually because of the element removal
|
||||
* bug in tooltip
|
||||
*/
|
||||
$(".tooltip").hide();
|
||||
var template = this.templateLibraryList();
|
||||
var libraries_to_render = null;
|
||||
|
||||
@@ -116,12 +116,19 @@ var LibraryToolbarView = Backbone.View.extend({
|
||||
tmpl_array.push('<div class="library_style_container">');
|
||||
// TOOLBAR
|
||||
tmpl_array.push(' <div id="toolbar_form">');
|
||||
tmpl_array.push(' <% if(admin_user === true) { %>');
|
||||
tmpl_array.push(' <div id="library_toolbar">');
|
||||
tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"><input id="include_deleted_chk" style="margin: 0;" type="checkbox"> include deleted</input></span>');
|
||||
tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button><span>');
|
||||
tmpl_array.push(' <div id="library_toolbar">');
|
||||
tmpl_array.push(' <span><strong>DATA LIBRARIES</strong></span>');
|
||||
tmpl_array.push(' <% if(admin_user === true) { %>');
|
||||
tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"> | <input id="include_deleted_chk" style="margin: 0;" type="checkbox"> include deleted |</input></span>');
|
||||
tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');
|
||||
tmpl_array.push(' <% } %>');
|
||||
tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
|
||||
tmpl_array.push(' </div>');
|
||||
tmpl_array.push(' <% } %>');
|
||||
|
||||
tmpl_array.push(' <div>');
|
||||
tmpl_array.push(' ');
|
||||
tmpl_array.push(' </div>');
|
||||
|
||||
tmpl_array.push(' </div>');
|
||||
tmpl_array.push(' <div id="libraries_element">');
|
||||
// table with libraries will append here
|
||||
|
||||
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 +1 @@
|
||||
define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view"],function(b,g,d,e,c,a){var f=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(i){this.options=_.defaults(this.options||{},i);var h=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(){h.render()},error:function(k,j){if(typeof j.responseJSON!=="undefined"){e.error(j.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},render:function(i){$(".tooltip").hide();var j=this.templateLibraryList();var k=null;var h=Galaxy.libraries.preferences.get("with_deleted");var l=null;if(typeof i!=="undefined"){h=typeof i.with_deleted!=="undefined"?i.with_deleted:false;l=typeof i.models!=="undefined"?i.models:null}if(this.collection!==null&&l===null){this.sortLibraries();if(h){k=this.collection.models}else{k=this.collection.where({deleted:false})}}else{if(l!==null){k=l}else{k=[]}}this.$el.html(j({length:k.length,order:Galaxy.libraries.preferences.get("sort_order")}));if(k.length>0){this.renderRows(k)}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(l){for(var k=0;k<l.length;k++){var j=l[k];var h=_.findWhere(this.rowViews,{id:j.get("id")});if(h!==undefined&&this instanceof Backbone.View){h.delegateEvents();this.$el.find("#library_list_body").append(h.el)}else{this.renderOne({library:j})}}},renderOne:function(j){var i=j.library;var h=new a.LibraryRowView(i);if(j.prepend){this.$el.find("#library_list_body").prepend(h.el)}else{this.$el.find("#library_list_body").append(h.el)}this.rowViews[i.get("id")]=h},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){Galaxy.libraries.preferences.set({sort_order:"desc"})}else{Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(){if(Galaxy.libraries.preferences.get("sort_by")==="name"){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.collection.sortByNameAsc()}else{if(Galaxy.libraries.preferences.get("sort_order")==="desc"){this.collection.sortByNameDesc()}}}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push('<div>There are no libraries visible to you. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/">Galaxy support site</a>.</div>');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>");return _.template(tmpl_array.join(""))},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},});return{LibraryListView:f}});
|
||||
define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view"],function(b,g,d,e,c,a){var f=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(h){this.options=_.defaults(this.options||{},h);var i=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(){i.render()},error:function(k,j){if(typeof j.responseJSON!=="undefined"){e.error(j.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},render:function(i){$(".tooltip").hide();var j=this.templateLibraryList();var k=null;var h=Galaxy.libraries.preferences.get("with_deleted");var l=null;if(typeof i!=="undefined"){h=typeof i.with_deleted!=="undefined"?i.with_deleted:false;l=typeof i.models!=="undefined"?i.models:null}if(this.collection!==null&&l===null){this.sortLibraries();if(h){k=this.collection.models}else{k=this.collection.where({deleted:false})}}else{if(l!==null){k=l}else{k=[]}}this.$el.html(j({length:k.length,order:Galaxy.libraries.preferences.get("sort_order")}));if(k.length>0){this.renderRows(k)}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(l){for(var k=0;k<l.length;k++){var j=l[k];var h=_.findWhere(this.rowViews,{id:j.get("id")});if(h!==undefined&&this instanceof Backbone.View){h.delegateEvents();this.$el.find("#library_list_body").append(h.el)}else{this.renderOne({library:j})}}},renderOne:function(j){var i=j.library;var h=new a.LibraryRowView(i);if(j.prepend){this.$el.find("#library_list_body").prepend(h.el)}else{this.$el.find("#library_list_body").append(h.el)}this.rowViews[i.get("id")]=h},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){Galaxy.libraries.preferences.set({sort_order:"desc"})}else{Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(){if(Galaxy.libraries.preferences.get("sort_by")==="name"){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.collection.sortByNameAsc()}else{if(Galaxy.libraries.preferences.get("sort_order")==="desc"){this.collection.sortByNameDesc()}}}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push('<div>There are no libraries visible to you. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/">Galaxy support site</a>.</div>');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>");return _.template(tmpl_array.join(""))},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},});return{LibraryListView:f}});
|
||||
@@ -1 +1 @@
|
||||
define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured :(")}}})}else{b.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form">');tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"><input id="include_deleted_chk" style="margin: 0;" type="checkbox"> include deleted</input></span>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button><span>');tmpl_array.push(" </div>");tmpl_array.push(" <% } %>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}});
|
||||
define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured :(")}}})}else{b.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(" <span><strong>DATA LIBRARIES</strong></span>");tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"> | <input id="include_deleted_chk" style="margin: 0;" type="checkbox"> include deleted |</input></span>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');tmpl_array.push(" <% } %>");tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(" </div>");tmpl_array.push(" <div>");tmpl_array.push(" ");tmpl_array.push(" </div>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}});
|
||||
@@ -1329,6 +1329,7 @@ ul{list-style:none}
|
||||
.libraryTitle th{text-align:left}
|
||||
pre.peek{background:white;color:black;overflow:auto}
|
||||
pre.peek th{color:white;background:#ebd9b2}
|
||||
.help-button{float:right}
|
||||
span.expandLink{padding-left:12px;display:inline-block;vertical-align:middle;background:url(../images/silk/resultset_next.png) no-repeat}
|
||||
.folderRow.expanded span.expandLink{background:url(../images/silk/resultset_bottom.png) no-repeat}
|
||||
.folderRow span.rowIcon{float:left;margin-right:5px;width:16px;height:16px;display:inline-block;vertical-align:middle;background:url(../images/silk/folder.png)}
|
||||
|
||||
@@ -32,6 +32,7 @@ ul{list-style:none}
|
||||
.libraryTitle th{text-align:left}
|
||||
pre.peek{background:white;color:black;overflow:auto}
|
||||
pre.peek th{color:white;background:#ebd9b2}
|
||||
.help-button{float:right}
|
||||
span.expandLink{padding-left:12px;display:inline-block;vertical-align:middle;background:url(../images/silk/resultset_next.png) no-repeat}
|
||||
.folderRow.expanded span.expandLink{background:url(../images/silk/resultset_bottom.png) no-repeat}
|
||||
.folderRow span.rowIcon{float:left;margin-right:5px;width:16px;height:16px;display:inline-block;vertical-align:middle;background:url(../images/silk/folder.png)}
|
||||
|
||||
@@ -151,6 +151,10 @@ pre.peek th {
|
||||
background: @table-heading-bg;
|
||||
}
|
||||
|
||||
.help-button {
|
||||
float: right;
|
||||
}
|
||||
|
||||
span.expandLink {
|
||||
padding-left: 12px;
|
||||
display: inline-block;
|
||||
|
||||
Reference in New Issue
Block a user