Class: Spotlight::CustomFieldsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/spotlight/custom_fields_controller.rb

Instance Method Summary collapse

Methods included from Controller

#blacklight_config, #current_exhibit, #current_masthead, #current_masthead=, #default_masthead?, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_url, #search_action_url, #search_facet_url

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/spotlight/custom_fields_controller.rb', line 17

def create
  @custom_field.attributes = custom_field_params
  @custom_field.exhibit = current_exhibit

  if @custom_field.save
    redirect_to (@custom_field.exhibit), notice: t(:'helpers.submit.custom_field.created', model: @custom_field.class.model_name.human.downcase)
  else
    render action: 'new'
  end
end

#destroyObject



36
37
38
39
# File 'app/controllers/spotlight/custom_fields_controller.rb', line 36

def destroy
  @custom_field.destroy
  redirect_to (@custom_field.exhibit), notice: t(:'helpers.submit.custom_field.destroyed', model: @custom_field.class.model_name.human.downcase)
end

#editObject



13
14
15
# File 'app/controllers/spotlight/custom_fields_controller.rb', line 13

def edit
  add_breadcrumb @custom_field.label, edit_exhibit_custom_field_path(@custom_field.exhibit, @custom_field)
end

#newObject



8
9
10
11
# File 'app/controllers/spotlight/custom_fields_controller.rb', line 8

def new
  @custom_field.field_type ||= "text"
  add_breadcrumb t(:'helpers.action.spotlight/custom_field.create'), new_exhibit_custom_field_path(@exhibit)
end

#updateObject



28
29
30
31
32
33
34
# File 'app/controllers/spotlight/custom_fields_controller.rb', line 28

def update
  if @custom_field.update custom_field_params
    redirect_to (@custom_field.exhibit), notice: t(:'helpers.submit.custom_field.updated', model: @custom_field.class.model_name.human.downcase)
  else
    render action: 'edit'
  end
end