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
- #create_download ⇒ Object
- #create_show ⇒ Object
- #deny_link_access(exception) ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
Instance Method Details
#create_download ⇒ Object
23 24 25 26 |
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 23 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_show ⇒ Object
28 29 30 31 |
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 28 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 |
#deny_link_access(exception) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 14 def deny_link_access(exception) if current_user && current_user.persisted? redirect_to main_app.root_url, alert: "You do not have sufficient privileges to create links to this document" else session["user_return_to"] = request.url redirect_to new_user_session_url, alert: exception. end end |
#destroy ⇒ Object
38 39 40 41 |
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 38 def destroy SingleUseLink.find_by_downloadKey(params[:link_id]).destroy head :ok end |
#index ⇒ Object
33 34 35 36 |
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 33 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 |