Saltcorn has a small number of view patterns built in, and more can be enabled through plug-ins.
Show: show one row in the database to the user. The layout of the display of the row is configured with the drag-and-drop builder.
Edit: a form for creating a new or editing an existing row in the database. The form layout is configured with the drag-and-drop builder, and there is additional configuration of the values to be used for filling in the fields that have been left out of the form, and where to navigate when the form has been successfully filled out.
List: show multiple rows from the database to the user in a table. Configured by choosing the columns in the table, which can include table fields, join fields (fields and related tables), aggregations, actions on the current row (for instance, Delete row), links to other views of that row. Also displays the current state form as a drop-down menu button and optionally, a link or embed a form to create a new row.
Feed: display multiple rows from the database by displaying each row using the underlying view (the "Item view") chosen in the configuration, in a feed, possibly with multiple columns. The Item view will typically be an instance of the show view pattern.
- ListShowList: a composite view that ties together a list view, where each row can be chosen by clicking on it, with a view of selected row, and below that, multiple views in tabs of other views of that row or views of related rows from different tables. The list view will occupy the left half of the screen, and the right half will be split chosen view at the top and the tabs below. The list view may be omitted in which case we merely display a row and the related views below it. If there is only one related view, no tabs will be shown.
Additional view patterns can be installed with plug-ins, for instance kanban boards (where each card in the board is shown as an underlying view) and maps (pop-ups can be configured as underlying views)
A view pattern is a template for creating a new view by applying it to a table. The view pattern will also define what further information is needed in order to create the full view.
View = View pattern applied to table with specified options
View patterns are defined in plug-ins. Some basic view patterns are defined in the base module, and more view patterns can be added by activating new plug-ins.
There are two different kinds of view patterns, basic and composed.
- Basic view patterns do not rely on other other views. They are specified in their own right by applying a view pattern to a table and choosing the options.
- Composed views need other views to be created first, and then are specified in terms of other views. Composed views are still a patterns applied to a table with specified options, but the options to be specified include selecting other views.
Modules may provide both composed and basic view patterns.
Basic view patterns
The base plug-in provides three different basic view patterns: list, edit, and show.
List view: Display multiple rows from a table in a grid with columns you specify. For example, a view with a list of authors.
You can also add fields to a list view from related tables, links to other views or aggregations (calculations from related tables). For example, the number of posts written is calculated from the Blog table, and displayed in the list view.
Edit: Form for creating a new row or editing existing rows. With the right permissions, you can set a view to show the list, and allow an admin or other user to edit right on the page. For example, Joshua Bell can be given rights to add another blog post.
DO WE NEED THIS HERE? The edit view pattern creates forms for creating new or editing existing rows in a table. It has somewhat limited customisability consisting only of choosing the fields in the form, and if fields have been left out of the form, a default value may be specified.
Show: Show a single row, with flexible layout. So rather than just a row, you could design an author bio view with a big photo, a list of credentials, a biography, and contact details.
You can also add fields to a show view from related tables, links to other views or aggregations (calculations over related tables). For example, you could add cards showing all the posts an author has written to the author bio view.
Composed view patterns
ListShowList: Combine an optional list view on the left with displays on the right of a single selected row, with views of related rows from different tables underneath. You could make an author bio view with a big photo, a list of credentials, a biography, contact details from one table. Then add a list of their blog posts and statistics.
Feed: Show multiple rows by displaying a chosen view for each row, stacked or in columns.
Filter: Elements that limit the rows shown in other views on the same page. Filter views do not show any rows on their own.
- feed: a feed view is a view of multiple rows shown one after another. The display of each row in the feed is determined by the chosen underlying view.
- list-show-list: the list-show-list view is composed of multiple related views. In the full version, on the left hand side of the screen is shown a list from which a single row can be chosen. On the right hand side of the screen is shown at the top a view of that row and below that views of rows that are related to the chosen row, of the same or of different tables. However the list on the left hand side is optional in which case only the view of the primary row and the related tables below are shown.
- kanban board: a kanban board is provided by the kanban plug-in. What is shown in each card is determined by selecting an underlying view.