Class: Admin::SettingsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
# File 'app/controllers/admin/settings_controller.rb', line 16

def create
  @setting = Radiant::Config.find_or_create_by_key(params[:setting]['key'])
  @setting.update_attributes(params[:setting])
  flash[:notice] = "The setting \"#{@setting.key}\" was created."
  redirect_to admin_settings_url
end

#destroyObject



32
33
34
35
36
37
38
# File 'app/controllers/admin/settings_controller.rb', line 32

def destroy
  @setting = Radiant::Config.find(params[:id])
  @key = @setting.key
  @setting.destroy
  flash[:notice] = "The setting \"#{@key}\" was deleted."
  redirect_to admin_settings_url
end

#editObject



23
24
25
# File 'app/controllers/admin/settings_controller.rb', line 23

def edit
  @setting = Radiant::Config.find(params[:id])
end

#indexObject



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

def index
  @settings = Radiant::Config.find_all_as_tree
end

#newObject



12
13
14
# File 'app/controllers/admin/settings_controller.rb', line 12

def new
  @setting = Radiant::Config.new
end

#updateObject



27
28
29
30
# File 'app/controllers/admin/settings_controller.rb', line 27

def update
  Radiant::Config.find(params[:id]).update_attribute(:value, params[:setting][:value])
  redirect_to admin_settings_url
end