Class: Plugins::CamaleonSitemapCustomizer::AdminController

Inherits:
CamaleonCms::Apps::PluginsAdminController
  • Object
show all
Includes:
MainHelper
Defined in:
app/controllers/plugins/camaleon_sitemap_customizer/admin_controller.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  "skip_post_types" => [],
  "skip_post_list_types" => [],
  "skip_category_list_types" => [],
  "skip_all_categories" => false,
  "skip_tags" => false,
  "skip_home" => false,
  "cache" => Rails.env.test?,
  "submit_changes_to_google" => false
}.freeze

Instance Method Summary collapse

Instance Method Details

#indexObject



16
17
# File 'app/controllers/plugins/camaleon_sitemap_customizer/admin_controller.rb', line 16

def index
end

#save_settingsObject

save values from settings form



24
25
26
27
28
29
30
# File 'app/controllers/plugins/camaleon_sitemap_customizer/admin_controller.rb', line 24

def save_settings
  options = DEFAULT_OPTIONS.merge(params[:options]&.to_unsafe_h.presence || {})
  @plugin.set_options(options) # save option values
  @plugin.set_metas(params[:metas]) if params[:metas].present? # save meta values
  @plugin.set_field_values(params[:field_options]) if params[:field_options].present? # save custom field values
  redirect_to url_for(action: :settings), notice: "Settings Saved Successfully"
end

#settingsObject

show settings form



20
21
# File 'app/controllers/plugins/camaleon_sitemap_customizer/admin_controller.rb', line 20

def settings
end