}
});
+ if(jQuery.isEmptyObject(tag_data)){
+ tag_data["empty"]=true
+ } else {
+ tag_data = {tag_data}
+ }
+
$.ajax($(location).attr('pathname')+'/save_tags', {
type: 'POST',
- data: {tag_data}
+ data: tag_data
}).success(function(data, status, jqxhr) {
$('.collection-tags-status').append('<div class="collection-tags-status-label alert alert-success"><p class="contain-align-left">Saved successfully.</p></div>');
}).fail(function(jqxhr, status, error) {
}).
on('click', '.collection-tag-cancel', function(e){
$.ajax($(location).attr('pathname')+'/tags', {
- type: 'POST'
+ type: 'GET'
});
});
end
def save_tags
+ tags = nil
if params['tag_data']
+ tags = params['tag_data']
+ elsif params['empty']
+ tags = {}
+ end
+
+ if tags
props = @object.properties
- props[:tags] = params['tag_data']
+ props[:tags] = tags
if @object.update_attributes properties: props
else
<%= 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 %>
- <%= link_to(tags_collection_path, {class: 'btn btn-sm btn-primary collection-tag-cancel hide', :remote => true, method: 'post', return_to: request.url}) do %>
+ <%= link_to(tags_collection_path, {class: 'btn btn-sm btn-primary collection-tag-cancel hide', :remote => true, method: 'get', return_to: request.url}) do %>
Cancel
<% end %>
</div>
post 'unshare', :on => :member
get 'choose', on: :collection
post 'remove_selected_files', on: :member
- post 'tags', on: :member
+ get 'tags', on: :member
post 'save_tags', on: :member
end
get('/collections/download/:uuid/:reader_token/*file' => 'collections#show_file',