do not generate 2 pages if the slug starts with a slash
did
committed May 07, 2014
commit 62c761e12979328a9cd094697fea22bdaad3ed70
Showing 1
changed file with
1 additions
and 31 deletions
locomotive/wagon/generators/page.rb b/lib/locomotive/wagon/generators/page.rb
+1
-31
| @@ | @@ -11,33 +11,11 @@ module Locomotive |
| argument :slug | |
| argument :target_path # path to the site | |
| - | # argument :locales |
| - | |
| - | # options |
| - | # class_option :title, type: :string, default: nil, required: false, desc: 'Title?' |
| - | # class_option :haml, type: :boolean, default: nil, required: false, desc: 'HAML over HTML?' |
| - | # class_option :listed, type: :boolean, default: nil, required: false, desc: 'Listed in the nav tag?' |
| - | # class_option :content_type, type: :string, default: nil, required: false, desc: 'Tied to a content type?' |
| - | |
| - | # attr_accessor :locales |
| - | |
| - | # def apply_locales? |
| - | # if self.options[:locales].blank? |
| - | # self.locales = |
| - | |
| - | # self.locales.shift # remove the default locale |
| - | |
| - | # unless self.locales.empty? |
| - | # unless yes?('Do you want to generate templates for each locale ?') |
| - | # self.locales = [] |
| - | # end |
| - | # end |
| - | # end |
| def create_page | |
| extension = haml? ? 'liquid.haml' : 'liquid' | |
| - | segments = self.slug.split('/') |
| + | segments = self.slug.split('/').find_all { |segment| segment != '' } |
| while segment = segments.pop do | |
| _options = self.page_options(slug: segment, translated: false) | |
| file_path = File.join(pages_path, segments, segment) | |
| @@ | @@ -88,14 +66,6 @@ module Locomotive |
| locales & (options[:locales] || []) | |
| end | |
| - | # def locales |
| - | # self.options[:locales] |
| - | # end |
| - | |
| - | # def locales=(values) |
| - | # self.options[:locales] = values |
| - | # end |
| - | |
| end | |
| end | |