aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/extensions/gallery_links/db/seeds.rb
blob: 65e3615a1408997fa03ef06774c5c9db120c2020 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Refinery::I18n.frontend_locales.each do |lang|
  I18n.locale = lang

  if defined?(Refinery::User)
    Refinery::User.all.each do |user|
      if user.plugins.where(:name => 'refinerycms-gallery_links').blank?
        user.plugins.create(:name => 'refinerycms-gallery_links',
                            :position => (user.plugins.maximum(:position) || -1) +1)
      end
    end
  end

  url = "/gallery_links"
  if defined?(Refinery::Page) && Refinery::Page.where(:link_url => url).empty?
    page = Refinery::Page.create(
      :title => 'Gallery Links',
      :link_url => url,
      :deletable => false,
      :menu_match => "^#{url}(\/|\/.+?|)$"
    )
    Refinery::Pages.default_parts.each_with_index do |default_page_part, index|
      page.parts.create(:title => default_page_part, :body => nil, :position => index)
    end
  end
end