Class: Blogaze::Controllers::Admin::Settings

Inherits:
Controller show all
Defined in:
lib/blogaze/controllers/admin/settings.rb

Instance Method Summary collapse

Methods inherited from Controller

#initialize

Methods inherited from Controller

#get_settings, #initialize, #title, #view_file

Constructor Details

This class inherits a constructor from Blogaze::Controllers::Admin::Controller

Instance Method Details

#indexObject

Settings form



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/blogaze/controllers/admin/settings.rb', line 18

def index
  # Set title
  title "Settings"

  # Get themes
  @themes = []

  ::Blogaze::Theme.registered.each do |theme|
    @themes.push theme[0].to_s
  end

  respond(view_file('admin/settings/index'))
end

#saveObject

Save settings



35
36
37
38
39
40
# File 'lib/blogaze/controllers/admin/settings.rb', line 35

def save
  request[:settings].each do |setting, value|
    ::Blogaze.database[:settings].where(:setting => setting).update(:value => value)
  end
  redirect Settings.r('/')
end