Martin Atkins (mart) wrote in fotobilder,
Martin Atkins
mart
fotobilder

core1.s2 proposals: Breadcrumb and Parent links

Here's another updated proposal paraphrased from an email. It's wide again, I'm afraid. (Am I allowed to put linebreaks inside docstrings? What other docstring syntax rules should I be aware of?)

First, to make the rest of this easy, we can use a Link class. This is a modified version of a similar thing used for links in my LiveJournal core layer.

class Link
"Used to represent links between different pages within a user's site."
{
    var string url "The URL which the link should point to.";
    var string caption "The caption for the link";
    var string dest_view "A string representing the viewtype being linked to (eg 'gallery', 'index', 'picture').";
    var bool current_page "True if the link is linking to the page the viewer is already on.";
    function to_string() : string "Return a link to the destination view.";
}
# default implementation of to_string()
function Link::to_string() : string {
    return linkif($.current_page, $.caption, $.url);
}

With this in place, some interesting new things can be added to the Page class:

   var Link[] breadcrumbs
  "An array of links to everything from the user's front
   page to the currently-viewed page in link descent order";

  var Link parent_page
   "Use this link to create an 'Up' link to the current page's parent page.";

The breadcrumb array looks a bit like GalleryDescent at first glance, but is a lot more flexible as it allows other kinds of pages such as the user's main index page, picture pages and other miscellaneous pages (rendered by MiscPage) to be included in the breadcrumb links. Also, I only just today worked out what GalleryDescent is because the name made me think it was an array of galleries under the current gallery, so maybe a different name for that would be a good idea. (GalleryAscent? It is a bunch of links allowing you to ascend to higher galleries…)

Benefits of the Link class:

  • Keeps it all tidy in one package and simplifies the link output code.
  • The $.dest_view member makes it easy for layouts to add an icon depending on what kind of view is being linked to: in case it wasn't clear, it should be set to whatever $.view will be set to on the target page. If it wasn't clear, I'll have to think of a better docstring.

The LJ Link class has some extra allowances for i18n. However, since everything on FotoBilder has an externally-defined title right now (either a gallery name, an image name, or the global title) I didn't allow for it here. My concern with this is anything which is rendered by MiscPage: they will have static titles, of course, but there's nothing really to stop them pulling those titles from UI-free properties. The way I see it working is that the MiscPage populator would just put that property name in the Link caption as well as the page title, thus negating any i18n issues here.

I have a concern that the fact that users are going to be required to set $*global_title in every single style they make sucks. (Sucks more than the structure of that last sentence, in fact) Unless $*global_title is set identically in all styles, the links will become unintuitive. The only minor benefit to making this a style property is that Brad's German holiday photos could say “Brad's Photos” (an example global title) in German, but even that might be considered harmful. I dunno. It feels like “Global Title” (read: “Name of my photo site”) should be a user account setting rather than a style setting.

Subscribe

  • 302: lj_dev

    In the interests of consolidating all FotoBilder development-related discussion, we're going to be closing down this community. The same…

  • Development stalled?

    Is the development of Fotobilder held? Stalled? I am asking because there is no activity on the community and there is no link to the Fotobilder…

  • (no subject)

    Does FotoBilder works with Apache2? I installed all the required modules on my debian sarge, and when I restart my apache server, it dies horribly…

  • Post a new comment

    Error

    Comments allowed for members only

    Anonymous comments are disabled in this journal

    default userpic
  • 11 comments

  • 302: lj_dev

    In the interests of consolidating all FotoBilder development-related discussion, we're going to be closing down this community. The same…

  • Development stalled?

    Is the development of Fotobilder held? Stalled? I am asking because there is no activity on the community and there is no link to the Fotobilder…

  • (no subject)

    Does FotoBilder works with Apache2? I installed all the required modules on my debian sarge, and when I restart my apache server, it dies horribly…