]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1283233 - Add JSON link to bug nav bar
authorDavid Lawrence <dkl@mozilla.com>
Thu, 30 Jun 2016 17:38:42 +0000 (17:38 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Thu, 30 Jun 2016 17:38:42 +0000 (17:38 +0000)
extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
extensions/BugModal/web/bug_modal.js
template/en/default/bug/navigate.html.tmpl

index b86031b403ebc8eaacfd94eab5e0919081361a44..d51811fabcd2a453ac1e1c2c900ded96f7a12f28 100644 (file)
   [% 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") %]
index 0dd9305c45440cf8b9ff75cd7cbffaaa00fe5ae2..e7a182580d80b3e9802e889c67d3c42a8307b5bc 100644 (file)
@@ -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
index 8d7f8df12b0e4f15de02aaa01993e54053e8f880..f0c92416008ec5eb63105e324d40f59580c62d9f 100644 (file)
@@ -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"