Skip to content

Commit

Permalink
Added additional check to prevent trying to add a blog to the site root
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Jun 16, 2010
1 parent 83ec544 commit 00bcf3a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions vendor/modules/blog/app/models/blog/add_blog_wizard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ class Blog::AddBlogWizard < HashModel
validates_presence_of :detail_page_url

def validate
if self.add_to_existing.blank? && self.add_to_subpage.blank?
self.errors.add(:add_to," must have a subpage selected or add\n to existing must be checked")
nd = SiteNode.find_by_id(self.add_to_id)
if (self.add_to_existing.blank? && self.add_to_subpage.blank?)
self.errors.add(:add_to," must have a subpage selected\nand add to existing must be checked")
end
if ( !self.add_to_existing.blank? && ( !nd || nd.node_type == 'R'))
self.errors.add(:add_to,"you cannot add the blog to the site root, please pick a page\nor uncheck 'Add to existing page'")
end
end

Expand Down

0 comments on commit 00bcf3a

Please sign in to comment.