[ARVADOS] updated: 8b65f2e07df818663ec328fab7a77f6e759a3ba4
Git user
git at public.curoverse.com
Mon Jun 19 14:19:46 EDT 2017
Summary of changes:
.../app/assets/javascripts/edit_collection_tags.js | 7 +++++++
.../workbench/app/controllers/collections_controller.rb | 17 ++++++++++++-----
.../workbench/app/views/collections/_show_tags.html.erb | 6 ++++--
apps/workbench/app/views/collections/save_tags.js.erb | 1 +
apps/workbench/app/views/collections/tags.js.erb | 1 +
apps/workbench/config/routes.rb | 1 +
6 files changed, 26 insertions(+), 7 deletions(-)
create mode 100644 apps/workbench/app/views/collections/tags.js.erb
via 8b65f2e07df818663ec328fab7a77f6e759a3ba4 (commit)
from 0454d8c5f091e598e705ed8ddd7f658b4eff7989 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 8b65f2e07df818663ec328fab7a77f6e759a3ba4
Author: radhika <radhika at curoverse.com>
Date: Mon Jun 19 14:11:48 2017 -0400
9426: tags display
Arvados-DCO-1.1-Signed-off-by: Radhika Chippada <radhika at curoverse.com>
diff --git a/apps/workbench/app/assets/javascripts/edit_collection_tags.js b/apps/workbench/app/assets/javascripts/edit_collection_tags.js
index 26b0ba7..8dc9d61 100644
--- a/apps/workbench/app/assets/javascripts/edit_collection_tags.js
+++ b/apps/workbench/app/assets/javascripts/edit_collection_tags.js
@@ -3,6 +3,7 @@
$(document).
on('click', '.collection-tag-save, .collection-tag-cancel', function(event) {
$('.edit-collection-tags').removeClass('disabled');
+ $('#edit-collection-tags').attr("title", "Edit tags");
$('.collection-tag-add').addClass('hide');
$('.collection-tag-remove').addClass('hide');
$('.collection-tag-save').addClass('hide');
@@ -11,6 +12,7 @@ $(document).
}).
on('click', '.edit-collection-tags', function(event) {
$('.edit-collection-tags').addClass('disabled');
+ $('#edit-collection-tags').attr("title", "");
$('.collection-tag-add').removeClass('hide');
$('.collection-tag-remove').removeClass('hide');
$('.collection-tag-save').removeClass('hide');
@@ -37,6 +39,11 @@ $(document).
}).fail(function(jqxhr, status, error) {
$('.collection-tags-status').append('<div class="collection-tags-status-label alert alert-danger"><p class="contain-align-left">We are sorry. There was an error saving tags. Please try again.</p></div>');
});
+ }).
+ on('click', '.collection-tag-cancel', function(e){
+ $.ajax($(location).attr('pathname')+'/tags', {
+ type: 'POST'
+ });
});
jQuery(function($){
diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 8b3cc2f..8e1e8a5 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -345,12 +345,19 @@ class CollectionsController < ApplicationController
end
end
+ def tags
+ render
+ end
+
def save_tags
- props = @object.properties
- props[:tags] = params['tag_data']
- if @object.update_attributes properties: props
- else
- self.render_error status: 422
+ if params['tag_data']
+ props = @object.properties
+ props[:tags] = params['tag_data']
+
+ if @object.update_attributes properties: props
+ else
+ self.render_error status: 422
+ end
end
end
diff --git a/apps/workbench/app/views/collections/_show_tags.html.erb b/apps/workbench/app/views/collections/_show_tags.html.erb
index e1b0de7..54c9c5c 100644
--- a/apps/workbench/app/views/collections/_show_tags.html.erb
+++ b/apps/workbench/app/views/collections/_show_tags.html.erb
@@ -34,10 +34,12 @@
<button class="btn btn-primary btn-sm collection-tag-add hide"><i class="glyphicon glyphicon-plus"></i> Add new tag </button>
</div>
<div class="pull-right">
- <%= link_to(save_tags_collection_path, {class: 'btn btn-primary collection-tag-save hide', :remote => true, method: 'post', return_to: request.url}) do %>
+ <%= link_to(save_tags_collection_path, {class: 'btn btn-sm btn-primary collection-tag-save hide', :remote => true, method: 'post', return_to: request.url}) do %>
Save
<% end %>
- <button type="button" class="btn btn-sm btn-primary collection-tag-cancel hide">Cancel</button>
+ <%= link_to(tags_collection_path, {class: 'btn btn-sm btn-primary collection-tag-cancel hide', :remote => true, method: 'post', return_to: request.url}) do %>
+ Cancel
+ <% end %>
</div>
<div><div class="collection-tags-status"/></div></div>
diff --git a/apps/workbench/app/views/collections/save_tags.js.erb b/apps/workbench/app/views/collections/save_tags.js.erb
index e69de29..e2faff1 100644
--- a/apps/workbench/app/views/collections/save_tags.js.erb
+++ b/apps/workbench/app/views/collections/save_tags.js.erb
@@ -0,0 +1 @@
+$(".collection-tag-rows").html("<%= escape_javascript(render partial: 'show_tag_rows', locals: {object: @object}) %>");
diff --git a/apps/workbench/app/views/collections/tags.js.erb b/apps/workbench/app/views/collections/tags.js.erb
new file mode 100644
index 0000000..e2faff1
--- /dev/null
+++ b/apps/workbench/app/views/collections/tags.js.erb
@@ -0,0 +1 @@
+$(".collection-tag-rows").html("<%= escape_javascript(render partial: 'show_tag_rows', locals: {object: @object}) %>");
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 880cc15..5bd4849 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -88,6 +88,7 @@ ArvadosWorkbench::Application.routes.draw do
post 'unshare', :on => :member
get 'choose', on: :collection
post 'remove_selected_files', on: :member
+ post 'tags', on: :member
post 'save_tags', on: :member
end
get('/collections/download/:uuid/:reader_token/*file' => 'collections#show_file',
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list