Essences store the actual content of your site.

Alchemy comes with a lot of predefined essences for the regular needs of a website project. Combine them like a chemestry kit into elements.

Essences are normal Rails models, so it is pretty easy to add your own.

1 EssenceText

Stores a String (max. 255 Chars.).

Use this for a headline, or a product name. The editor is renderd as a single lined input field. The view output will be sanitized and HTML escaped. So it’s XSS save.

1.1 Settings

  • linkable Boolean
    If set to true, the user can link that essence.

1.2 Example

- name: button
  type: EssenceText
    linkable: true

2 EssenceRichtext

Used to store long text.

The editor is rendered as a textarea with embedded TinyMCE Editor.

2.1 Settings

You can customize the TinyMCE editor of a single element instance.

  • tinymce

2.2 Example

- name: text
  type: EssenceRichtext
      - title: 'Subheadline'
        block: 'h3'

See the TinyMCE customization guide for all available options

3 EssencePicture

Used to store references to pictures the user assigned through the library.

The editor is rendered as a picture editor with a lot of options (i.e. image cropper).

The view renders the assigned picture, resizes it, crops it and caches the result.

See the rendering images guide for further information on the powerful image rendering engine of Alchemy.

4 EssenceDate

Use this to store a DateTime value. Renders a datepicker in the editor partial.

The view output is passed through Rails’ I18n Library, so it is fully localizable.

5 EssenceHtml

Useful to store HTML code (i.e. a embed, or tracking code).

The view renders the raw, not sanitized or escaped output.

So be careful!

6 EssenceBoolean

Stores a Boolean value in the database. Renders a checkbox in the editor partial.

7 EssenceSelect

Renders a select box in the editor partial and stores the value as String.

Useful for letting your user select from a limited set of choices.

Pretty handy together with the page_selector helper.

7.1 Example

# app/views/alchemy/elements/_my_element_editor.html.erb
  el.render :width, :select_values => ["200", "300", "400"]

Stores a url in the database. Useful for linking things, where the user should not set the linked value itself. (Like in the EssenceText with linkable: true option)

It is easy to add your own essence types to Alchemy. Read more about it in this guide

9 Configure essences

To configure the settings of an essence you have to pass it into its settings in the elements.yml

9.1 Example

- name: my_element
  - name: headline
    type: EssenceText
    - linkable: true