aboutsummaryrefslogtreecommitdiffstats
path: root/db/seeds/refinerycms_blog.rb
blob: 0be2a0611c944d587c3b2cb58b3963561ac680f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
::User.find(:all).each do |user|
  if user.plugins.where(:name => 'refinerycms_blog').blank?
    user.plugins.create(:name => "refinerycms_blog",
                        :position => (user.plugins.maximum(:position) || -1) +1)
  end
end if defined?(::User)

if defined?(::Page)
  page = ::Page.create(
    :title => "Blog",
    :link_url => "/blog",
    :deletable => false,
    :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
    :menu_match => "^/blogs?(\/|\/.+?|)$"
  )

  ::Page.default_parts.each do |default_page_part|
    page.parts.create(:title => default_page_part, :body => nil)
  end
end