Class: Plugins::FrontCache::AdminController

Inherits:
CamaleonCms::Apps::PluginsAdminController
  • Object
show all
Includes:
FrontCacheHelper
Defined in:
app/apps/plugins/front_cache/admin_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

#clean_cacheObject



29
30
31
32
33
# File 'app/apps/plugins/front_cache/admin_controller.rb', line 29

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

#save_settingsObject



17
18
19
20
21
22
23
24
25
26
27
# File 'app/apps/plugins/front_cache/admin_controller.rb', line 17

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



11
12
13
14
15
# File 'app/apps/plugins/front_cache/admin_controller.rb', line 11

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