mozilla

Revision 456791 of Template:bug

  • Revision slug: Template:bug
  • Revision title: Template:bug
  • Revision id: 456791
  • Created:
  • Creator: trevorh
  • Is current revision? No
  • Comment

Revision Content

<% /* * Inserts a link to a bug in Mozilla's Bugzilla database. * * $0 - The bug number to link to. As we follow resolved duplicate this may not be the number in the output. */ var mdn = require("MDN:Common"); var tip = ''; var style = ''; var bugNumber = $0; var url = encodeURI('https://bugzilla.mozilla.org/jsonrpc.cgi?method=Bug.get¶ms=[ { "ids": [' + bugNumber + '], "include_fields":["summary","dupe_of","resolution"] } ]'); var bugzillaDetail = mdn.fetchJSONResource(url); if (bugzillaDetail.error != null) { if (bugzillaDetail.error.code == 102) { tip = "The access to the bug's page is restricted."; } else { tip = "ERROR: " + bugzillaDetail.error.message; } } else if (bugzillaDetail.result != null) { var bugDetail = bugzillaDetail.result.bugs[0]; while (bugDetail.dupe_of != null) { bugNumber = bugDetail.dupe_of; url = encodeURI('https://bugzilla.mozilla.org/jsonrpc.cgi?method=Bug.get¶ms=[ { "ids": [' + bugNumber + '], "include_fields":["summary","dupe_of","resolution"] } ]'); bugzillaDetail = mdn.fetchJSONResource(url); bugDetail = bugzillaDetail.result.bugs[0]; } if (bugDetail.resolution == "FIXED") { tip = 'FIXED: ' + bugDetail.summary; style = 'style="text-decoration:line-through;"'; } else { tip = bugDetail.summary; } } var bugPageURL = 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + bugNumber; var s_bug = mdn.localString({ "en-US": "bug", "ca" : "errada", "cs" : "chyba", "ja" : "バグ", "pl" : "błąd" }); %> href="<%- bugPageURL %>" title="<%- kuma.htmlEscape(tip) %>"><%=s_bug%> <%- bugNumber %>

Revision Source

<%
/*
 * Inserts a link to a bug in Mozilla's Bugzilla database.
 *
 * $0 - The bug number to link to. As we follow resolved duplicate this may not be the number in the output.
 */

var mdn = require("MDN:Common");

var tip = '';
var style = '';
var bugNumber = $0;
var url = encodeURI('https://bugzilla.mozilla.org/jsonrpc.cgi?method=Bug.get&params=[ { "ids": [' +  bugNumber + '], "include_fields":["summary","dupe_of","resolution"] } ]');
var bugzillaDetail = mdn.fetchJSONResource(url);

if (bugzillaDetail.error != null) {
    if (bugzillaDetail.error.code == 102) {
        tip = "The access to the bug's page is restricted.";
    } else {
        tip = "ERROR: " + bugzillaDetail.error.message;
    }
} else if (bugzillaDetail.result != null) {
    var bugDetail = bugzillaDetail.result.bugs[0];
    while (bugDetail.dupe_of != null) {
        bugNumber = bugDetail.dupe_of;
        url = encodeURI('https://bugzilla.mozilla.org/jsonrpc.cgi?method=Bug.get&params=[ { "ids": [' +  bugNumber + '], "include_fields":["summary","dupe_of","resolution"] } ]');
        bugzillaDetail = mdn.fetchJSONResource(url);
        bugDetail = bugzillaDetail.result.bugs[0];
    }
    if (bugDetail.resolution == "FIXED") {
        tip = 'FIXED: ' + bugDetail.summary;
        style = 'style="text-decoration:line-through;"';
    } else {
        tip = bugDetail.summary;
    }
}
var bugPageURL = 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + bugNumber;

var s_bug = mdn.localString({
    "en-US": "bug",
    "ca"   : "errada",
    "cs"   : "chyba",
    "ja"   : "バグ",
    "pl"   : "błąd"
});
%>
<a <%- style %> href="<%- bugPageURL %>" title="<%- kuma.htmlEscape(tip) %>"><%=s_bug%>&nbsp;<%- bugNumber %></a>
Revert to this revision