$(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');
}).
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');
}).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($){
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
<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>
+$(".collection-tag-rows").html("<%= escape_javascript(render partial: 'show_tag_rows', locals: {object: @object}) %>");
--- /dev/null
+$(".collection-tag-rows").html("<%= escape_javascript(render partial: 'show_tag_rows', locals: {object: @object}) %>");
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',