Class: Admin::SettingsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/settings_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



7
8
9
# File 'app/controllers/admin/settings_controller.rb', line 7

def edit
  @setting.build_address unless @setting.address
end

#showObject



3
4
5
# File 'app/controllers/admin/settings_controller.rb', line 3

def show
  redirect_to([forgeos_core, :edit, :admin, :setting])
end

#updateObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/admin/settings_controller.rb', line 11

def update
  settings = params[:setting]
  if settings
    smtp_settings = settings[:smtp_settings]
    if smtp_settings and settings[:smtp_settings][:authentication] == 'none'
      [:authentication, :password, :user_name].each do |key|
        smtp_settings[key] = nil
      end
    end
  end
  if @setting.update_attributes(settings)
    flash[:notice] = t('setting.update.success')
  else
    flash[:error] = t('setting.update.failed')
  end
  redirect_to([forgeos_core, :edit, :admin, :setting])
end