Skip to content

Commit

Permalink
Fix inserting attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
Bramjetten committed May 26, 2018
1 parent a5975d5 commit e083da1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/spina/admin/attachments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def select

def insert
@attachment = Attachment.find(params[:attachment_id])
Rails.logger.info "HAHA HA HA #{@attachment.id}"
end

def select_collection
Expand Down
2 changes: 1 addition & 1 deletion app/views/spina/admin/attachments/insert.js.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var hidden_input = $("input[name='<%= j params[:page_part_id] %>[page_partable_id]'], input[name='<%= j params[:page_part_id] %>[structure_partable_id]'], input[data-hidden-field-id='<%= j params[:hidden_field_id] %>']");
var hidden_input = $("input[name='<%= j params[:page_part_id] %>[partable_id]'], input[name='<%= j params[:page_part_id] %>[structure_partable_id]'], input[data-hidden-field-id='<%= j params[:hidden_field_id] %>']");
hidden_input.parents('.media_picker').find('.attachment').remove();
hidden_input.parents('.media_picker').append("<div class='attachment'><%= @attachment.name %></div>");
hidden_input.val("<%= @attachment.id %>");
Expand Down

0 comments on commit e083da1

Please sign in to comment.