Martin Atkins (mart) wrote in lj_dev,
Martin Atkins

S2 Sidebars

There are several layouts which support sidebars. Each has differing levels of support for reordering and customizing the sidebar(s), but one thing that they all have in common is that the UI sucks. The S2 property UI doesn't really work for things like that. I think it's about time that we rationalized it all and made sure that all layouts that have sidebars support the same sidebar items and that the interface to choose what is in your sidebar is not rubbish and is the same for all layouts.

My proposal, which I wrote a little about in comments in a previous discussion, is to make sidebars “special” by providing system support for them. They will be edited from a dedicated editor which is set up a bit like the portal editor, though perhaps featuring some GooglePortal-style drag-n-drop goodness. Just as a user can have multiple theme and user layers, a user would be able to have multiple sidebar configurations, each specific to a particular layout just like a user layer. Layouts would declare (via a property) what sidebars are supported so that the UI can reflect the available slots: A Sturdy Gesture only supports one sidebar, for example, but 3 Column supports two. Some layouts don't have sidebars at all, in which case the sidebar editor would say “No can do!”

At runtime, the S2 layer would call Page::get_sidebar_items(string whichbar) : SideBox[] and get back an array of configured sidebar boxes. There would be a few different subclasses of SideBox, including specific ones for popular or oddball sidebar boxes and more general ones based around simple structures such as lists or just a hunk of opaque HTML which can be used for the more esoteric sidebar boxes as well as for “custom” ones.

The nice thing about this approach is that sidebar boxes can then use data that wouldn't otherwise be available to the layout. For example, a “recent entries” box could contain more entries in summary form than are in the RecentPage.entries array, and boxes could also be provided containing summary entries from other journals such as syndication feeds. It also opens up the possibility of including portal boxes into the sidebar, so it's perhaps good timing in that apparently the portal is about to be reworked anyway. If the new portal boxes are based around similar high-level ideas such as lists rather than just hunks of HTML they will be able to integrate nicely into various layouts by mapping the portal's data structures onto S2 objects. Most importantly, though, all layouts would have the same sidebar functionality, meaning users will no longer have to compromise on choosing a pretty layout just because the one they wanted didn't have a particular sidebar feature that they would have liked.

Other possible benefits include showing certain sidebars only to friends or non-friends, showing certain sidebars only on particular views.


  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded