Module: CurationConcerns::CurationConcernController
- Extended by:
- ActiveSupport::Concern
- Includes:
- Blacklight::AccessControls::Catalog, Blacklight::Base
- Defined in:
- app/controllers/concerns/curation_concerns/curation_concern_controller.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#actor ⇒ Object
writeonly
Sets the attribute actor.
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #file_manager ⇒ Object
- #inspect_work ⇒ Object
- #new ⇒ Object
-
#show ⇒ Object
Finds a solr document matching the id and sets @presenter.
- #update ⇒ Object
Instance Attribute Details
#actor=(value) ⇒ Object
Sets the attribute actor
115 116 117 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 115 def actor=(value) @actor = value end |
Instance Method Details
#create ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 41 def create if actor.create(attributes_for_actor) after_create_response else respond_to do |wants| wants.html do build_form render 'new', status: :unprocessable_entity end wants.json { render_json_response(response_type: :unprocessable_entity, options: { errors: curation_concern.errors }) } end end end |
#destroy ⇒ Object
98 99 100 101 102 103 104 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 98 def destroy title = curation_concern.to_s if actor.destroy CurationConcerns.config.callback.run(:after_destroy, curation_concern.id, current_user) after_destroy_response(title) end end |
#edit ⇒ Object
80 81 82 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 80 def edit build_form end |
#file_manager ⇒ Object
106 107 108 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 106 def file_manager presenter end |
#inspect_work ⇒ Object
110 111 112 113 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 110 def inspect_work raise Hydra::AccessDenied unless current_ability.admin? presenter end |
#new ⇒ Object
37 38 39 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 37 def new build_form end |
#show ⇒ Object
Finds a solr document matching the id and sets @presenter
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 58 def show respond_to do |wants| wants.html { presenter && parent_presenter } wants.json do # load and authorize @curation_concern manually because it's skipped for html @curation_concern = _curation_concern_type.find(params[:id]) unless curation_concern :show, @curation_concern render :show, status: :ok end additional_response_formats(wants) wants.ttl do render body: presenter.export_as_ttl, content_type: 'text/turtle' end wants.jsonld do render body: presenter.export_as_jsonld, content_type: 'application/ld+json' end wants.nt do render body: presenter.export_as_nt, content_type: 'application/n-triples' end end end |
#update ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 84 def update if actor.update(attributes_for_actor) after_update_response else respond_to do |wants| wants.html do build_form render 'edit', status: :unprocessable_entity end wants.json { render_json_response(response_type: :unprocessable_entity, options: { errors: curation_concern.errors }) } end end end |