the editable_elements of a page are available within a liquid template + disable the deploy.yml settings for the blank site template
did
committed Oct 28, 2014
commit 863b74eb2e508a6d87066c9c2865ad7e8f37dcb7
Showing 2
changed files with
49 additions
and 15 deletions
generators/blank/config/deploy.yml
+15
-15
| @@ | @@ -1,15 +1,15 @@ |
| - | development: |
| - | host: dev.example.com |
| - | email: john@doe.net |
| - | password: apassword |
| - | # api_key: <your api key here> |
| - | staging: |
| - | host: staging.example.com |
| - | email: john@doe.net |
| - | password: apassword |
| - | # api_key: <your api key here> |
| - | production: |
| - | host: www.example.com |
| - | email: john@doe.net |
| - | password: apassword |
| - | # api_key: <your api key here> |
| \ No newline at end of file | |
| + | # development: |
| + | # host: dev.example.com |
| + | # email: john@doe.net |
| + | # password: apassword |
| + | # # api_key: <your api key here> |
| + | # staging: |
| + | # host: staging.example.com |
| + | # email: john@doe.net |
| + | # password: apassword |
| + | # # api_key: <your api key here> |
| + | # production: |
| + | # host: www.example.com |
| + | # email: john@doe.net |
| + | # password: apassword |
| + | # # api_key: <your api key here> |
| \ No newline at end of file | |
locomotive/wagon/liquid/drops/page.rb b/lib/locomotive/wagon/liquid/drops/page.rb
+34
-0
| @@ | @@ -25,10 +25,44 @@ module Locomotive |
| ProxyCollection.new(@_source.content_type) if @_source.content_type | |
| end | |
| + | def editable_elements |
| + | @editable_elements_hash ||= build_editable_elements_hash |
| + | end |
| + | |
| def breadcrumbs | |
| # TODO | |
| '' | |
| end | |
| + | |
| + | private |
| + | |
| + | def build_editable_elements_hash |
| + | {}.tap do |hash| |
| + | @_source.editable_elements.each do |el| |
| + | safe_slug = el.slug.parameterize.underscore |
| + | keys = el.block.try(:split, '/').try(:compact) || [] |
| + | |
| + | _hash = _build_editable_elements_hashes(hash, keys) |
| + | |
| + | _hash[safe_slug] = el.content |
| + | end |
| + | end |
| + | end |
| + | |
| + | def _build_editable_elements_hashes(hash, keys) |
| + | _hash = hash |
| + | |
| + | keys.each do |key| |
| + | safe_key = key.parameterize.underscore |
| + | |
| + | _hash[safe_key] = {} if _hash[safe_key].nil? |
| + | |
| + | _hash = _hash[safe_key] |
| + | end |
| + | |
| + | _hash |
| + | end |
| + | |
| end | |
| end | |
| end | |