Native CUE Stories
In native CUE stories, the rich text field is replaced by a
storyline editor, which is defined like this in
the content-type
resource:
<field name="storyline" type="link"> <relation>com.escenic.storyline</relation> <constraints> <mime-type>application/vnd.escenic.storyline+json</mime-type> </constraints> </field>
The storyline field must be a link field
(type=link
) and must have:
-
A child
relation
element with the contentcom.escenic.storyline
-
A child
constraints
element that limits the content of the relation to the MIME typeapplication/vnd.escenic.storyline+json
A storyline editor differs from the legacy rich text editor in the following ways:
-
It does not conform to a generic predefined document format such as XHMTL. Instead, it offers a customizable set of styles defined in resource files called story element types and storyline templates.
-
Because the document structure is extensible, it can include story elements for holding headlines, lead texts, bylines, images, videos, related stories. In other words, many things which have to be stored in separate fields in Escenic legacy stories can be included in the main flow of native CUE stories. It is still possible to make use of separate fields and relations where appropriate, but much more can now easily be included in the main flow of a story.
Here is a content type definition for a native CUE story:
<content-type name="story"> <ui:icon>news</ui:icon> <ui:label>Story</ui:label> <ui:title-field>slug</ui:title-field> <panel name="main"> <ui:label>Main</ui:label> <field name="storyline" type="link"> <relation>com.escenic.storyline</relation> <ui:label>Storyline</ui:label> <constraints> <mime-type>application/vnd.escenic.storyline+json</mime-type> </constraints> </field> </panel> <panel name="metadata"> <ui:label>Metadata</ui:label> <field mime-type="text/plain" type="basic" name="slug"> <ui:label>Slug</ui:label> <ui:description>The working title of the story</ui:description> <constraints> <required>true</required> </constraints> </field> </panel> </content-type>
The storyline field appears in the content type's first panel, and it is the only field in the panel. This ensures that the storyline editor is displayed by default when a content item is opened, and that it has the maximum amount of screen space available, since the tab it is displayed on contains no other fields.
This content type has fewer field definitions than the legacy story
definition shown in Legacy Stories. The
leadtext
and dateline
fields are
no longer required because they can be defined as story elements
inside the storyline field. The slug
field,
however, is retained as a separate field because it is used by CUE as
a "working title" for the story. As in any other content type, The
slug
field must be a plain text field, and must be
referenced by a ui:title-field
element. It must
also be defined as a required field.
Even though the slug
field is required, the CUE
user will rarely need to edit it in a native CUE story: when the story
is saved for the first time, the content of one of the elements in the
storyline
field is copied into the
slug
field, which then becomes the story's working
title. The story element used to fill the slug
field is selected as follows:
-
If available, the first non-empty element in the storyline that has a
ui:title-field
element in its story element type (see Story Element Types) -
Otherwise, the first non-empty element in the storyline.
The typical case is that there is a headline
story
element type that has a ui:title-field
, and that
this is a required element in the storyline, with the result that the
slug
field gets its content from the
headline
.
If the source story element is subsequently changed, the change is not
copied over to the slug
field, so the slug remains
the same throughout the life of the story. A newly-created story
cannot be saved until either the first element in the
storyline
field or the slug
field itself has some content.
When a story content item is created in CUE, the user is immediately prompted to select a storyline template:
The content item is then created and the storyline field is populated with all the required and default element types specified in the selected template, ready for editing.