Module: CurationConcerns::SingleUseLinksControllerBehavior

Extended by:
ActiveSupport::Concern
Included in:
SingleUseLinksController
Defined in:
app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb

Instance Method Summary collapse

Instance Method Details

#create_downloadObject



20
21
22
23
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 20

def create_download
  @su = SingleUseLink.create itemId: params[:id], path: main_app.download_path(id: asset)
  render text: curation_concerns.download_single_use_link_url(@su.downloadKey)
end

#create_showObject



25
26
27
28
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 25

def create_show
  @su = SingleUseLink.create itemId: params[:id], path: polymorphic_path([main_app, asset])
  render text: curation_concerns.show_single_use_link_url(@su.downloadKey)
end

#destroyObject



35
36
37
38
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 35

def destroy
  SingleUseLink.find_by_downloadKey(params[:link_id]).destroy
  head :ok
end

#indexObject



30
31
32
33
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 30

def index
  links = SingleUseLink.where(itemId: params[:id]).map { |link| show_presenter.new(link) }
  render partial: 'curation_concerns/file_sets/single_use_link_rows', locals: { single_use_links: links }
end