Skip to content

Commit

Permalink
Merge branch 'lib-refactor-cleanup' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Mar 30, 2016
2 parents 35767b1 + 971b987 commit 565f11f
Show file tree
Hide file tree
Showing 27 changed files with 449 additions and 333 deletions.
173 changes: 98 additions & 75 deletions client/galaxy/scripts/mvc/library/library-folder-view.js
Expand Up @@ -211,84 +211,107 @@ var FolderView = Backbone.View.extend({
},

templateFolder : function(){
var tmpl_array = [];
// CONTAINER START
tmpl_array.push('<div class="library_style_container">');

tmpl_array.push(' <div id="library_toolbar">');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify library item" class="btn btn-default toolbtn_modify_dataset primary-button" type="button"><span class="fa fa-pencil"></span> Modify</span></button>');
tmpl_array.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>/permissions"><button data-toggle="tooltip" data-placement="top" title="Manage permissions" class="btn btn-default toolbtn_change_permissions primary-button" type="button"><span class="fa fa-group"></span> Permissions</span></button></a>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Share dataset" class="btn btn-default toolbtn-share-dataset primary-button" type="button"><span class="fa fa-share"></span> Share</span></button>');
tmpl_array.push(' </div>');
tmpl_array.push(' <p>');
tmpl_array.push(' This dataset is unrestricted so everybody can access it. Just share the URL of this page. ');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Copy to clipboard" class="btn btn-default btn-copy-link-to-clipboard primary-button" type="button"><span class="fa fa-clipboard"></span> To Clipboard</span></button> ');
tmpl_array.push(' </p>');
tmpl_array.push('<div class="dataset_table">');
tmpl_array.push(' <table class="grid table table-striped table-condensed">');
tmpl_array.push(' <tr>');
tmpl_array.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');
tmpl_array.push(' <td><%= _.escape(item.get("name")) %></td>');
tmpl_array.push(' </tr>');
tmpl_array.push(' <% if (item.get("file_ext")) { %>');
tmpl_array.push(' <tr>');
tmpl_array.push(' <th scope="row">Data type</th>');
tmpl_array.push(' <td><%= _.escape(item.get("file_ext")) %></td>');
tmpl_array.push(' </tr>');
tmpl_array.push(' <% } %>');
tmpl_array.push(' </table>');
tmpl_array.push('</div>');

// CONTAINER END
tmpl_array.push('</div>');

return _.template(tmpl_array.join(''));
return _.template([
'<div class="library_style_container">',
'<div id="library_toolbar">',
'<button data-toggle="tooltip" data-placement="top" title="Modify library item" class="btn btn-default toolbtn_modify_dataset primary-button" type="button">',
'<span class="fa fa-pencil"/>',
'&nbsp;Modify',
'</button>',
'<a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>/permissions">',
'<button data-toggle="tooltip" data-placement="top" title="Manage permissions" class="btn btn-default toolbtn_change_permissions primary-button" type="button">',
'<span class="fa fa-group"/>',
'&nbsp;Permissions',
'</button>',
'</a>',
'<button data-toggle="tooltip" data-placement="top" title="Share dataset" class="btn btn-default toolbtn-share-dataset primary-button" type="button">',
'<span class="fa fa-share"/>',
'&nbsp;Share',
'</span>',
'</button>',
'</div>',
'<p>',
'This dataset is unrestricted so everybody can access it. Just share the URL of this page. ',
'<button data-toggle="tooltip" data-placement="top" title="Copy to clipboard" class="btn btn-default btn-copy-link-to-clipboard primary-button" type="button">',
'<span class="fa fa-clipboard"/>',
'&nbsp;To Clipboard',
'</button> ',
'</p>',
'<div class="dataset_table">',
'<table class="grid table table-striped table-condensed">',
'<tr>',
'<th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">',
'Name',
'</th>',
'<td>',
'<%= _.escape(item.get("name")) %>',
'</td>',
'</tr>',
'<% if (item.get("file_ext")) { %>',
'<tr>',
'<th scope="row">Data type</th>',
'<td>',
'<%= _.escape(item.get("file_ext")) %>',
'</td>',
'</tr>',
'<% } %>',
'</table>',
'</div>',
'</div>'
].join(''));
},

templateFolderPermissions : function(){
var tmpl_array = [];
// CONTAINER START
tmpl_array.push('<div class="library_style_container">');


tmpl_array.push(' <div id="library_toolbar">');
tmpl_array.push(' <a href="#/folders/<%= folder.get("parent_id") %>"><button data-toggle="tooltip" data-placement="top" title="Go back to the parent folder" class="btn btn-default primary-button" type="button"><span class="fa fa-caret-left fa-lg"></span> Parent folder</span></button></a>');
tmpl_array.push(' </div>');

tmpl_array.push('<h1>Folder: <%= _.escape(folder.get("name")) %></h1>');

tmpl_array.push('<div class="alert alert-warning">');
tmpl_array.push('<% if (is_admin) { %>');
tmpl_array.push('You are logged in as an <strong>administrator</strong> therefore you can manage any folder on this Galaxy instance. Please make sure you understand the consequences.');
tmpl_array.push('<% } else { %>');
tmpl_array.push('You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.');
tmpl_array.push('<% }%>');
tmpl_array.push('</div>');

tmpl_array.push('<div class="dataset_table">');

tmpl_array.push('<h2>Folder permissions</h2>');

tmpl_array.push('<h4>Roles that can manage permissions on this folder</h4>');
tmpl_array.push('<div id="manage_perm" class="manage_perm roles-selection"></div>');
tmpl_array.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can manage permissions on this folder.</div>');

tmpl_array.push('<h4>Roles that can add items to this folder</h4>');
tmpl_array.push('<div id="add_perm" class="add_perm roles-selection"></div>');
tmpl_array.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can add items to this folder (folders and datasets).</div>');

tmpl_array.push('<h4>Roles that can modify this folder</h4>');
tmpl_array.push('<div id="modify_perm" class="modify_perm roles-selection"></div>');
tmpl_array.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can modify this folder (name, etc.).</div>');

tmpl_array.push('<button data-toggle="tooltip" data-placement="top" title="Save modifications" class="btn btn-default toolbtn_save_permissions primary-button" type="button"><span class="fa fa-floppy-o"></span> Save</span></button>');

tmpl_array.push('</div>');

// CONTAINER END
tmpl_array.push('</div>');

return _.template(tmpl_array.join(''));
return _.template([
'<div class="library_style_container">',
'<div id="library_toolbar">',
'<a href="#/folders/<%= folder.get("parent_id") %>">',
'<button data-toggle="tooltip" data-placement="top" title="Go back to the parent folder" class="btn btn-default primary-button" type="button">',
'<span class="fa fa-caret-left fa-lg"/>',
'&nbsp;Parent folder',
'</button>',
'</a>',
'</div>',
'<h1>',
'Folder: <%= _.escape(folder.get("name")) %>',
'</h1>',
'<div class="alert alert-warning">',
'<% if (is_admin) { %>',
'You are logged in as an <strong>administrator</strong> therefore you can manage any folder on this Galaxy instance. Please make sure you understand the consequences.',
'<% } else { %>',
'You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.',
'<% }%>',
'</div>',
'<div class="dataset_table">',
'<h2>Folder permissions</h2>',
'<h4>',
'Roles that can manage permissions on this folder',
'</h4>',
'<div id="manage_perm" class="manage_perm roles-selection"/>',
'<div class="alert alert-info roles-selection">',
'User with <strong>any</strong> of these roles can manage permissions on this folder.',
'</div>',
'<h4>',
'Roles that can add items to this folder',
'</h4>',
'<div id="add_perm" class="add_perm roles-selection"/>',
'<div class="alert alert-info roles-selection">',
'User with <strong>any</strong> of these roles can add items to this folder (folders and datasets).',
'</div>',
'<h4>',
'Roles that can modify this folder',
'</h4>',
'<div id="modify_perm" class="modify_perm roles-selection"/>',
'<div class="alert alert-info roles-selection">',
'User with <strong>any</strong> of these roles can modify this folder (name, etc.).',
'</div>',
'<button data-toggle="tooltip" data-placement="top" title="Save modifications" class="btn btn-default toolbtn_save_permissions primary-button" type="button">',
'<span class="fa fa-floppy-o"/>',
'&nbsp;Save',
'</button>',
'</div>',
'</div>'
].join(''));
}

});
Expand Down
90 changes: 46 additions & 44 deletions client/galaxy/scripts/mvc/library/library-folderlist-view.js
Expand Up @@ -254,7 +254,6 @@ var FolderListView = Backbone.View.extend({
* Currently supports only sorting by name.
*/
sortFolder: function(sort_by, order){
console.log('sorting');
// default to asc sort by name
if (sort_by === 'undefined' && order === 'undefined'){
return this.collection.sortByNameAsc();
Expand Down Expand Up @@ -345,49 +344,52 @@ var FolderListView = Backbone.View.extend({
},

templateFolder : function (){
var tmpl_array = [];

// BREADCRUMBS
tmpl_array.push('<ol class="breadcrumb">');
tmpl_array.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');
tmpl_array.push(' <% _.each(path, function(path_item) { %>');
tmpl_array.push(' <% if (path_item[0] != id) { %>');
tmpl_array.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a> </li> ');
tmpl_array.push( '<% } else { %>');
tmpl_array.push(' <li class="active"><span title="You are in this folder"><%- path_item[1] %></span></li>');
tmpl_array.push(' <% } %>');
tmpl_array.push(' <% }); %>');
tmpl_array.push('</ol>');

// FOLDER CONTENT
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>');
tmpl_array.push(' <th><a class="sort-folder-link" title="Click to reverse order" href="#">name</a> <span title="Sorted alphabetically" class="sort-icon fa fa-sort-alpha-<%- order %>"></span></th>');
tmpl_array.push(' <th style="width:25%;">description</th>');
tmpl_array.push(' <th style="width:5%;">data type</th>');
tmpl_array.push(' <th style="width:10%;">size</th>');
tmpl_array.push(' <th style="width:160px;">time updated (UTC)</th>');
tmpl_array.push(' <th style="width:10%;"></th> ');
tmpl_array.push(' </thead>');
tmpl_array.push(' <tbody id="folder_list_body">');
tmpl_array.push(' <tr id="first_folder_item">');
tmpl_array.push(' <td><a href="#<% if (upper_folder_id !== 0){ print("folders/" + upper_folder_id)} %>" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..<a></td>');
tmpl_array.push(' <td></td>');
tmpl_array.push(' <td></td>');
tmpl_array.push(' <td></td>');
tmpl_array.push(' <td></td>');
tmpl_array.push(' <td></td>');
tmpl_array.push(' <td></td>');
tmpl_array.push(' <td></td>');
tmpl_array.push(' </tr>');

tmpl_array.push(' </tbody>');
tmpl_array.push('</table>');
tmpl_array.push('<div class="empty-folder-message" style="display:none;">This folder is either empty or you do not have proper access permissions to see the contents. If you expected something 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>');

return _.template(tmpl_array.join(''));
return _.template([
// BREADCRUMBS
'<ol class="breadcrumb">',
'<li><a title="Return to the list of libraries" href="#">Libraries</a></li>',
'<% _.each(path, function(path_item) { %>',
'<% if (path_item[0] != id) { %>',
'<li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a> </li> ',
'<% } else { %>',
'<li class="active"><span title="You are in this folder"><%- path_item[1] %></span></li>',
'<% } %>',
'<% }); %>',
'</ol>',

// FOLDER CONTENT
'<table data-library-id="<%- parent_library_id %>" id="folder_table" class="grid table table-condensed">',
'<thead>',
'<th class="button_heading"></th>',
'<th style="text-align: center; width: 20px; " title="Check to select all datasets"><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>',
'<th><a class="sort-folder-link" title="Click to reverse order" href="#">name</a> <span title="Sorted alphabetically" class="sort-icon fa fa-sort-alpha-<%- order %>"></span></th>',
'<th style="width:25%;">description</th>',
'<th style="width:5%;">data type</th>',
'<th style="width:10%;">size</th>',
'<th style="width:160px;">time updated (UTC)</th>',
'<th style="width:10%;"></th> ',
'</thead>',
'<tbody id="folder_list_body">',
'<tr id="first_folder_item">',
'<td>',
'<a href="#<% if (upper_folder_id !== 0){ print("folders/" + upper_folder_id)} %>" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..<a>',
'</td>',
'<td></td>',
'<td></td>',
'<td></td>',
'<td></td>',
'<td></td>',
'<td></td>',
'<td></td>',
'</tr>',
'</tbody>',
'</table>',
'<div class="empty-folder-message" style="display:none;">',
'This folder is either empty or you do not have proper access permissions to see the contents. If you expected something 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>'
].join(''));
}

});
Expand Down

0 comments on commit 565f11f

Please sign in to comment.