summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2016-06-30 19:38:42 +0200
committerDavid Lawrence <dkl@mozilla.com>2016-06-30 19:38:42 +0200
commit7c42dc6972e69b31411fbfac7e2ef0ea9242e9d4 (patch)
tree4d7c3e845609634b78c1602d7601c21f827850bc
parent8b6c60262ddfa26af57a9e175059f37162288f89 (diff)
downloadbugzilla-7c42dc6972e69b31411fbfac7e2ef0ea9242e9d4.tar.gz
bugzilla-7c42dc6972e69b31411fbfac7e2ef0ea9242e9d4.tar.xz
Bug 1283233 - Add JSON link to bug nav bar
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/header.html.tmpl1
-rw-r--r--extensions/BugModal/web/bug_modal.js50
-rw-r--r--template/en/default/bug/navigate.html.tmpl3
3 files changed, 34 insertions, 20 deletions
diff --git a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
index b86031b40..d51811fab 100644
--- a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
@@ -118,6 +118,7 @@
[% IF user.is_timetracker %]
BUGZILLA.remaining_time = [% bug.remaining_time FILTER js %]; // holds the original value
[% END %]
+ BUGZILLA.bug_secure = [% bug.groups_in.size ? '1' : '0' %];
[% END %]
[% Hook.process("end") %]
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js
index 0dd9305c4..e7a182580 100644
--- a/extensions/BugModal/web/bug_modal.js
+++ b/extensions/BugModal/web/bug_modal.js
@@ -1027,29 +1027,39 @@ $(function() {
},
]
});
+
+ var format_items = [
+ {
+ name: 'For Printing',
+ callback: function() {
+ window.location.href = 'show_bug.cgi?format=multiple&id=' + BUGZILLA.bug_id;
+ }
+ },
+ {
+ name: 'XML',
+ callback: function() {
+ window.location.href = 'show_bug.cgi?ctype=xml&id=' + BUGZILLA.bug_id;
+ }
+ },
+ {
+ name: 'Legacy',
+ callback: function() {
+ window.location.href = 'show_bug.cgi?format=default&id=' + BUGZILLA.bug_id;
+ }
+ }
+ ];
+ if (!BUGZILLA.bug_secure) {
+ format_items.push({
+ name: 'JSON',
+ callback: function() {
+ window.location.href = 'rest/bug/' + BUGZILLA.bug_id;
+ }
+ });
+ }
$.contextMenu({
selector: '#format-btn',
trigger: 'left',
- items: [
- {
- name: 'For Printing',
- callback: function() {
- window.location.href = 'show_bug.cgi?format=multiple&id=' + BUGZILLA.bug_id;
- }
- },
- {
- name: 'XML',
- callback: function() {
- window.location.href = 'show_bug.cgi?ctype=xml&id=' + BUGZILLA.bug_id;
- }
- },
- {
- name: 'Legacy',
- callback: function() {
- window.location.href = 'show_bug.cgi?format=default&id=' + BUGZILLA.bug_id;
- }
- }
- ]
+ items: format_items
});
// "reset to default" checkboxes
diff --git a/template/en/default/bug/navigate.html.tmpl b/template/en/default/bug/navigate.html.tmpl
index 8d7f8df12..f0c924160 100644
--- a/template/en/default/bug/navigate.html.tmpl
+++ b/template/en/default/bug/navigate.html.tmpl
@@ -28,6 +28,9 @@
[% bug.bug_id FILTER uri %]">Format For Printing</a></li>
<li>&nbsp;-&nbsp;<a href="show_bug.cgi?ctype=xml&amp;id=
[% bug.bug_id FILTER uri %]">XML</a></li>
+ [% IF NOT bug.groups_in.size %]
+ <li>&nbsp;-&nbsp;<a href="rest/bug/[% bug.bug_id FILTER uri %]">JSON</a></li>
+ [% END %]
<li>&nbsp;-&nbsp;
<a href="enter_bug.cgi?format=__default__&amp;cloned_bug_id=[% bug.bug_id FILTER uri %]"
id="clone_bug"