Scrivito 1.6.0 Release Notes

Scrivito 1.6.0 Release Notes

posted by Andreas

Improvements

Introducing the sidebar

Over the past months, as we added notification icons and the display size switch to the Scrivito panel, we realized that the panel has become too small to nicely accommodate any further controls. So we complemented it with a sidebar for better accessibility and unique presentation of the available functions and pieces of information.

The working copy menu as well as all the buttons and notification icons in the top right corner of the Scrivito panel, except the page menu, have moved to the sidebar. (The page menu icon has been redesigned, too, by the way.)

To give you full control over the amount of space available for editing content, the sidebar can be minimized, left open, or hidden together with the Scrivito top panel. In the minimized state, there are four main buttons each of which represents a distinct set of functions: the Content Browser, working copies, notifications, and display sizes. The Content Browser is opened directly, but clicking one of the other buttons opens the sidebar, revealing the functions included in the corresponding set. Clicking the button once more minimizes the sidebar again.

The sidebar is automatically opened and closed as the mouse pointer enters or, respectively, leaves it unless the button of the currently open section is clicked to close it. In this case, hovering temporarily has no effect.

At the bottom right, there is a button for hiding the sidebar as well as the top panel. In this state, the only visible element is this button which, however, looks slightly different. Click it to have the panel and the sidebar displayed again.

We also redesigned the mode switch to make the selected mode better distinguishable from the other ones.

In the “Changes” position, the switch now has a meaningful background color reflecting the selected “Changes” mode: green for “Additions”, red for “Deletions”, and blue for “All changes”.

We hope you like the new sidebar as much as we do!

Better confirmation prompt on deletion

When deleting a CMS object, and this object is referenced by other objects via a link, linklist, reference, or referencelist attribute, or via an <a href> or an <img src> tag inside an html attribute, Scrivito now lets you know this, and also which objects contain these links.

If you're unsure about a CMS object referencing the one to delete, just click the given description to open this referencing object in the Content Browser.

The dialog uses the description_for_editor callback of the model classes of the referencing objects, making it possible to have the page titles displayed, for example.

Improved reference attribute editor

Users can now clear single references using a delete button.

To make this button appear in a reference editor, specify the data-scrivito-editors-allow-delete=true option in the call to scrivito_tag:

<%= scrivito_tag(:div, widget, :my_reference, data: { scrivito_editors_allow_delete: true }) %>

Introducing numeric attribute types

Scrivito has two new attribute types, integer and float, that make it easier to handle values of these types. You no longer need to use strings to represent them, validate these strings and convert them to a numeric type. Also, sorting objects by true numbers yields properly sorted lists as opposed to sorting them by numbers represented as strings.

Usage

First, add the desired attributes to the model class concerned:

class SomePage < Obj attribute :float_attribute, :float attribute :integer_attribute, :integer end

To have the attribute values displayed and make them editable in a details view, render them as shown below.

<%= scrivito_details_for("Float attribute") do %> <%= scrivito_tag(:div, obj, :float_attribute) %> <% end %> <%= scrivito_details_for("Integer attribute") do %> <%= scrivito_tag(:div, obj, :integer_attribute) %> <% end %>

For both types, the provided number editor supports a range and a step size you can specify using the min, max, and step options:

<%= scrivito_details_for("Float attribute") do %> <%= scrivito_tag(:div, obj, :float_attribute, {data: { scrivito_editors_min: 0, scrivito_editors_max: 10, scrivito_editors_step: 0.1 } }) %> <% end %>

Syntactically invalid values (e.g. “2oo”) and values not in the given range are not stored and marked as an error.

Updated slider editor

The slider editor now supports these new attribute types. Here is an example of a slider for durations ranging from 1 to 10 seconds, in steps of 0.5 seconds:

scrivito_tag(@obj, :float_duration_seconds, { data_scrivito_editors_min: 1, data_scrivito_editors_max: 10, data_scrivito_editors_step: 0.5, }, editor: :slider)

Semi-automatic conversion of numbers stored as strings

If you have been using string attributes for representing numbers, you can simply change the type of these attributes to integer or float in the model classes without having to migrate the attribute values, i.e. change their format. When retrieving strings as values of integer or float attributes, Scrivito automatically converts them to the corresponding type.

However, converted integer and float attribute values are not automatically written back to the attributes, causing them not to be considered in searches.

CMS objects now have a backlinks method (via their base class, BasicObj). backlinks searches for CMS objects containing one or more attributes linking to a given CMS object. So the search returns the CMS objects in which at least one html, link, linklist, reference or referencelist attribute links to the CMS object.

For rendering such backlinks on details views, Scrivito includes a new helper, scrivito_backlinks:

<%= scrivito_details_for "What links here?" do %> <%= scrivito_backlinks @obj %> <% end %>

The helper generates HTML markup that fits in with the general look and feel of Scrivito's user interface.

Establishing CMS object associations

The Scrivito SDK now includes helpers for establishing CMS object associations in the style of Active Record Associations. Three new methods, belongs_to, belongs_to_many and has_many, allow you to define one-to-one and one-to-many associations between CMS objects. See Modeling Object Associations for examples and further details.

Changelog

The changelog reflects minor improvements and bugfixes that were made in addition to the changes listed above.

Latest Blog Posts


Headless CMS is a term that has been on everybody’s lips recently, along with Content as a Service and Decoupled CMS. Actually, these three concept...
Suppose that you want to buy a grill to have a small party with a couple of friends, and then you realize that you’ve placed the wrong order since ...
There are good CMS's out there, and many are fine tools to make blogs, websites for small business and even for a medium-sized one; but can they ha...