Sha256: 79e28d11058f4f120bdbaedc8a54490766b867c2399c2315c6ab83b39fbe7eea

Contents?: true

Size: 718 Bytes

Versions: 6

Compression:

Stored size: 718 Bytes

Contents

require_dependency "cardboard/application_controller"

module Cardboard
  class SettingsController < ApplicationController
    before_filter :check_ability

    def index
      @setting = Setting.first
    end

    def update
      @setting = params[:id].present? ? Setting.find(params[:id]) : Setting.first
      if @setting.update_attributes(strong_params[:setting])
        flash[:success] = "Settings updated successfully"
        redirect_to settings_path
      else
        render :index
      end
    end

  private
    def check_ability
      unless cardboard_user_can_manage?(:settings)
        render :text => "You are not authorized to edit settings.", :status => :unauthorized 
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cardboard_cms-0.3.1 app/controllers/cardboard/settings_controller.rb
cardboard_cms-0.2.2 app/controllers/cardboard/settings_controller.rb
cardboard_cms-0.2.1 app/controllers/cardboard/settings_controller.rb
cardboard_cms-0.1.8 app/controllers/cardboard/settings_controller.rb
cardboard_cms-0.1.6 app/controllers/cardboard/settings_controller.rb
cardboard_cms-0.1.4 app/controllers/cardboard/settings_controller.rb