Mercurial > hg > soundsoftware-site
comparison app/models/.svn/text-base/wiki_page.rb.svn-base @ 37:94944d00e43c
* Update to SVN trunk rev 4411
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 19 Nov 2010 13:24:41 +0000 |
parents | 513646585e45 |
children | 051f544170fe |
comparison
equal
deleted
inserted
replaced
22:40f7cfd4df19 | 37:94944d00e43c |
---|---|
26 | 26 |
27 acts_as_watchable | 27 acts_as_watchable |
28 acts_as_event :title => Proc.new {|o| "#{l(:label_wiki)}: #{o.title}"}, | 28 acts_as_event :title => Proc.new {|o| "#{l(:label_wiki)}: #{o.title}"}, |
29 :description => :text, | 29 :description => :text, |
30 :datetime => :created_on, | 30 :datetime => :created_on, |
31 :url => Proc.new {|o| {:controller => 'wiki', :id => o.wiki.project, :page => o.title}} | 31 :url => Proc.new {|o| {:controller => 'wiki', :action => 'show', :project_id => o.wiki.project, :id => o.title}} |
32 | 32 |
33 acts_as_searchable :columns => ['title', 'text'], | 33 acts_as_searchable :columns => ['title', 'text'], |
34 :include => [{:wiki => :project}, :content], | 34 :include => [{:wiki => :project}, :content], |
35 :project_key => "#{Wiki.table_name}.project_id" | 35 :project_key => "#{Wiki.table_name}.project_id" |
36 | 36 |
137 def parent_title=(t) | 137 def parent_title=(t) |
138 @parent_title = t | 138 @parent_title = t |
139 parent_page = t.blank? ? nil : self.wiki.find_page(t) | 139 parent_page = t.blank? ? nil : self.wiki.find_page(t) |
140 self.parent = parent_page | 140 self.parent = parent_page |
141 end | 141 end |
142 | 142 |
143 protected | 143 protected |
144 | 144 |
145 def validate | 145 def validate |
146 errors.add(:parent_title, :invalid) if !@parent_title.blank? && parent.nil? | 146 errors.add(:parent_title, :invalid) if !@parent_title.blank? && parent.nil? |
147 errors.add(:parent_title, :circular_dependency) if parent && (parent == self || parent.ancestors.include?(self)) | 147 errors.add(:parent_title, :circular_dependency) if parent && (parent == self || parent.ancestors.include?(self)) |