0

Dear Fogbugz team,

it would be great if there was an easy/-ier way to link to bug events. For example, every event could have its ID (or a shorter number) displayed in its header.

That way, you could simply link in longer discussions/cases to "see #42" above and that would be a link that jumps up. This is possible copying the URL from the timestamp above the event, but is not as easy as seeing and typing a number diplayed with every event.

When following a link to a bug event it would also be nice if the relevant event would be highlighted somehow; sometimes it is not so easy to recognize which event was linked to if you have several of them on your (large) screen.

flag
Just learned that fogbugz.stackexchange.com/questions/9605/… provides a Customization for the highlighting part - so it boils down to having a simpler way of referencing the event than copy+pasting the link from the event's date+time info. – Matthias Pigulla Jun 18 at 10:38
Sorry, I completely misunderstood your question. I'm about to delete my answer, but does this question address the same requirement? fogbugz.stackexchange.com/questions/9020/… – James McLeod Jun 18 at 17:11
Yes and no - that basically answers that there are direct links for bug events. What I am looking for is a shorter way to reference them - not going up, copy + paste the link, but just write "that's (comment|event) 42" which will automatically be turned into a link. And ideally, the "42" would be clearly visible in each event's header and not be hidden in the anchor link. – Matthias Pigulla Jun 19 at 14:37

4 Answers

1

You can do this by typing

Case ####

e.g. "This was caused by the resolution of Case 12356"

When you do this, details of the case are displayed when you hover the mouse over the hyperlink.

Note that, to the best of my knowledge, FogBugz does not provide an easy way to remove this cross-referencing, but it's been a while since I was an administrator.

link|flag
They still can't be removed AFAIK. – Michel de Ruiter Jun 16 at 20:28
1

Ok, figured that out myself :). Here's a BugMonkey customization that does the trick.

It will display every event id as "#42" on the right hand side of the event header. If you write "#42" in a comment, that will be turned into a link to that event.

Especially useful with the event highlighting customization.

name:          EasyEvents
description:   Makes linking to bug events easier
author:        Matthias Pigulla
version:       1.0

js:

$(".bugevent .summary").each(function() {
  var content = $(this);
  content.append('<span class="eventid">' + content.find('.date    a').attr('name').replace("BugEvent.", "#") + "</span>"); 
});
var ref = RegExp(/#(\d+)/g);
$(".bugevent.detailed .body").each(function() {
  var content = $(this).html();
  if (ref.test(content) && $('#bugevent_' + RegExp.$1).length > 0)
    $(this).html(content.replace(ref, '<a href="#BugEvent.$1">#$1</a>'));
});


css:

.bugevent .eventid { 
  float: right;
  font-weight: bold;
}
link|flag
0

Great, thanks!

At a first glance, it seems there might be a little glitch if you just write "Scenario #1" (for example), where the "#1" is not an event in this case and the pattern also does not match "Case#Event"... Probably links to "?#1" then and should not be a link at all?

Still, it would be best if that would become an "official" feature because then #1234 could also work for cross-case references without having to mention the caseid#eventid - I assume the eventid should be unique and it probably is no problem to figure out the appropriate case-id if it happens server-side.

link|flag
I fixed it and multiple links now work as well. – Michel de Ruiter Jul 16 at 10:20
0

I adapted the great customization Matthias created, to allow for 1234#12345: links to events in other cases. And I made the event ids less prominent.

name:          EasyEvents
description:   Makes linking to bug events easier
author:        Matthias Pigulla, Michel de Ruiter
version:       1.3

js:

$(".bugevent .summary").each(function() {
  var content = $(this);
  content.append('<span class="eventid">' +
                 content.find('.date a').attr('name')
                 .replace('BugEvent.', '#') +
                 '</span>');
});
function isTextNode() {
  return this.nodeType == 3;
}
function findLinks() {
  $('.bugevent.detailed .body').contents().filter(isTextNode)
  .each(function() {
    var ref = RegExp(/(\d*)#(\d+)/g);
    while (ref.test(this.data)) {
      var casenr = RegExp.$1, event = RegExp.$2;
      var link = '#BugEvent.' + event;
      if ($('#bugevent_' + event).length > 0)
        casenr = '';      // Only use case number if necessary.
      else {              // Event not on this page:
        if (casenr == '') // case number must be there;
          continue;       // else just forget about it.
        link = '?' + casenr + link;
      }
      var oldlength = this.data.length;
      var patLength = casenr.length + 1 + event.length;
      var before = this.data.substring(0, ref.lastIndex - patLength);
      var after  = this.data.substring(ref.lastIndex, this.data.length);
      this.parentNode.insertBefore(document.createTextNode(before), this);
      var a = document.createElement("a");
      a.setAttribute("href", link);
      var text = casenr + '#\u200d' + event; // Prevent recursion (&zwj;)!
      a.appendChild(document.createTextNode(text));
      this.parentNode.insertBefore(a, this);
      if (typeof this.textContent !== "undefined")
        this.textContent = after;
      else
        this.nodeValue = after; // IE
      ref.lastIndex += this.data.length - oldlength;
    }
  });
}
findLinks();
$(window).on('BugViewChange', findLinks);


css:

.bugevent .eventid {
  float: right;
  font-size: xx-small;
  color: #CCC;
}
link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.