Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Alchemy CMS: great for websites integrated with Ruby on Rails http://blog.chrisdpeters.com/alchemy-cms/
<%- cache(element) do -%>
<%= element_view_for(element) do |el| -%>
<div class="cta">
<h3 class="cta-heading">
<%= el.render :headline %>
</h3>
<%= el.render :description %>
<div class="cta-actions">
<div class="cta-primary">
<%= link_to el.ingredient(:button_link), class: 'button cta-button' do %>
<%= fa_icon(el.ingredient(:button_icon)) if el.ingredient(:button_icon).present? %>
<%= el.render :button_text %>
<% end %>
</div>
<div class="cta-secondary">
<%= el.render :secondary %>
</div>
</div>
</div>
<%- end -%>
<%- end -%>
<%- cache(element) do -%>
<%= element_view_for(element, tag: :dl) do |el| -%>
<% element.nested_elements.available.each do |nested_element| %>
<%= render_element(nested_element) %>
<% end %>
<%- end -%>
<%- end ->
<%- cache(element) do -%>
<%= element_view_for(element, tag: :dt) do |el| -%>
<%= el.render :title %>
<%- end -%>
<%- end -%>
<%- cache(element) do -%>
<%= element_view_for(element, tag: :dd) do |el| -%>
<%= el.render :definition %>
<%- end -%>
<%- end -%>
<%- cache(element) do -%>
<%= element_view_for(element, class: 'product-listing') do |el| -%>
<%# Force thumbail to be rendered at 372px height, and HTML tag to force height to 186px
# for higher DPI goodness. %>
<%= image_tag el.ingredient(:thumbnail).url(size: 'x372', format: 'jpg'), height: 186,
style: 'height: 186px;', class: 'product-listing-thumb' %>
<%- end -%>
<%- end -%>
- name: call_to_action
hint: 'Call to action with headline, description, button, and secondary action.'
contents:
- name: headline
type: EssenceText
- name: description
type: EssenceRichtext
- name: button_link
type: EssenceLink
hint: Where to link the button.
- name: button_icon
type: EssenceText
hint: Icon to use within button. See www.fontawesome.io for a list of icons. Refer to the icon name without the "fa-" in front of it.
- name: button_text
type: EssenceText
- name: secondary
type: EssenceRichtext
hint: Secondary call to action. Place phone number in bold formatting.
- name: definition_list
nestable_elements:
- definition_title
- definition
- name: definition_title
contents:
- name: title
type: EssenceText
- name: definition
contents:
- name: definition
type: EssenceText # Or EssenceRichText, depending on what you want to do.
- name: home
unique: true
elements:
- home_hero
- location_search_box
- lead
- rich_text
- image
- definition_list
- cta
cells:
- hero
- main
- sidebar
- name: single_column
elements:
- title
- lead
- rich_text
- image
- video
- button
- definition_list
autogenerate:
- title
- name: two_column
elements:
- title
- lead
- rich_text
- image
- video
- button
- definition_list
- event_sidebar
- contact_form
cells:
- heading
- sidebar
Rails.application.routes.draw do
devise_for :users
# Your own custom logic is listed first.
resources :products
get :events, to: 'events#index'
namespace :system do
resources :products
end
# Alchemy takes it from here for URLs that don't match anything listed above.
# Keep in mind that Alchemy's admin is mounted at the `/admin` folder though.
mount Alchemy::Engine => '/'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment