Scrivito 1.5.0 Release Notes

Improvements

Specifying link targets

Editors now have access to the target property of link and linklist fields, making it possible to specify whether a link should be opened in a new window. Note that your app needs to render this property for it to have an effect:

Copy
link_to(link.display_title, scrivito_path(link), target: link.target)

Finding associated content

There are two new search operators, links_to and refers_to that let you find CMS objects linking to or referencing specific CMS objects.

links_to

links_to is a workhorse that searches all attributes able to handle links or references, including those contained in widgets. You can use it, for example, to determine whether an image that has been uploaded is included anywhere in your content, or in pages of a specific type:

Copy
# Find CMS objects pointing to 'my_image' through any link or reference

Obj.where("*", :links_to, my_image)
BlogPostPage.where("*", :links_to, [my_img1, my_img2])

Of course, links_to can be used for more than just that. You can also, for example, determine the pages that are or aren't linked by other pages, etc.

refers_to

The refers_to operator, on the other hand, is specialized in finding the CMS objects referencing specific objects via a specific reference or referencelist attribute. So object associations established using attributes of these types are no longer unidirectional but bidirectional, making it possible to implement all those use cases in which reverse lookups are required. For example, in a setting in which blogposts are equipped with a referencelist attribute for associating them with one or more authors represented as individual CMS objects, you can now look up the blogposts that were (co)produced by a specific author:

Copy
# Find all objects of the 'BlogPost' class that reference 
# 'author_obj' via the 'authors' referencelist attribute.

BlogPost.where("authors", :refers_to, author_obj)

This principle can be transferred to all cases in which one-to-many or many-to-many associations need to be modelled, e.g. products and the parts they consist of, employees and the departments they work for, etc. 

Changelog

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

Details

Minor improvements

  • There is a new template helper, scrivito_widget_tag, that can be used in the “show.html.*” template of widgets to specify additional attributes (including CSS classes) for the widget tag.
  • The Content Browser now lets you upload files to the “Last added” section.
  • We updated MediumEditor to version 5.21.0.
  • We reimplemented how values are stored during in-place editing. The values are now sent directly to the Scrivito SDK and no longer via a proxy controller. This makes Scrivito even faster and lays the foundation for new features.

    Bugfixes

      • It is now possible to use a falsy value option in the filter configuration of the Content Browser. You can, for example, set a filter value for an attribute to null to find only CMS objects where this attribute is empty.
      • The search cache now distinguishes between value types. Previously, searching for the value 23 (Integer) and the value “23” (String) yielded the same result from the cache.
      • We fixed a bug that sometimes caused duplicated widgets to have outdated content.

        More great blog posts from Andreas Viebke