#106: Using Five Views for Navigational Elements/Slots

Contents
  1. Motivation
  2. Proposal
  3. Implementation
by Sidnei da Silva last modified Jan 21, 2010 07:25 AM

This proposal aims to define the interfaces (in the Zope 3 sense) that the navigation-related views should provide.

Proposed by
Sidnei da Silva
Proposal type
Architecture
Assigned to release
State
completed

Motivation

Too much logic can be found on the templates that provide navigational elements in the Plone UI.

Customizing simple stuff like:

  • What objects show/don't on the navigation tree and breadcrumbs
  • Using a different/shorter label (default is Title) for navigation tree and breadcrumbs
  • Deciding if an item is selected or not in the navigation tree/breadcrumb
  • Deciding or not to expand a node in the navigation tree

Proposal

  • Moving all the logic from templates and helper scripts into View classes that can be tested.
  • Moving policy decisions (what attribute to use as title, when to show or not an item in navigation/breadcrumbs) to Adapters.

Alternate/Additional Proposal

Implementation

Slots/Portlets

Left/Right slots (a.k.a. portlets) are looked up by the script prepare_slots. By default it looks for an attribute of the object (including acquisition) and checks if the value is callable.

While the whole thing looks rather reasonable, the use of an extra attribute on the object itself and possible acquisition make it hard to discover, and mix content and presentation.

Here, again, the use of a View, say context/@@slots would help by abstracting the presentation-dependent aspect which is the list of slots to display out of the content object into a presentation-specific component.

Again, a default View could be provided that still looks up the values in attributes/acquisition to keep backwards compatibility, while allowing for greater customization without having to touch content-space for changing the slots to bee displayed.

Comments (1)

Adam Theo Jun 17, 2006 09:16 PM
the link to plip 107 is broken. the URL should be 'http', not 'https'.