improve generating localized pages

did committed Jan 15, 2016
commit 511d384d17774c76179e4ffbe0a2336625a0b823
Showing 2 changed files with 8 additions and 3 deletions
generators/page/template.liquid.tt +5 -2
@@ @@ -4,10 +4,12 @@ title: <%= config[:title] -%>
# unique identifier for urls, the same as a permalink
slug: <%= config[:slug] -%>
- <% end %>
+
+ <% else -%>
+
# true if the page is included in the menu
- listed: <% if config[:listed] -%><%= config[:listed] %><% else -%>true<% end -%>
+ listed: <% if config[:listed] -%><%= config[:listed] %><% else -%>true<% end %>
# true if the page is published
published: true
@@ @@ -26,6 +28,7 @@ published: true
content_type: <%= config[:content_type] -%>
<% else -%>
# content_type: "<slug of one of the content types>"
+ <% end %>
<% end -%>
# editable_elements:
locomotive/wagon/generators/page.rb b/lib/locomotive/wagon/generators/page.rb +3 -1
@@ @@ -62,6 +62,8 @@ module Locomotive
end
def other_locales
+ return @other_locales if @other_locales
+
# Rules:
# #1 default: [fr, en, es], asked: [en, de], result => [en]
# #2 default: [fr, en, de], asked: [es], result => []
@@ @@ -74,7 +76,7 @@ module Locomotive
locales = options[:default_locales]
locales.shift
- locales & (_locales || [])
+ @other_locales = locales & (_locales || [])
end
end