Add announcement admin and view template

This commit is contained in:
Wen-Tien Chang committed 2009-06-01 14:20:15 +08:00
1 parent 4807066c68
commit 5570a2dfbf
12 files changed
+145 -115

No files matched your search

+2 -5
View File
@@ -1,16 +1,13 @@
require 'couch_foo'
class Announcement < CouchFoo::Base
property :title, String
property :content, String
validates_presence_of :title
def self.load
# hmm.... but one module will has many pages
end
def to_liquid
{ :title => self.title, :content => self.content }
{ "id" => self.id, "title" => self.title, "content" => self.content }
end
end
+6 -2
View File
@@ -21,6 +21,12 @@ class Page < CouchFoo::Base
default_sort :position
def self.find_by_name(page_name)
Page.find(:first, :conditions => { :name => page_name, :is_published => true })
end
protected
def setup_layout_id
if self.layout_name.blank?
self.layout_id = nil
@@ -28,8 +34,6 @@ class Page < CouchFoo::Base
self.layout_id = Layout.find_by_name( self.layout_name ).id
end
end
protected
def setup_default_value
if self.position.blank?