Class: Plugins::FrontCache::AdminController

Inherits:
CamaleonCms::Apps::PluginsAdminController
  • Object
show all
Includes:
FrontCacheHelper
Defined in:
app/apps/plugins/front_cache/admin_controller.rb

Instance Method Summary collapse

Instance Method Details

#clean_cacheObject



20
21
22
23
24
# File 'app/apps/plugins/front_cache/admin_controller.rb', line 20

def clean_cache
  flash[:notice] = "#{t('plugin.front_cache.message.cache_destroyed')}"
  front_cache_clean()
  redirect_to :back
end

#save_settingsObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/apps/plugins/front_cache/admin_controller.rb', line 8

def save_settings
  current_site.set_meta("front_cache_elements", {paths: (params[:cache][:paths].delete_if{|a| !a.present?  } ||[]),
                                                 posts: (params[:cache][:posts]||[]),
                                                 post_types: (params[:cache][:post_type]||[]),
                                                 skip_posts: (params[:cache][:skip_posts]||[]),
                                                 cache_login: params[:cache][:cache_login],
                                                 home: params[:cache][:home]
                                                })
  flash[:notice] = "#{t('plugin.front_cache.message.settings_saved')}"
  redirect_to action: :settings
end

#settingsObject



3
4
5
6
# File 'app/apps/plugins/front_cache/admin_controller.rb', line 3

def settings
  @caches = current_site.get_meta("front_cache_elements", {paths: []})
  @caches[:paths] << "" unless @caches[:paths].present?
end