From dbc5625130931706a14de0bb88ecc5d1d2bdf3fb Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 8 Aug 2013 09:35:37 -0700 Subject: Bug 902960: add the ability to show a normal buglist from the dashboard tables --- extensions/MyDashboard/web/js/flags.js | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'extensions/MyDashboard/web/js/flags.js') diff --git a/extensions/MyDashboard/web/js/flags.js b/extensions/MyDashboard/web/js/flags.js index 2498ba8ae..1ba6bd696 100644 --- a/extensions/MyDashboard/web/js/flags.js +++ b/extensions/MyDashboard/web/js/flags.js @@ -3,7 +3,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. * * This Source Code Form is "Incompatible With Secondary Licenses", as - * defined by the Mozilla Public License, v. 2.0. + * defined by the Mozilla Public License, v. 2.0. */ // Flag tables @@ -11,7 +11,7 @@ YUI({ base: 'js/yui3/', combine: false }).use("node", "datatable", "datatable-sort", "json-stringify", "escape", - "datatable-datasource", "datasource-io", "datasource-jsonschema", function (Y) { + "datatable-datasource", "datasource-io", "datasource-jsonschema", function(Y) { // Common var counter = 0; var dataSource = { @@ -23,7 +23,7 @@ YUI({ requester: null }; - var updateFlagTable = function (type) { + var updateFlagTable = function(type) { if (!type) return; var include_closed = Y.one('#' + type + '_closed').get('checked') ? 1 : 0; @@ -70,7 +70,18 @@ YUI({ }); }; - var bugLinkFormatter = function (o) { + var loadBugList = function(type) { + if (!type) return; + var data = dataTable[type].data; + var ids = []; + for (var i = 0, l = data.size(); i < l; i++) { + ids.push(data.item(i).get('bug_id')); + } + var url = 'buglist.cgi?bug_id=' + ids.join('%2C'); + window.open(url, '_blank'); + }; + + var bugLinkFormatter = function(o) { var bug_closed = ""; if (o.data.bug_status == 'RESOLVED' || o.data.bug_status == 'VERIFIED') { bug_closed = "bz_closed"; @@ -81,18 +92,18 @@ YUI({ '">' + o.value + ''; }; - var updatedFormatter = function (o) { + var updatedFormatter = function(o) { return '' + Y.Escape.html(o.data.updated_fancy) + ''; }; - var requesteeFormatter = function (o) { + var requesteeFormatter = function(o) { return o.value ? Y.Escape.html(o.value) : 'anyone'; }; - var flagNameFormatter = function (o) { + var flagNameFormatter = function(o) { if (parseInt(o.data.attach_id) && parseInt(o.data.is_patch) && MyDashboard.splinter_base) @@ -146,6 +157,9 @@ YUI({ Y.one('#requestee_refresh').on('click', function(e) { updateFlagTable('requestee'); }); + Y.one('#requestee_buglist').on('click', function(e) { + loadBugList('requestee'); + }); Y.one('#requestee_closed').on('change', function(e) { updateFlagTable('requestee'); }); @@ -186,6 +200,9 @@ YUI({ Y.one('#requester_refresh').on('click', function(e) { updateFlagTable('requester'); }); + Y.one('#requester_buglist').on('click', function(e) { + loadBugList('requester'); + }); Y.one('#requester_closed').on('change', function(e) { updateFlagTable('requester'); }); -- cgit v1.2.3-24-g4f1b