alchemy_cms

https://github.com/magiclabs/alchemy_cms

Ruby

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

Alchemy::ElementsHelper#render_element

This helper renders a {Alchemy::Element} partial.

A element has always two partials:

1. A view partial (This is the view presented to the website visitor)
2. A editor partial (This is the form presented to the website editor while in page edit mode)

The partials are located in <tt>app/views/alchemy/elements</tt>.

== View partial naming

The partials have to be named after the name of the element as defined in the <tt>elements.yml</tt> file and has to be suffixed with the partial part.

=== Example

Given a headline element

  # elements.yml
  - name: headline
    contents:
    - name: text
      type: EssenceText

Then your element view partials has to be named like:

  app/views/alchemy/elements/_headline_editor.html.erb
  app/views/alchemy/elements/_headline_view.html.erb

=== Element partials generator

You can use this handy generator to let Alchemy generate the partials for you:

  $ rails generate alchemy:elements --skip

== Usage

  <%= render_element(Alchemy::Element.published.named(:headline).first) %>

Source | Google | Stack overflow

Edit

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

cd alchemy_cms

open app/helpers/alchemy/elements_helper.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Alchemy--ElementsHelper-render_element-for-pr


# Commit to git

git add app/helpers/alchemy/elements_helper.rbgit commit -m "better docs for Alchemy::ElementsHelper#render_element"


# 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--ElementsHelper-render_element-for-pr

hub pull-request


# Celebrate!