Class: Postnhost::SettingsController

Inherits:
ApplicationController show all
Includes:
Postnhost::Settings::I18nManageable, Postnhost::Settings::NavigationManageable, Postnhost::Settings::SchemaManageable
Defined in:
app/controllers/postnhost/settings_controller.rb

Constant Summary

Constants included from Postnhost::Settings::SchemaManageable

Postnhost::Settings::SchemaManageable::SCHEMA_ARRAY_FIELDS, Postnhost::Settings::SchemaManageable::SCHEMA_SETTING_FIELDS

Constants included from SchemaHelper

Postnhost::SchemaHelper::ARTICLE_TYPES, Postnhost::SchemaHelper::AUTHOR_ALUMNI_TYPES, Postnhost::SchemaHelper::CONTACT_TYPES, Postnhost::SchemaHelper::ORGANIZATION_TYPES, Postnhost::SchemaHelper::POLICY_FIELDS, Postnhost::SchemaHelper::SETTINGS_TEXT_OVERRIDE_FIELDS

Instance Method Summary collapse

Methods included from SchemaHelper

#schema_array_to_multiline, #schema_article_type_options, #schema_author_alumni_type_options, #schema_contact_type_options, #schema_multiline_to_array, #schema_organization_type_options, #schema_policy_fields

Instance Method Details

#editObject



13
14
15
16
17
18
# File 'app/controllers/postnhost/settings_controller.rb', line 13

def edit
  set_i18n_editor_state if @active_section == "i18n"
  set_navigation_editor_state if @active_section == "navigation"
  set_schema_editor_state if @active_section == "schema"
  set_scripts_editor_state if @active_section == "scripts"
end

#updateObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/postnhost/settings_controller.rb', line 20

def update
  if @active_section == "i18n"
    update_i18n
  elsif @active_section == "navigation"
    update_navigation
  elsif @active_section == "schema"
    update_schema
  elsif @setting.update(setting_params)
    redirect_to edit_settings_path(section: @active_section), notice: "Settings were successfully updated."
  else
    render :edit, status: :unprocessable_content
  end
end