Skip to content

Commit

Permalink
Fix rocrate download
Browse files Browse the repository at this point in the history
  • Loading branch information
johnf committed Nov 8, 2024
1 parent 09461b9 commit d707c17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions app/controllers/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,17 @@ def deposit_form

def private_rocrate
@data = @collection
@is_item = false
@admin_rocrate = true

json_data = render_to_string(template: 'api/v1/oni/object_meta', formats: [:json], handlers: [:jb])
json_data = render_to_string(template: 'api/v1/oni/object_meta_collection', formats: [:json], handlers: [:jb])
send_data json_data, filename: "#{@collection.identifier}-ro-crate-metadata.json", type: 'application/json', disposition: 'attachment'
end

def public_rocrate
@data = @collection
@is_item = false
@admin_rocrate = false

json_data = render_to_string(template: 'api/v1/oni/object_meta', formats: [:json], handlers: [:jb])
json_data = render_to_string(template: 'api/v1/oni/object_meta_collection', formats: [:json], handlers: [:jb])
send_data json_data, filename: "#{@collection.identifier}-ro-crate-metadata.json", type: 'application/json', disposition: 'attachment'
end

Expand Down
6 changes: 2 additions & 4 deletions app/controllers/items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,17 @@ def bulk_update

def private_rocrate
@data = @item
@is_item = true
@admin_rocrate = true

json_data = render_to_string(template: 'api/v1/oni/object_meta', formats: [:json], handlers: [:jb])
json_data = render_to_string(template: 'api/v1/oni/object_meta_item', formats: [:json], handlers: [:jb])
send_data json_data, filename: "#{@item.full_identifier}-ro-crate-metadata.json", type: 'application/json', disposition: 'attachment'
end

def public_rocrate
@data = @item
@is_item = true
@admin_rocrate = false

json_data = render_to_string(template: 'api/v1/oni/object_meta', formats: [:json], handlers: [:jb])
json_data = render_to_string(template: 'api/v1/oni/object_meta_item', formats: [:json], handlers: [:jb])
send_data json_data, filename: "#{@item.full_identifier}-ro-crate-metadata.json", type: 'application/json', disposition: 'attachment'
end

Expand Down

0 comments on commit d707c17

Please sign in to comment.