Module: CurationConcerns::CurationConcernController
- Extended by:
- ActiveSupport::Concern
- Includes:
- Blacklight::AccessControls::Catalog, Blacklight::Base
- Included in:
- PermissionsController
- 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
- #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
108 109 110 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 108 def actor=(value) @actor = value end |
Instance Method Details
#create ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 37 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
96 97 98 99 100 101 102 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 96 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
78 79 80 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 78 def edit build_form end |
#file_manager ⇒ Object
104 105 106 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 104 def file_manager presenter end |
#new ⇒ Object
33 34 35 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 33 def new build_form end |
#show ⇒ Object
Finds a solr document matching the id and sets @presenter
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 54 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 # This has to use #find instead of #load_instance_from_solr because # we want to return values like file_set_ids in the json @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 text: presenter.export_as_ttl end wants.jsonld do render text: presenter.export_as_jsonld end wants.nt do render text: presenter.export_as_nt end end end |
#update ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 82 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 |