Class: CamaleonCms::Admin::SettingsController
- Inherits:
-
CamaleonCms::AdminController
- Object
- CamaleonController
- CamaleonCms::AdminController
- CamaleonCms::Admin::SettingsController
- Includes:
- CustomFieldsConcern
- Defined in:
- app/controllers/camaleon_cms/admin/settings_controller.rb
Direct Known Subclasses
CamaleonCms::Admin::Settings::CustomFieldsController, CamaleonCms::Admin::Settings::PostTypesController, CamaleonCms::Admin::Settings::SitesController
Instance Method Summary collapse
- #index ⇒ Object
-
#languages ⇒ Object
list available languages.
-
#save_languages ⇒ Object
save language customizations.
- #save_theme ⇒ Object
-
#shortcodes ⇒ Object
render the list of shortcodes.
- #site ⇒ Object
- #site_saved ⇒ Object
-
#test_email ⇒ Object
send email test.
- #theme ⇒ Object
Methods inherited from CamaleonCms::AdminController
#ajax, #cama_get_i18n_frontend, #dashboard, #search
Instance Method Details
#index ⇒ Object
11 12 13 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 11 def index redirect_to cama_admin_dashboard_path end |
#languages ⇒ Object
list available languages
39 40 41 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 39 def languages I18n.t('camaleon_cms.admin.sidebar.languages') end |
#save_languages ⇒ Object
save language customizations
49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 49 def save_languages current_site.('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 |
#save_theme ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 64 def save_theme current_theme.set_field_values(('Theme', param_key: :theme_fields)) current_theme.(params[:theme_option]) if params[:theme_option].present? current_theme.(params[:theme_meta]) if params[:theme_meta].present? current_theme.set_field_values(('Theme')) # permit saving extra/custom values by this hook hook_run(current_theme.settings, 'on_theme_settings', current_theme) flash[:notice] = t('camaleon_cms.admin.message.updated_success', default: 'Theme updated successfully') redirect_to action: :theme end |
#shortcodes ⇒ Object
render the list of shortcodes
44 45 46 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 44 def shortcodes I18n.t('camaleon_cms.admin.sidebar.shortcodes') end |
#site ⇒ Object
15 16 17 18 19 20 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 15 def site return redirect_to cama_admin_settings_theme_path if params[:tab].present? && params[:tab] == 'theme' I18n.t('camaleon_cms.admin.sidebar.general_site') @site = current_site end |
#site_saved ⇒ Object
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 cache_slug = @site.slug if @site.update(params.require(:site).permit(:name, :slug, :description)) @site.(params[:options]) if params[:options].present? @site.(params[:metas]) if params[:metas].present? @site.set_field_values(('Site')) flash[:notice] = t('camaleon_cms.admin.settings.message.site_updated') args = { action: :site } args[:host], args[:port] = @site.get_domain.to_s.split(':') if cache_slug != @site.slug redirect_to(args, allow_other_host: true) else render 'site' end end |
#test_email ⇒ Object
send email test
77 78 79 80 81 82 83 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 77 def test_email data = { content: 'Test content', current_site: current_site, url_base: cama_root_url } CamaleonCms::HtmlMailer.sender(params[:email], 'Test', data).deliver_now head :ok rescue StandardError => e render plain: e., status: :bad_gateway end |
#theme ⇒ Object
60 61 62 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 60 def theme I18n.t('camaleon_cms.admin.settings.theme_setting', default: 'Theme Settings') end |