Sha256: 9276ccdcb0eed87d22107c9e09dbd281b5ce093f775d19d15d88cc642bfaef44

Contents?: true

Size: 927 Bytes

Versions: 5

Compression:

Stored size: 927 Bytes

Contents

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)
  page = ::Refinery::Page.create(
    :title => "<%= class_name.pluralize.underscore.titleize %>",
    :link_url => "/<%= plural_name %>/new",
    :deletable => false,
    :menu_match => "^/<%= plural_name %>(\/|\/.+?|)$"
  )
  thank_you_page = page.children.create(
    :title => "Thank You",
    :link_url => "/<%= plural_name %>/thank_you",
    :deletable => false,
    :show_in_menu => false
  )
  Refinery::Pages.default_parts.each do |default_page_part|
    page.parts.create(:title => default_page_part, :body => nil)
    thank_you_page.parts.create(:title => default_page_part, :body => nil)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
refinerycms-core-2.0.4 lib/generators/refinery/form/templates/db/seeds.rb
refinerycms-core-2.0.3 lib/generators/refinery/form/templates/db/seeds.rb
refinerycms-core-2.0.2 lib/generators/refinery/form/templates/db/seeds.rb
refinerycms-core-2.0.1 lib/generators/refinery/form/templates/db/seeds.rb
refinerycms-core-2.0.0 lib/generators/refinery/form/templates/db/seeds.rb