Sha256: 510d66366d99d248346a374f834cdfe4544c96707184095dd2f6c1747b143aab

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

Refinery::I18n.frontend_locales.each do |lang|
  I18n.locale = lang

  if defined?(Refinery::User)
    Refinery::User.all.each do |user|
      if user.plugins.find_by_name('<%= plural_name %>').nil?
        user.plugins.create(:name => "<%= plural_name %>",
                            :position => (user.plugins.maximum(:position) || -1) +1)
      end
    end
  end

  if defined?(Refinery::Page)
    url = "/<%= [(namespacing.underscore if namespacing.underscore != plural_name), plural_name].compact.join('/') %>"
    page = Refinery::Page.where(:link_url => url).first_or_create!(
      :title => "<%= class_name.pluralize.underscore.titleize %>",
      :deletable => false,
      :menu_match => "^#{url}(\/|\/.+?|)$"
    )
    thank_you_page = Refinery::Page.where(:link_url => "#{url}/thank_you").first_or_create!(
      :title => "Thank You",
      :deletable => false,
      :show_in_menu => false
    )
    thank_you_page.update_attribute(:parent, page)
    Refinery::Pages.default_parts.each do |default_page_part|
      page.parts.where(:title => default_page_part).first_or_create!(:body => nil)
      thank_you_page.parts.where(:title => default_page_part).first_or_create!(:body => nil)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-core-2.1.5 lib/generators/refinery/form/templates/db/seeds.rb.erb
refinerycms-core-2.1.4 lib/generators/refinery/form/templates/db/seeds.rb.erb
refinerycms-core-2.1.3 lib/generators/refinery/form/templates/db/seeds.rb.erb