Module: CurationConcerns::CurationConcernController

Extended by:
ActiveSupport::Concern
Includes:
Blacklight::Base, Hydra::Controller::SearchBuilder
Included in:
PermissionsController
Defined in:
app/controllers/concerns/curation_concerns/curation_concern_controller.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actor=(value) ⇒ Object

Sets the attribute actor

Parameters:

  • value

    the value to set the attribute actor to.



88
89
90
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 88

def actor=(value)
  @actor = value
end

Instance Method Details

#createObject



32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 32

def create
  # return unless verify_acceptance_of_user_agreement!
  if actor.create
    after_create_response
  else
    setup_form
    respond_to do |wants|
      wants.html { render 'new', status: :unprocessable_entity }
      wants.json { render_json_response(response_type: :unprocessable_entity, options: { errors: curation_concern.errors }) }
    end
  end
end

#destroyObject



82
83
84
85
86
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 82

def destroy
  title = curation_concern.to_s
  curation_concern.destroy
  after_destroy_response(title)
end

#editObject



63
64
65
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 63

def edit
  build_form
end

#newObject



28
29
30
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 28

def new
  build_form
end

#showObject

Finds a solr document matching the id and sets @presenter



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 48

def show
  respond_to do |wants|
    wants.html { 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
      authorize! :show, @curation_concern
      render :show, status: :ok
    end
    additional_response_formats(wants)
  end
end

#updateObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb', line 67

def update
  if actor.update
    after_update_response
  else
    setup_form
    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