Add announcement admin and view template
This commit is contained in:
1 parent
4807066c68
commit
5570a2dfbf
12 files changed
+145
-115
No files matched your search
@@ -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
@@ -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?
|
||||
|
||||
Reference in new issue
Block a user