Highlight my backlog » History » Revision 5
Revision 4 (Nancy Ouyang, 07/15/2015 09:10 AM) → Revision 5/12 (Nancy Ouyang, 07/15/2015 09:14 AM)
h1. Highlight my backlog <pre><code class="javascript"> // ==UserScript== // @name Highlight my redmine backlog // @namespace https://arvados.org/projects/arvados/wiki/Highlight_my_backlog // @version 0.1 // @description Highlights issues assigned to you in redmine Backlogs view. // @author Tom Clegg // @match https://arvados.org/rb/master_backlog/* // @grant none // ==/UserScript== $.ajax('/my/account', {success: function(data, _, _) { var key = $('#api-access-key',data).text(); var url = '/issues.json?assigned_to_id=me&limit=100'; var ajaxopts = { dataType: 'json', headers: {'X-Redmine-API-Key': key}, success: dopage }; $.ajax(url, ajaxopts); function dopage(data, _, _) { for (var i=0; i<data.issues.length; i++) { $('#story_'+data.issues[i].id).css({ //background:'#faa', 'font-weight':'bold' }); } if (data.total_count > data.offset + data.limit) { $.ajax(url + '&offset=' + (data.offset + data.limit), ajaxopts); } } }}); </code></pre> h1. puts in parens the total point count you have for each sprint <code><pre> // ==UserScript== // @name Highlight my redmine backlog // @namespace https://arvados.org/projects/arvados/wiki/Highlight_my_backlog // @version 0.1b // @description Highlights issues assigned to you in redmine Backlogs view and // puts in parens the total point count you have for each sprint. // @author Abram Connelly // @match https://arvados.org/rb/master_backlog/* // @grant none // ==/UserScript== $.ajax('/my/account', {success: function(data, _, _) { var key = $('#api-access-key',data).text(); var url = '/issues.json?assigned_to_id=me&limit=100'; var ajaxopts = { dataType: 'json', headers: {'X-Redmine-API-Key': key}, success: dopage }; $.ajax(url, ajaxopts); function dopage(data, _, _) { var my_sprint_info = {}; for (var i=0; i<data.issues.length; i++) { if ("fixed_version" in data.issues[i]) { var sprint_id = data.issues[i].fixed_version.id; var sprint_name = data.issues[i].fixed_version.name; if (!(sprint_id in my_sprint_info)) { my_sprint_info[sprint_id]={"story_points" : 0, "sprint_id" : sprint_id, "sprint_name" : sprint_name }; } if ("story_points" in data.issues[i]) { my_sprint_info[sprint_id].story_points += data.issues[i].story_points; } } $('#story_'+data.issues[i].id).css({ //background:'#faa', 'font-weight':'bold' }); } if (data.total_count > data.offset + data.limit) { $.ajax(url + '&offset=' + (data.offset + data.limit), ajaxopts); } for (var sprint_id in my_sprint_info) { var cur_pnt = $("#sprint_" + sprint_id).children(".fff-right").children(".velocity").text(); cur_pnt += " (" + my_sprint_info[sprint_id].story_points +")"; $("#sprint_" + sprint_id).children(".fff-right").children(".velocity").text(cur_pnt); } } }}); </code></pre> h1. Useful stuff useful links h2. Links * Test it out on a backlog page: https://arvados.org/rb/master_backlog/arvados * The tooltips on the backlog page are loaded dynamically on mouseover: https://arvados.org/rb/story/6394/tooltip?project_id=39 * Redmine Backlog, github page: https://github.com/backlogs/redmine_backlogs/ * The Redmine REST API: http://www.redmine.org/projects/redmine/wiki/Rest_api h2. Example of changing the background color and the font (in short, use 'font-family' not 'font') 'background':'#F49C54', //orange 'font-family':'URW Bookman L, serif', 'font-size':'1.2em',