Class: CamaleonCms::Admin::SettingsController
- Inherits:
-
CamaleonCms::AdminController
- Object
- ApplicationController
- CamaleonController
- CamaleonCms::AdminController
- CamaleonCms::Admin::SettingsController
- 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
Constant Summary
Constants included from UploaderHelper
UploaderHelper::SUSPICIOUS_PATTERNS
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
Methods included from ApplicationHelper
#cama_do_pagination, #cama_get_i18n_frontend, #cama_shortcode_print
Methods included from CustomFieldsHelper
#cama_custom_field_elements, #cf_add_model
Methods included from CategoryHelper
#cama_category_get_options_html
Methods included from PostTypeHelper
#cama_hierarchy_post_list, #post_type_html_inputs, #post_type_list_taxonomy, #post_type_status
Methods included from MenusHelper
#admin_menu_add_menu, #admin_menu_append_menu_item, #admin_menu_draw, #admin_menu_insert_menu_after, #admin_menu_insert_menu_before, #admin_menu_prepend_menu_item, #admin_menus_add_commons
Methods included from BreadcrumbHelper
#admin_breadcrumb_add, #cama_admin_title_draw
Methods inherited from CamaleonController
Methods included from EmailHelper
#cama_send_email, #cama_send_mail_to_admin, #send_email, #send_password_reset_email, #send_user_confirm_email
Methods included from HooksHelper
#hook_run, #hook_skip, #hooks_run
Methods included from PluginsHelper
#current_plugin, #plugin_asset_path, #plugin_asset_url, #plugin_destroy, #plugin_install, #plugin_layout, #plugin_load_helpers, #plugin_uninstall, #plugin_upgrade, #plugin_view, #plugins_initialize, #self_plugin_key
Methods included from SiteHelper
#cama_current_site_host_port, #cama_get_list_layouts_files, #cama_get_list_template_files, #cama_is_test_request?, #current_locale, #current_site, #current_theme, #site_after_install, #site_install_theme, #site_uninstall_theme
Methods included from UploaderHelper
#cama_crop_image, #cama_file_path_to_url, #cama_resize_and_crop, #cama_resize_upload, #cama_tmp_upload, #cama_uploader, #cama_uploader_generate_thumbnail, #cama_url_to_file_path, #slugify, #slugify_folder, #upload_file, #uploader_verify_name
Methods included from CamaleonHelper
#cama_cache_fetch, #cama_draw_timer, #cama_edit_link, #cama_is_admin_request?, #cama_pluralize_text, #cama_requestAction, #cama_sitemap_cats_generator, #cama_t, #ct
Methods included from CaptchaHelper
#cama_captcha_build, #cama_captcha_increment_attack, #cama_captcha_reset_attack, #cama_captcha_tag, #cama_captcha_tags_if_under_attack, #cama_captcha_total_attacks, #cama_captcha_under_attack?, #cama_captcha_verified?, #captcha_verify_if_under_attack
Methods included from ContentHelper
#cama_content_after_draw, #cama_content_append, #cama_content_before_draw, #cama_content_init, #cama_content_prepend
Methods included from ThemeHelper
#self_theme_key, #theme_asset_file_path, #theme_asset_path, #theme_asset_url, #theme_home_page, #theme_init, #theme_layout, #theme_view
Methods included from ShortCodeHelper
#cama_strip_shortcodes, #do_shortcode, #render_shortcode, #shortcode_add, #shortcode_change_template, #shortcode_delete, #shortcodes_init
Methods included from UserRolesHelper
Methods included from HtmlHelper
#append_asset_content, #append_asset_libraries, #append_pre_asset_content, #cama_assets_library_register, #cama_draw_custom_assets, #cama_draw_pre_asset_contents, #cama_get_options_html_from_items, #cama_html_helpers_init, #cama_html_tooltip, #cama_load_libraries
Methods included from SessionHelper
#cama_authenticate, #cama_current_role, #cama_current_user, #cama_get_session_id, #cama_logout_user, #cama_on_heroku?, #cama_register_user, #cama_sign_in?, #cookie_auth_token_complete?, #cookie_split_auth_token, #login_user, #login_user_with_password, #session_back_to_parent, #session_switch_user, #user_auth_token_from_cookie
Instance Method Details
#index ⇒ Object
8 9 10 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 8 def index redirect_to cama_admin_dashboard_path end |
#languages ⇒ Object
list available languages
36 37 38 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 36 def languages I18n.t('camaleon_cms.admin.sidebar.languages') end |
#save_languages ⇒ Object
save language customizations
46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 46 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
61 62 63 64 65 66 67 68 69 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 61 def save_theme current_theme.set_field_values(params[:theme_fields]) if params[:theme_fields].present? 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(params[:field_options]) hook_run(current_theme.settings, 'on_theme_settings', current_theme) # permit to save extra/custom values by this hook 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
41 42 43 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 41 def shortcodes I18n.t('camaleon_cms.admin.sidebar.shortcodes') end |
#site ⇒ Object
12 13 14 15 16 17 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 12 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
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 19 def site_saved @site = current_site cache_slug = @site.slug if @site.update(params.require(:site).permit!) @site.(params[:options]) if params[:options].present? @site.(params[:metas]) if params[:metas].present? @site.set_field_values(params[:field_options]) 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
72 73 74 75 76 77 78 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 72 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 inline: e., status: 502 end |
#theme ⇒ Object
57 58 59 |
# File 'app/controllers/camaleon_cms/admin/settings_controller.rb', line 57 def theme I18n.t('camaleon_cms.admin.settings.theme_setting', default: 'Theme Settings') end |