Sha256: a1f48e94ba4d2e7d1b62fd8abe310d7fd0ad9321f9088386decaa57790ba1e61

Contents?: true

Size: 861 Bytes

Versions: 6

Compression:

Stored size: 861 Bytes

Contents

class Admin::SettingsController < Admin::BaseController
  before_filter :get_setting, :only => [:edit, :update]
  def show
    redirect_to([forgeos_core, :edit, :admin, :setting])
  end

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

  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
private

  def get_setting
    @setting = Setting.first
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
forgeos_core-1.9.5.rc2 app/controllers/admin/settings_controller.rb
forgeos_core-1.9.5.rc1 app/controllers/admin/settings_controller.rb
forgeos_core-1.9.4 app/controllers/admin/settings_controller.rb
forgeos_core-1.9.3 app/controllers/admin/settings_controller.rb
forgeos_core-1.9.2 app/controllers/admin/settings_controller.rb
forgeos_core-1.9.1 app/controllers/admin/settings_controller.rb