Sha256: 105b145ece051d6e0971be801aaee3317cac0c81a585b3db981a130937730a93

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

=begin
  Camaleon CMS is a content management system
  Copyright (C) 2015 by Owen Peredo Diaz
  Email: owenperedo@gmail.com
  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.
=end
class Plugins::FrontCache::AdminController < CamaleonCms::Apps::PluginsAdminController
  include Plugins::FrontCache::FrontCacheHelper
  def settings
    @caches = current_site.get_meta("front_cache_elements", {paths: []})
    @caches[:paths] << "" unless @caches[:paths].present?
  end

  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

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
camaleon_cms-2.2.1 app/apps/plugins/front_cache/admin_controller.rb