Module: CurationConcerns::SingleUseLinksControllerBehavior

Extended by:
ActiveSupport::Concern
Includes:
Blacklight::SearchHelper
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



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

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

#create_showObject



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

def create_show
  @su = SingleUseLink.create(itemId: params[:id], path: asset_show_path)
  render plain: curation_concerns.show_single_use_link_url(@su.downloadKey)
end

#destroyObject



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

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

#indexObject



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

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