public
Fork of trevorturk/el-dorado
Description: Localized version of El Dorado using Gibberish. Dutch language included.
Homepage: http://almosteffortless.com/eldorado/
Clone URL: git://github.com/jxl/el-dorado.git
jxl (author)
Sun May 04 09:54:22 -0700 2008
commit  4a7276f25b4aeee1df497b9c6b397ed86a122e32
tree    429d8e8009aa890f2d06f35d97ccb23ad9556eac
parent  8805875551925b2ddd9eab8fbab041980472a520
el-dorado / app / models / setting.rb
100644 44 lines (35 sloc) 1.366 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# == Schema Information
# Schema version: 76
#
# Table name: settings
#
# id :integer(11) not null, primary key
# title :string(255)
# tagline :string(255)
# announcement :text
# footer :text
# theme :string(255)
# favicon :string(255)
# time_zone :string(255) default("UTC")
# private :boolean(1)
# login_message :string(255) default("You are not logged in")
#
 
class Setting < ActiveRecord::Base
  
  validates_presence_of :time_zone
 
  localized_names 'Settings'[:settings],
    :time_zone => 'Default Timezone'[:default_timezone]
 
  composed_of :tz, :class_name => 'TZInfo::Timezone', :mapping => %w( time_zone time_zone )
  
  TITLE = 'El Dorado'
  TAGLINE = 'A full-stack community web application written in Ruby/Rails'
  FOOTER = '<p style="text-align:right;margin:0;">Powered by <a href="http://almosteffortless.com/eldorado/">El Dorado</a> | <a href="http://almosteffortless.com">&aelig;</a></p>'
  LOGIN_MESSAGE = 'This is a private site.'
  
  def theme
    read_attribute(:theme) # not sure why this is needed, but tests are failing without it
  end
  
  def self.defaults
    Setting.new(:title => TITLE, :tagline => TAGLINE, :footer => FOOTER, :login_message => LOGIN_MESSAGE).save
  end
  
  def to_s
    title
  end
end