Class: Spree::Admin::GeneralSettingsController

Inherits:
BaseController show all
Defined in:
app/controllers/spree/admin/general_settings_controller.rb

Instance Method Summary collapse

Methods included from Core::ControllerHelpers::Common

included

Methods included from Core::ControllerHelpers::Auth

#current_ability, included, #redirect_back_or_default, #store_location, #try_spree_current_user, #unauthorized

Instance Method Details

#dismiss_alertObject



24
25
26
27
28
29
30
31
# File 'app/controllers/spree/admin/general_settings_controller.rb', line 24

def dismiss_alert
  if request.xhr? and params[:alert_id]
    dismissed = Spree::Config[:dismissed_spree_alerts] || ''
    Spree::Config.set :dismissed_spree_alerts => dismissed.split(',').push(params[:alert_id]).join(',')
    filter_dismissed_alerts
    render :nothing => true
  end
end

#editObject



5
6
7
8
9
10
11
12
# File 'app/controllers/spree/admin/general_settings_controller.rb', line 5

def edit
  @preferences_general = [:site_name, :default_seo_title, :default_meta_keywords,
                  :default_meta_description, :site_url]
  @preferences_security = [:allow_ssl_in_production,
                  :allow_ssl_in_staging, :allow_ssl_in_development_and_test,
                  :check_for_spree_alerts]
  @preferences_currency = [:display_currency, :hide_cents]
end

#updateObject



14
15
16
17
18
19
20
21
22
# File 'app/controllers/spree/admin/general_settings_controller.rb', line 14

def update
  params.each do |name, value|
    next unless Spree::Config.has_preference? name
    Spree::Config[name] = value
  end
  flash[:success] = t(:successfully_updated, :resource => t(:general_settings))

  redirect_to edit_admin_general_settings_path
end