alchemy_cms
https://github.com/magiclabs/alchemy_cms
Ruby
AlchemyCMS is a powerful, flexible and user centric Rails 5 CMS. 🧙🏻♂️
Alchemy::ElementsHelper#render_elements
Renders all elements from current page
== Examples:
=== Render only certain elements:
<header>
<%= render_elements only: ['header', 'claim'] %>
</header>
<section id="content">
<%= render_elements except: ['header', 'claim'] %>
</section>
=== Render elements from global page:
<footer>
<%= render_elements from_page: 'footer' %>
</footer>
=== Render elements from cell:
<aside>
<%= render_elements from_cell: 'sidebar' %>
</aside>
=== Fallback to elements from global page:
You can use the fallback option as an override for elements that are stored on another page.
So you can take elements from a global page and only if the user adds an element on current page the
local one gets rendered.
1. You have to pass the the name of the element the fallback is for as <tt>for</tt> key.
2. You have to pass a <tt>page_layout</tt> name or {Alchemy::Page} from where the fallback elements is taken from as <tt>from</tt> key.
3. You can pass the name of element to fallback with as <tt>with</tt> key. This is optional (the element name from the <tt>for</tt> key is taken as default).
<%= render_elements(fallback: {
for: 'contact_teaser',
from: 'sidebar',
with: 'contact_teaser'
}) %>Edit
git clone [email protected]:magiclabs/alchemy_cms.git
cd alchemy_cms
open app/helpers/alchemy/elements_helper.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Alchemy--ElementsHelper-render_elements-for-pr
# Commit to gitgit add app/helpers/alchemy/elements_helper.rbgit commit -m "better docs for Alchemy::ElementsHelper#render_elements"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Alchemy--ElementsHelper-render_elements-for-pr
hub pull-request
# Celebrate!