Plugin Developer Discussion

Discussion for FogBugz Plugin developers

Detecting edit mode in IPluginBugEventDisplay.BugEventDisplay

Sorry to be a pest today, but I have one more question.

Is there a way in BugEventDisplay to determine if the page the BugEvent is being displayed on is in read or edit mode?

I'd like to conditionally alter the bugevent HTML, but not when the user is editing the bug.
John Fuex Send private email
Monday, June 29, 2009
Unfortunately this is not currently possible, because we don't re-render the bug events if you are viewing a bug and then hit "Edit" (we just swap some stuff out via Ajax). 

This seems like a reasonable request and I've opened a case, but it would require changing the way the page is rendered and it's too close to release to do that.
David Fullerton Send private email
Tuesday, June 30, 2009
Any suggestions on a reasonably solid interim workaround?

Perhaps some embedded JS that queries the state of some object in the DOM that is only visible in edit mode?
John Fuex Send private email
Tuesday, June 30, 2009
There's no method in the JavaScript API that would give you this information.  If you want to try checking for the existence of some element in the DOM, I'd suggest the sEvent textarea.  Using jQuery it'd look like this:

if ($("textarea[name=sEvent]").length > 0) {
  // edit mode
} else {
  // view mode

Since this isn't supported in the API, there's no guarantee that it will work in future versions so you'll have to keep an eye out for any updates.
David Fullerton Send private email
Tuesday, June 30, 2009

I'll try that approach and just make sure to defensively write this code so that it downgrades gracefully if something changes beneath it.
John Fuex Send private email
Wednesday, July 1, 2009

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz