Sha256: d27aebeaccd8d5c554c6c2f81770ba3a6f1a1e44de796e09b7a45423ef2610de
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
class Admin::SettingsController < Admin::BaseController def index this_blog.base_url = blog_base_url if this_blog.base_url.blank? load_settings end def write load_settings end def feedback load_settings end def display load_settings end def update load_settings if @setting.update_attributes(settings_params) load_lang flash[:success] = I18n.t('admin.settings.update.success') redirect_to action: action_param else flash[:error] = I18n.t('admin.settings.update.error', messages: this_blog.errors.full_messages.join(', ')) render action_param end end private VALID_ACTIONS = %w(index write feedback display).freeze def settings_params @settings_params ||= params.require(:setting).permit! end def action_param @action_param ||= begin value = params[:from] VALID_ACTIONS.include?(value) ? value : 'index' end end def load_settings @setting = this_blog end end
Version data entries
7 entries across 7 versions & 1 rubygems