diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2013-03-29 20:50:34 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2013-03-29 20:50:34 +0100 |
commit | c84943f1f566bcda7556c16cf664feb8215b1a14 (patch) | |
tree | 9a3f0064c8baade11c827c2a4d0ebe4cb5f6efa9 | |
parent | 64ed562d5775252c75207d2e97d985115b6200f5 (diff) | |
download | bugzilla-c84943f1f566bcda7556c16cf664feb8215b1a14.tar.gz bugzilla-c84943f1f566bcda7556c16cf664feb8215b1a14.tar.xz |
Bug 856110 - Add a review link to the dashboard for review attachment flags
-rw-r--r-- | extensions/MyDashboard/lib/Queries.pm | 2 | ||||
-rw-r--r-- | extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl | 6 | ||||
-rw-r--r-- | extensions/MyDashboard/web/js/flags.js | 33 | ||||
-rw-r--r-- | extensions/MyDashboard/web/js/query.js | 4 |
4 files changed, 38 insertions, 7 deletions
diff --git a/extensions/MyDashboard/lib/Queries.pm b/extensions/MyDashboard/lib/Queries.pm index 7703a29c2..9f4935c9d 100644 --- a/extensions/MyDashboard/lib/Queries.pm +++ b/extensions/MyDashboard/lib/Queries.pm @@ -185,7 +185,7 @@ sub query_flags { bugs.bug_status AS bug_status, bugs.short_desc AS bug_summary, flags.attach_id AS attach_id, - attachments.description AS attach_summary, + attachments.ispatch AS is_patch, requesters.login_name AS requester, requestees.login_name AS requestee, " . $dbh->sql_date_format('flags.modification_date', '%Y-%m-%d %H:%i') . " AS updated diff --git a/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl b/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl index 1549b0dc2..404a86a1a 100644 --- a/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl +++ b/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl @@ -67,6 +67,12 @@ </div> </script> +<script type="text/javascript"> + [% IF Param('splinter_base') %] + MyDashboard.splinter_base = '[% Param('splinter_base') FILTER js %]'; + [% END %] +</script> + <div id="mydashboard"> <div class="yui3-skin-sam"> <div id="left"> diff --git a/extensions/MyDashboard/web/js/flags.js b/extensions/MyDashboard/web/js/flags.js index c0ebc63ec..fa06a00d4 100644 --- a/extensions/MyDashboard/web/js/flags.js +++ b/extensions/MyDashboard/web/js/flags.js @@ -6,6 +6,12 @@ * defined by the Mozilla Public License, v. 2.0. */ +if (typeof(MyDashboard) == 'undefined') { + var MyDashboard = {}; +} + +MyDashboard.splinter_base = 'page.cgi?id=splinter.html'; + // Flag tables YUI({ base: 'js/yui3/', @@ -92,12 +98,26 @@ YUI({ : '<i>anyone</i>'; }; + var flagNameFormatter = function (o) { + if (o.data.attach_id && o.data.is_patch) { + return '<a href="' + MyDashboard.splinter_base + + '&bug=' + encodeURIComponent(o.data.bug_id) + + '&attachment=' + encodeURIComponent(o.data.attach_id) + + '" title="Click flag name to go to patch review page">' + + Y.Escape.html(o.value) + '</a>'; + } + else { + return Y.Escape.html(o.value); + } + }; + // Requestee dataSource.requestee = new Y.DataSource.IO({ source: 'jsonrpc.cgi' }); dataTable.requestee = new Y.DataTable({ columns: [ { key: "requester", label: "Requester", sortable: true }, - { key: "type", label: "Flag", sortable: true }, + { key: "type", label: "Flag", sortable: true, + formatter: flagNameFormatter, allowHTML: true }, { key: "bug_id", label: "Bug", sortable: true, formatter: bugLinkFormatter, allowHTML: true }, { key: "updated", label: "Updated", sortable: true, @@ -118,8 +138,8 @@ YUI({ dataSource.requestee.plug(Y.Plugin.DataSourceJSONSchema, { schema: { resultListLocator: "result.result.requestee", - resultFields: ["requester", "type", "bug_id", "bug_status", - "bug_summary", "updated", "updated_fancy"] + resultFields: ["requester", "type", "attach_id", "is_patch", "bug_id", + "bug_status", "bug_summary", "updated", "updated_fancy"] } }); @@ -138,7 +158,8 @@ YUI({ columns: [ { key:"requestee", label:"Requestee", sortable:true, formatter: requesteeFormatter, allowHTML: true }, - { key:"type", label:"Flag", sortable:true }, + { key:"type", label:"Flag", sortable:true, + formatter: flagNameFormatter, allowHTML: true }, { key:"bug_id", label:"Bug", sortable:true, formatter: bugLinkFormatter, allowHTML: true }, { key: "updated", label: "Updated", sortable: true, @@ -159,8 +180,8 @@ YUI({ dataSource.requester.plug(Y.Plugin.DataSourceJSONSchema, { schema: { resultListLocator: "result.result.requester", - resultFields: ["requestee", "type", "bug_id", "bug_status", - "bug_summary", "updated", "updated_fancy"] + resultFields: ["requestee", "type", "attach_id", "is_patch", "bug_id", + "bug_status", "bug_summary", "updated", "updated_fancy"] } }); diff --git a/extensions/MyDashboard/web/js/query.js b/extensions/MyDashboard/web/js/query.js index 4590bb603..7d25cc33e 100644 --- a/extensions/MyDashboard/web/js/query.js +++ b/extensions/MyDashboard/web/js/query.js @@ -6,6 +6,10 @@ * defined by the Mozilla Public License, v. 2.0. */ +if (typeof(MyDashboard) == 'undefined') { + var MyDashboard = {}; +} + // Main query code YUI({ base: 'js/yui3/', |