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
120 121 122 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 120 def actor=(value) @actor = value end |
Instance Method Details
#create ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 46 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
103 104 105 106 107 108 109 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 103 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
85 86 87 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 85 def edit build_form end |
#file_manager ⇒ Object
111 112 113 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 111 def file_manager @form = Forms::FileManagerForm.new(curation_concern, current_ability) end |
#inspect_work ⇒ Object
115 116 117 118 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 115 def inspect_work raise Hydra::AccessDenied unless current_ability.admin? presenter end |
#new ⇒ Object
42 43 44 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 42 def new build_form end |
#show ⇒ Object
Finds a solr document matching the id and sets @presenter
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 63 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
89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 89 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 |