forked from refinery/refinerycms
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2-0-stable' into canonical
- Loading branch information
Showing
9 changed files
with
91 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 22 additions & 18 deletions
40
core/lib/generators/refinery/engine/templates/db/seeds.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
if defined?(::Refinery::User) | ||
::Refinery::User.all.each do |user| | ||
if user.plugins.where(:name => 'refinerycms-<%= namespacing.underscore %>').blank? | ||
user.plugins.create(:name => 'refinerycms-<%= namespacing.underscore %>', | ||
:position => (user.plugins.maximum(:position) || -1) +1) | ||
(Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).each do |lang| | ||
I18n.locale = lang | ||
|
||
if defined?(Refinery::User) | ||
Refinery::User.all.each do |user| | ||
if user.plugins.where(:name => 'refinerycms-<%= namespacing.underscore %>').blank? | ||
user.plugins.create(:name => 'refinerycms-<%= namespacing.underscore %>', | ||
:position => (user.plugins.maximum(:position) || -1) +1) | ||
end | ||
end | ||
end | ||
end | ||
|
||
<% unless skip_frontend? %> | ||
url = "/<%= [(namespacing.underscore if namespacing.underscore != plural_name), plural_name].compact.join('/') %>" | ||
if defined?(::Refinery::Page) && ::Refinery::Page.where(:link_url => url).empty? | ||
page = ::Refinery::Page.create( | ||
:title => '<%= class_name.pluralize.underscore.titleize %>', | ||
: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) | ||
<% unless skip_frontend? -%> | ||
url = "/<%= [(namespacing.underscore if namespacing.underscore != plural_name), plural_name].compact.join('/') %>" | ||
if defined?(Refinery::Page) && Refinery::Page.where(:link_url => url).empty? | ||
page = Refinery::Page.create( | ||
:title => '<%= class_name.pluralize.underscore.titleize %>', | ||
: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 -%> | ||
end | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
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) | ||
(Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).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 | ||
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) | ||
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 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters