Class: CamaleonCms::Admin::SettingsController

Inherits:
CamaleonCms::AdminController
  • Object
show all
Defined in:
app/controllers/camaleon_cms/admin/settings_controller.rb

Overview

Camaleon CMS is a content management system

Copyright (C) 2015 by Owen Peredo Diaz
Email: [email protected]
This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the  GNU Affero General Public License (GPLv3) for more details.

Instance Method Summary collapse

Instance Method Details

#indexObject



13
14
15
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 13

def index
  redirect_to cama_admin_dashboard_path
end

#languagesObject

list available languages



39
40
41
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 39

def languages
  add_breadcrumb I18n.t("camaleon_cms.admin.sidebar.languages")
end

#save_languagesObject

save language customizations



49
50
51
52
53
54
55
56
57
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 49

def save_languages
  current_site.set_meta("languages_site", params[:lang])
  current_site.set_admin_language(params[:admin_language])
  I18n.locale = current_site.get_admin_language
  PluginRoutes.reload

  flash[:notice] =  t('camaleon_cms.admin.settings.message.language_updated', locale: current_site.get_admin_language)
  redirect_to action: :languages
end

#shortcodesObject

render the list of shortcodes



44
45
46
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 44

def shortcodes
  add_breadcrumb I18n.t("camaleon_cms.admin.sidebar.shortcodes")
end

#siteObject



17
18
19
20
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 17

def site
  add_breadcrumb I18n.t("camaleon_cms.admin.sidebar.general_site")
  @site = current_site
end

#site_savedObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 22

def site_saved
  @site = current_site
  if @site.update(params[:site])
    @site.set_options_from_form(params[:meta]) if params[:meta].present?
    @site.set_multiple_options(params[:options])
    @site.set_field_values(params[:field_options])
    theme = @site.get_theme.decorate
    theme.set_field_values(params[:theme_fields]) if params[:theme_fields].present?
    flash[:notice] = t('camaleon_cms.admin.settings.message.site_updated')
    hook_run(theme.settings, "on_theme_settings", theme)
    redirect_to action: :site
  else
    render 'site'
  end
end