# == In this configuration you setup Alchemy´s element layouts. # # Use rails generate alchemy:scaffold to generate this file for your app. # # Elements containing all necessary basic tools for displaying and editing content inside Alchemy. # They consists of composed contents (different essence-types) as shown in the illustration of an elements-sheme below. # # == Schema of an element # # ================================= # # Content 1 (EssenceText) # # # # # # Content 2 (EssencePicture) # # # # # # Content 3 (EssenceRichtext) # # ================================= # # == Example of a basic element layout # # - name: a_unique_name (Used for the partial name in +app/views/elements+ and translated as Element.display_name) # unique: Bool //pass true if this element only can be displayed once on page # contents: # - name: head # type: EssenceText # - name: text # type: EssenceRichtext # # As already mentioned above, there are different content-types wich can be defined for each content in an element. # Defining these types is used to render predefined views in the element. # # == Content-Types: # # * EssenceText (Used to store a String (max. 255 Chars.) i.e. a headline, or productname. The editor is renderd as a single-lined input field. The view output will be sanitized and escaped. So it's XSS save.) # * EssenceRichtext (Used to store editable richtext. Editor is rendered as a textarea with TinyMCE Editor.) # * EssencePicture (Used to store picture ids from pictures assigned through the library. The editor is rendered as a picture-editor collection with a lot of options (i.e. image cropper). The view renders the assigned picture, resizes it, crops it and caches the result.) # * EssenceFlash (Used to store attachment ids from attachments assigned through the library. The view renders an embeded object.) # * EssenceDate (Used to store a DateTime object. The view output is passed through Rails I18n Library, so it will be fully localized.) # * EssenceHtml (Used to store a String (max. 255 Chars.). The view output renders the raw, not sanitized or unescaped String. So be carefull!) # # After finishing the setup of your element layouts, you need to generate the files for the elements before using them in Alchemy. # For creating these files, use the following command in your terminal: # # rails generate elements # # All new elements will be created as two different partials in Rails.root/app/views/elements. # For each element there is an editor-view wich will be rendered when editing them in Alchemy and another view for the website´s frontend. # # app/views/elements/_elements_name_editor.html.erb # app/views/elements/_elements_name_view.html.erb # # For most contents in an element you can specify additional options, so they get rendered in a specific way. # These options can be defined as symbols, but its too much to list them up here. # You can find these options described in the application_helper.rb, most of them at the render_essence method. # # == Setting a content as preview-text for the element # # You can set a content-essence as preview-text for its element like this # take_me_for_preview: true # # # == Adding contents dynamically in the frontend # # You are able to add content-essences dynamically to the element from the Alchemy frontend. # You just have to make contents available for adding them. # This example enables this feature # # - name: headline # unique: false # contents: # - name: headline # type: EssenceText # - name: big_text # type: EssenceRichtext # available_contents: # - name: big_text # type: EssenceRichtext # # Now an Alchemy user can add the content 'big_text' from the element as much as desired. # # === Translate element names # # Element names are passed through the I18n library. So you can translate them in your config/locales language yml file. # # Example: # # de: # alchemy: # element_names: # contact: Kontakt # search: Suche # # == Validations: # # You can validate the presence of a content. Just pass validate and one of the supported vaidatiosn methods to your content definition: # # - name: article # display_name: Standard-Artikel # contents: # - name: intro # type: EssenceText # validate: [presence] # # Now the user has to enter a value inside of the intro EssenceText textfield to save the element. # Currently supported validations are: # # * presence # * uniqueness # - name: article contents: - name: intro type: EssenceText - name: headline type: EssenceText - name: image type: EssencePicture - name: text type: EssenceRichtext - name: intro_image_text unique: true contents: - name: headline type: EssenceText - name: image type: EssencePicture - name: text type: EssenceRichtext - name: text contents: - name: text type: EssenceRichtext - name: bild contents: - name: image type: EssencePicture - name: bild_text contents: - name: image type: EssencePicture - name: text type: EssenceRichtext - name: headline contents: - name: headline type: EssenceText - name: image_mosaic contents: - name: image type: EssencePicture - name: caption type: EssenceText - name: footnote unique: true contents: - name: note type: EssenceRichtext - name: sitename unique: true contents: - name: name type: EssenceText - name: claim unique: true contents: - name: claim type: EssenceText - name: header unique: true contents: - name: image type: EssencePicture - name: intro contents: - name: intro type: EssenceRichtext - name: subheadline contents: - name: subheadline type: EssenceText - name: news contents: - name: date type: EssenceDate - name: news_headline type: EssenceText rss_title: true - name: body type: EssenceRichtext rss_description: true - name: searchresult unique: true - name: contactform unique: true contents: - name: mail_from type: EssenceText validate: [presence] - name: mail_to type: EssenceText validate: [presence] - name: subject type: EssenceText validate: [presence] - name: success_page type: EssenceText validate: [presence]