Sha256: 09b2940d03b8ae1232d9dcab4a34f8983d04a49fe68b026fd6767a066994631f

Contents?: true

Size: 832 Bytes

Versions: 21

Compression:

Stored size: 832 Bytes

Contents

class Admin::PreferencesController < ApplicationController
  before_filter :load_user

  def initialize
    @controller_name = 'user'
    @template_name = 'preferences'
  end

  def show
    set_standard_body_style
    render :edit
  end

  def edit
    render
  end

  def update
    if valid_params?
      if @user.update_attributes(params[:user])
        redirect_to admin_configuration_path
      else
        flash[:error] = t('preferences_controller.error_updating')
        render :edit
      end
    else
      announce_bad_data
      render :edit
    end
  end

  private

  def load_user
    @user = current_user
  end

  def valid_params?
    hash = (params[:user] || {}).symbolize_keys
    (hash.keys - User.unprotected_attributes).size == 0
  end

  def announce_bad_data
    flash[:error] = 'Bad form data.'
  end
end

Version data entries

21 entries across 21 versions & 4 rubygems

Version Path
trusty-cms-1.0.0 app/controllers/admin/preferences_controller.rb
radiant-1.1.4 app/controllers/admin/preferences_controller.rb
radiant-1.1.3 app/controllers/admin/preferences_controller.rb
radiant-1.1.2 app/controllers/admin/preferences_controller.rb
radiant-1.1.1 app/controllers/admin/preferences_controller.rb
radiant-1.1.0 app/controllers/admin/preferences_controller.rb
radiant-1.1.0.rc1 app/controllers/admin/preferences_controller.rb
radiant-1.1.0.beta app/controllers/admin/preferences_controller.rb
radiant-1.0.1 app/controllers/admin/preferences_controller.rb
radiant-1.1.0.alpha app/controllers/admin/preferences_controller.rb
radiant-1.0.0 app/controllers/admin/preferences_controller.rb
radiant-1.0.0.rc5 app/controllers/admin/preferences_controller.rb
radiant-1.0.0.rc4 app/controllers/admin/preferences_controller.rb
radiant-1.0.0.rc3 app/controllers/admin/preferences_controller.rb
kajam-1.0.3.rc2 app/controllers/admin/preferences_controller.rb
radiant-1.0.0.rc2 app/controllers/admin/preferences_controller.rb
radiant-1.0.0.rc1 app/controllers/admin/preferences_controller.rb
radiantcms-couchrest_model-0.1.3 app/controllers/admin/preferences_controller.rb
radiantcms-couchrest_model-0.1.2 app/controllers/admin/preferences_controller.rb
radiantcms-couchrest_model-0.1.1 app/controllers/admin/preferences_controller.rb