new version of the mounter: page layout + set the right error if creating a remote site fails

did committed Nov 24, 2014
commit dedcdd4bcdca158b2dd8eb495a0ab6ce16458465
Showing 9 changed files with 35 additions and 10 deletions
Gemfile +1 -1
@@ @@ -14,4 +14,4 @@ gem 'rb-fsevent', '~> 0.9.1'
group :test do
gem 'pry'
gem 'coveralls', require: false
- end
\ No newline at end of file
+ end
generators/page/template.liquid.haml.tt +4 -1
@@ @@ -11,6 +11,9 @@ listed: <% if config[:listed] -%><%= config[:listed] %><% else -%>true<% end %>
# true if the page is published
published: true
+ # true if the page can be used as a layout for new pages created by the editors
+ # is_layout: true
+
# position among sibling pages
# position: 1
@@ @@ -34,4 +37,4 @@ content_type: <%= config[:content_type] -%>
%p Hello world
- {% endblock %}
\ No newline at end of file
+ {% endblock %}
generators/page/template.liquid.tt +3 -0
@@ @@ -12,6 +12,9 @@ listed: <% if config[:listed] -%><%= config[:listed] %><% else -%>true<% end -%>
# true if the page is published
published: true
+ # true if the page can be used as a layout for new pages created by the editors
+ # is_layout: true
+
# position among sibling pages
# position: 1
locomotive/wagon/liquid/drops/page.rb b/lib/locomotive/wagon/liquid/drops/page.rb +5 -1
@@ @@ -17,6 +17,10 @@ module Locomotive
slug || @_source.slug
end
+ def is_layout?
+ @_source.is_layout
+ end
+
def original_title
@_source.title
end
@@ @@ -77,4 +81,4 @@ module Locomotive
end
end
end
- end
\ No newline at end of file
+ end
locomotive/wagon/liquid/drops/site.rb b/lib/locomotive/wagon/liquid/drops/site.rb +1 -1
@@ @@ -23,4 +23,4 @@ module Locomotive
end
end
end
- end
\ No newline at end of file
+ end
locomotive/wagon/misc/hosting_api.rb b/lib/locomotive/wagon/misc/hosting_api.rb +6 -4
@@ @@ -94,13 +94,15 @@ module Locomotive
end
def errors
- return nil if success? || (self['errors'].nil? && self['error'].nil?)
+ return nil if success?
@errors ||= if self['error']
[[nil, [self['error']]]]
+ elsif self['errors']
+ self['errors']
else
- self['errors'].delete_if { |attribute, errors| errors.empty? }
- end
+ self.to_a
+ end.delete_if { |attribute, errors| errors.empty? }
end
def error_messages
@@ @@ -112,4 +114,4 @@ module Locomotive
end
end
- end
\ No newline at end of file
+ end
locomotive/wagon/server/renderer.rb b/lib/locomotive/wagon/server/renderer.rb +1 -1
@@ @@ -115,4 +115,4 @@ module Locomotive::Wagon
end
end
- end
\ No newline at end of file
+ end
locomotivecms_wagon.gemspec +1 -1
@@ @@ -35,7 +35,7 @@ Gem::Specification.new do |gem|
gem.add_dependency 'httmultiparty', '0.3.10'
gem.add_dependency 'will_paginate', '~> 3.0.3'
- gem.add_dependency 'locomotivecms_mounter', '~> 1.4.4'
+ gem.add_dependency 'locomotivecms_mounter', '~> 1.5.0'
gem.add_dependency 'faker', '~> 0.9.5'
spec/fixtures/default/app/views/pages/layouts/simple.liquid.haml +13 -0
@@ @@ -0,0 +1,13 @@
+ ---
+ title: My simple layout
+ is_layout: true
+ ---
+ !!! XML
+ !!!
+ %html{ lang: "en" }
+ %head
+
+ %body
+ %h1 {% editable_short_text title %}[TODO]{% endeditable_short_text %}
+ .text
+ {% editable_text content, format: html, rows: 5 %}[TODO]{% editable_text %}