Class: Spree::Admin::GeneralSettingsController

Inherits:
BaseController
  • Object
show all
Includes:
Backend::Callbacks
Defined in:
app/controllers/spree/admin/general_settings_controller.rb

Instance Method Summary collapse

Instance Method Details

#clear_cacheObject



33
34
35
36
37
# File 'app/controllers/spree/admin/general_settings_controller.rb', line 33

def clear_cache
  Rails.cache.clear
  invoke_callbacks(:clear_cache, :after)
  head :no_content
end

#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



8
9
10
# File 'app/controllers/spree/admin/general_settings_controller.rb', line 8

def edit
  @preferences_security = [:check_for_spree_alerts]
end

#updateObject



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

def update
  params.each do |name, value|
    next unless Spree::Config.has_preference? name
    Spree::Config[name] = value
  end

  current_store.update_attributes store_params

  flash[:success] = Spree.t(:successfully_updated, resource: Spree.t(:general_settings))
  redirect_to edit_admin_general_settings_path
end