ruby-on-railsalchemy-cms

Alchemy CMS: Create element that contains list of elements


I'd like to create an element which can contain a list of items, where each item can have more than one essences.

For example: The user should be able to add a "page listing" as content element. For each page item he should be able to upload a small image, a short description and a link. Because the list needs to be wrapped with an UL tag, I can't simply ask him to add a lot of elements.

Other example: The user should be able to add a "team listing" as content element. Each member having a photo, a name, a job description and an email address. Same problem here: I'd like to have the team members wrapped within an DL tag.

Is there some way of releasing elements which can contain elements?

Some kind like: (just an example, might contain bugs)

- name: my_list_element
  contents:
  - name: list_style
    type: EssenceSelect
  - name: items
    type: Element ???
    elements: [my_item_element]
    settings:
      deletable: true
  available_contents:
  - name: items
    type: Element ???
    elements: [my_item_element]
    settings:
      deletable: true

- name: my_item_element
  contents:
  - name: image
    type: EssencePicture
  - name: headline
    type: EssenceText
    ...

The inner item uses the default editor for pictures or text essences.

If someone knows a way how to realize this it would be very great, because it's the last puzzle part which is missing in order to use alchemy CMS :(

Thank you in advance


Solution

  • You want to use the new nestable Elements feature you'll find in the current master and soon to be released 3.3 version. Unfortunately they are not well documented yet. Sorry.

    But it's really simple. Instead of the available_contents (That will be deprecated in favor of nested elements anyway, you list names of nestable_elements).

    A nestable element can be any element you have defined.

    Unless the guides got updated, please read the documentation in the code.