alchemy_cms

https://github.com/magiclabs/alchemy_cms

Ruby

AlchemyCMS is a powerful, flexible and user centric Rails 5 CMS. 🧙🏻‍♂️

Alchemy::ElementsBlockHelper#element_view_for

Block-level helper for element views. Constructs a DOM element wrapping
your content element and provides a block helper object you can use for
concise access to Alchemy's various helpers.

=== Example:

  <%= element_view_for(element) do |el| %>
    <%= el.render :title %>
    <%= el.render :body %>
    <%= link_to "Go!", el.ingredient(:target_url) %>
  <% end %>

You can override the tag, ID and class used for the generated DOM
element:

  <%= element_view_for(element, tag: 'span', id: 'my_id', class: 'thing') do |el| %>
     <%- ... %>
  <% end %>

If you don't want your view to be wrapped into an extra element, simply set
`tag` to `false`:

  <%= element_view_for(element, tag: false) do |el| %>
     <%- ... %>
  <% end %>

Source | Google | Stack overflow

Edit

git clone [email protected]:magiclabs/alchemy_cms.git

cd alchemy_cms

open app/helpers/alchemy/elements_block_helper.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Alchemy--ElementsBlockHelper-element_view_for-for-pr


# Commit to git

git add app/helpers/alchemy/elements_block_helper.rbgit commit -m "better docs for Alchemy::ElementsBlockHelper#element_view_for"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Alchemy--ElementsBlockHelper-element_view_for-for-pr

hub pull-request


# Celebrate!