Re: Breadcrumbs and multiple trackers

"John P. Rouillard" <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hi Tom:

In message <CO3PR08MB79575C212454275D3378C56CCAE79@CO3PR08MB7957.namprd08.prod.
outlook.com>,
Tom Ekberg writes:
>I created a breadcrumb feature
>(https://wiki.roundup-tracker.org/Breadcrumbs) and have added it to
>our IT tracker.  I am looking for an opinion on the tracker
>breadcrumb feature as I add it to other trackers.  The latest change
>is to allow a tracker to show breadcrumbs for multiple
>trackers.
[...]
> I was thinking that it may be less confusing to use another
>approach.  The confusing part might be if one is in the IT tracker,
>jumping to the SYSTEMS tracker.  Another approach is to group the
>breadcrumbs for a tracker together, only showing the breadcrumbs for
>that tracker.  The SYSTEMS tracker would only show breadcrumbs for
>the SYSTEMS tracker, and the IT tracker would only show breadcrumbs
>for the IT tracker.

I can see both use cases (breadcrumbs from multiple trackers or just
from the tracker you are visiting). My guess is most users probably
only have a single tracker, so for most it won't matter.

How about making it user configurable?

My though is to add a BreadcrumbShowsMultipleTrackers Boolean property
to the user object. If false display issues only from the current
tracker. Otherwise show issues from all trackers in breadcrumb.

Breadcrumbs is JavaScript driven. Thus we need to extract the database
setting into JavaScript. This may work in page.html:

    <script tal:condition="python:'BreadcrumbShowsMultipleTrackers' in
               request._client.db.user.properties.keys()"
           tal:attributes="nonce request/client/client_nonce"
           tal:content="python: '''var breadcrumb_multiple_trackers=%s;'''%int(request.user.BreadcrumbShowsMultipleTrackers);" >
    </script>

which should result in:

  <script nonce="xyzzyrqsdfqwerty...">
     var breadcrumb_multiple_trackers=0;
  </script>

if the BreadcrumbShowsMultipleTrackers property exists. No script will
be produces if the property is missing. There should be an easier way
to do the conditional. Using _client.... seems icky but it seems to
work.

The int() turns True/False into 1/0. Without int() you would get:

   breadcrumb_single_tracker=True

which is a JS syntax error (it should be true not True IIRC). You don't
want the string form of True/False since:

   breadcrumb_multiple_trackers="True"
or
   breadcrumb_multiple_trackers="False"

are both Boolean true. Using the integer form allows:

  if (breadcrumb_multiple_trackers) { /* multi tracker case */ }
  else { /* single tracker case */ } 

You will need to handle the case where breadcrumb_multiple_trackers
isn't defined (because it's not in the schema). In this case I
suggest using just a single tracker in the breadcrumb.

This method of reflecting database settings could also be used to
allow a user to change the number of entries in the breadcrumb.  It
does make breadcrumb deployment a little more difficult as a schema
change has to happen.

Have a great rest of your week.

--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.