Documentation Tutorials
General
Content section
Other sections
Extra
Model
Models offer a way to present the content in your 1202 system in a specific manner, for instance on a website. The 'Model' section lets you manage these models.
Overview
Current models are listed in the overview. You can adjust the overview to show only models from a certain group by using the 'Group' select menu (top right).
Hover over or tap on a model and click the 'Edit' button to edit a model, or the 'Delete' button to permanently delete it (models are not moved to trash first).
New/edit model
In the 'New model' section you can create a new model. When editing an existing model, the 'Edit model' section opens next to 'New model'. This allows for simultaneous editing.
Regular attributes
Models have several 'regular' attributes like 'Title', 'Description' and 'Group'. These will show up in the models overview.
With the attribute 'URL' you can relate a model to a website/page. Click the 'arrow' icon next to it to open the URL in a new window.
Blocks
The 'canvas' area below the regular attributes is designated for model 'blocks'. Blocks are 'fed' with content by attaching content filters to them. Within a block, you can manipulate content to match the output you require.
Above this area is a list of all current content filters, split out by containers and views. Click a container or view name to list the content filters for that particular container or view.
Drag content filters out of the content filters list and drop them onto a block to attach them. Click the 'cog' icon of a content filter to edit it, or the 'cross' icon to detach it from the block.
Click the 'cross' icon of a model block (top right) to remove it, or the 'cog' icon to edit the block title and code it contains. This opens up a new pane below the canvas.
You can give a model block a title and specify what the output should look like. There are two output types:
- JSON: outputs the content items as an array of JSON (JavaScript Object Notation) objects. Each object consists of key-value pairs, where the keys are the id's of the fields and the values their respective values. This is the default setting.
- Custom: custom model block code gives you complete control over the output. You can use field names and 1202 script to shape it. 'Shortcuts' for both can be found next to the 'Custom code' text box. Click a shortcut to insert it into the box. While editing, a 'Code example' pane situated below the input box will give you a view of the structure and syntax of your code.
When you're done editing the model block, click the 'check' icon (top right) to apply the changes, or the 'cross' icon to discard the changes. Both will close the model block edit pane.
To create a new model block, click the 'plus' icon (top left corner of the canvas). In the same corner a new block will 'slide out'.
You can move model blocks to any place within the canvas boundaries by clicking and dragging them. Resize a model block by clicking/tapping, holding and then dragging the 'arrow' icon (bottom right corner). Resizing the canvas itself is done in exactly the same way.
Info: the 'canvas' allows you to create a kind of 'wireframe' with blocks. This makes it possible – especially when you use your 1202 system for websites/pages – to relate a model in a visual way to your end product.
Tip: set the model block output to 'JSON' when you intend to delegate structuring of content to a front-end (system). Otherwise, structure the output using the 'Custom' output type. A 'hybrid' solution is also possible, where you create a custom output containing only a few fields of 'raw' output.
Actions
There is one main action when creating a model:
- Add this model: saves the current attributes and blocks as a new model.
When editing a model, there is also one main action:
- Update this model: saves the current attributes and blocks, immediately applying any changes.
There is one action button:
- Reset: reloads the current section. This clears all attributes and blocks when creating a new model, and reloads the currently saved version when editing a model (voiding any unsaved changes).