Skip to content

kristofkeppens/kanbanise-redmine

 
 

Repository files navigation

Kanbanise Redmine

Make a Redmine issues page look like a Kanban board such as Trello

Full instructions and installation

See the Github page at http://boxuk.github.com/kanbanise-redmine/

Bookmarklet

javascript:(function(){function%20Kanbanise(){}Kanbanise.prototype.templateTicket='%3Cli%20id=\'issue-${id}\'%20class=\'card%20ticket%20${nature_class}${severity}${family}${priority}\'%3E\n'+'%20%3Ca%20class=\'icon\'%20title=\'${nature_human}\'/%3E\n'+'%20%3Cspan%20class=\'story-points\'%3E${storyPoints}%3C/span%3E\n'+'%20%3Ch3%3E%3Ca%20href=\'/issues/${id}\'%3E${subject}%3C/a%3E%3C/h3%3E\n'+'%20%3Cspan%20class=\'assigned-to\'%3E${assignedTo}%3C/span%3E\n'+'%3C/li%3E\n';Kanbanise.prototype.templateCol='%3Cdiv%20class=\'list%20columnWrapper\'%3E\n'+'%20%3Cdiv%20id=\'${id}\'%20class=\'column\'%3E\n'+'%20%3Ch1%3E${title}%3C/h1%3E\n'+'%20%3Cul%20class=\'sortable\'%3E${cards}%3C/ul%3E\n'+'%20%3C/div%3E\n'+'%3C/div%3E\n';Kanbanise.prototype.templateRow='%3Cdiv%20class=\'list%20rowWrapper\'%3E\n'+'%20%3Cdiv%20id=\'${id}\'%20class=\'column%20row\'%3E\n'+'%20%3Ch1%3E${title}%3C/h1%3E\n'+'%20%3Cul%20class=\'\'%3E${cards}%3C/ul%3E\n'+'%20%3C/div%3E\n'+'%3C/div%3E\n';Kanbanise.log=function(msg){if(window.console%20%26%26%20window.console.log){window.console.log(msg);}};Kanbanise.prototype.applyTemplateTicket=function(data){var%20tmp='';for(var%20i=0;i%20%3C%20data.length;i++){tmp+=this.templateTicket.replace(/\$\{id\}/gi,data[i].id).replace('${subject}',data[i].subject).replace('${storyPoints}',data[i].storyPoints).replace('${assignedTo}',data[i].assignedTo).replace('${nature_class}','%20'+data[i].nature.css+'%20').replace('${nature_human}','%20'+data[i].nature.human+'%20').replace('${severity}','%20'+data[i].severity+'%20').replace('${priority}','%20'+data[i].priority+'%20').replace('${family}','%20'+data[i].family+'%20');}return%20tmp;};Kanbanise.prototype.applyTemplateCol=function(title,id,cards){return%20jQuery(this.templateCol.replace('${title}',title).replace('${id}',id).replace('${cards}',cards));};Kanbanise.prototype.applyTemplateRow=function(title,id,cards){return%20jQuery(this.templateRow.replace('${title}',title).replace('${id}',id).replace('${cards}',cards));};Kanbanise.prototype.init=function(){'use%20strict';var%20msgWin=null;var%20self=this;var%20$=jQuery;var%20VERSION='0.14';var%20API_KEY=null;var%20redmineRoot=window.location.protocol+'//'+window.location.host+'/';if($('body.action-index')===null%20||%20$('body.action-index').length===0){alert('This%20page%20doesn\'t%20look%20like%20a%20Redmine%20issues%20list!%20Please%20find%20some%20issues');return;}function%20showMessage(msg){if(msgWin===null){$('%23msgWin').remove();msgWin=$('%3Cdiv%20id=\'msgWin\'%20style=\'\'%3E%3C/div%3E');$('body').append(msgWin);}$(msgWin).text(msg).show();}function%20resizeColumns(){var%20maxH=0;for(var%20i=1;i%20%3C=4;i++){$('%23col'+i).height('auto');if($('%23col'+i).height()%3E%20maxH){maxH=$('%23col'+i).height();}}$('.sortable').height(maxH);}function%20setUpSorting(){$('.sortable').sortable({placeholder:'card%20ticket%20placeholder',revert:99,receive:function(event,ui){resizeColumns();var%20newStatus=$(ui.item).parent().parent().find('h1').text();var%20newStatusId=1;switch(newStatus.toLowerCase()){case%20'backlog':newStatusId=1;break;case%20'in%20progress':newStatusId=2;break;case%20'resolved/with%20qa':newStatusId=3;break;case%20'done':newStatusId=5;break;default:return;}if(API_KEY===null){alert('No%20API%20key%20was%20set.%20Are%20you%20definitely%20logged%20in%3F');}var%20issueId=ui.item[0].id.replace('issue-','');showMessage('Saving%20changes...');jQuery.ajax(redmineRoot+'issues/'+issueId+'.json',{headers:{'X-Redmine-API-Key':API_KEY,'Content-Type':'application/json'},processData:false,dataType:'json',data:JSON.stringify({issue:{status_id:newStatusId}}),type:'PUT',complete:function(jqHXR,textStatus){$(msgWin).fadeOut('slow');}});},connectWith:'.sortable'}).disableSelection();}function%20loadApiKey(issues){showMessage('Loading%20API%20key...');jQuery.ajax(redmineRoot+'my/account',{complete:function(jqHRX,text){var%20responseText=jqHRX.responseText;var%20start=responseText.indexOf('id=\'api-access-key\'');var%20hunk=responseText.substring(start,start+100);var%20startKey=hunk.indexOf('%3E')+1;API_KEY=hunk.substring(startKey,startKey+40);setUpSorting();$('%3Cstyle%20type=\'text/css\'%3E.sortable%20li%20{cursor:move;}%3C/style%3E').appendTo('head');showMessage('Loaded%20API%20key');$(msgWin).delay(3000).fadeOut('slow');}});}function%20getIssues(){var%20issues={'immediate':[],'backlog':[],'inProgress':[],'resolved':[],'done':[]};var%20rows=$('table.issues%20tr.issue');rows.each(function(index,value){var%20category='backlog';var%20priority='normal';switch(jQuery(value).children('.status')[0].innerHTML){case%20'Closed':category='done';break;case%20'In%20Progress':category='inProgress';break;case%20'Resolved':case%20'Ready%20for%20QA':category='resolved';break;}if(jQuery(value).children('.priority')[0].innerHTML=='Immediate'%20%26%26%20jQuery(value).children('.status')[0].innerHTML%20!='Closed'){category='immediate';priority='immediate';}var%20storyPoints='';var%20assignedTo='';var%20nature_class='';var%20nature_human='';var%20family='';var%20severity='';if(jQuery(value).children('.story_points').length%20%3E%200){storyPoints=jQuery(value).children('.story_points')[0].textContent;if(storyPoints%20%26%26%20storyPoints.length%20%3E%200){storyPoints=storyPoints+'%20story%20points';}}if(jQuery(value).children('.assigned_to').length%20%3E%200){assignedTo=jQuery(value).children('.assigned_to')[0].textContent;if(assignedTo%20%26%26%20assignedTo.length%20%3E%200){assignedTo='Assigned%20to%20'+assignedTo;}}if(jQuery(value).children('.tracker').length%20%3E%200){var%20tracker=jQuery(value).children('.tracker')[0].textContent;if(tracker%20%26%26%20tracker.length%20%3E%200){nature_class='nature-'+tracker.replace('%20','-').toLowerCase();nature_human='This%20ticket%20is%20a%20'+tracker;}}if(jQuery(value).children('.cf_1').length%20%3E%200){severity=jQuery(value).children('.cf_1')[0].textContent;if(severity%20%26%26%20severity.length%20%3E%200){severity='severity-'+severity.toLowerCase();}}if(jQuery(value).children('.parent').length%20%3E%200){family=jQuery(value).children('.parent')[0].textContent;if(family%20%26%26%20family.length%20%3E%200){family='children';}else{family='parent';}}issues[category].push({'id':jQuery(value).children('.id')[0].textContent,'priority':jQuery(value).children('.priority')[0].textContent,'subject':jQuery(value).children('.subject')[0].textContent,'assignedTo':assignedTo,'storyPoints':storyPoints,'nature':{'css':nature_class,'human':nature_human},'severity':severity,'family':family});});return%20issues;}function%20createBoard(){$('div%23kanban').remove();var%20div=$('%3Cdiv%20id=\'kanban\'%3E%3C/div%3E');return%20div;}function%20drawBoard(issues){var%20div=$('div%23kanban');var%20row1Content=self.applyTemplateTicket(issues['immediate']);var%20col1Content=self.applyTemplateTicket(issues['backlog']);var%20col2Content=self.applyTemplateTicket(issues['inProgress']);var%20col3Content=self.applyTemplateTicket(issues['resolved']);var%20col4Content=self.applyTemplateTicket(issues['done']);$(div).append(self.applyTemplateRow('Immediate','row1',row1Content));$(div).append(self.applyTemplateCol('Backlog','col1',col1Content));$(div).append(self.applyTemplateCol('In%20progress','col2',col2Content));$(div).append(self.applyTemplateCol('Resolved/with%20QA','col3',col3Content));$(div).append(self.applyTemplateCol('Done','col4',col4Content));$(div).append($('%3Cdiv%20class=\'credits\'%3EKanbanise%20'+VERSION+'%20-%20brought%20to%20you%20by%20%3Ca%20href=\'http://www.boxuk.com/\'%3EBox%20UK%3C/a%3E'+'%20|%20%3Ca%20href=\'http://github.com/boxuk/kanbanise-redmine/issues\'%3EFeedback%3C/a%3E%3C/div%3E'));$(div).click(function(){showMessage('Press%20\'escape\'%20to%20close');$(msgWin).delay(3000).fadeOut('slow');});$(document).keyup(function(e){if(e.keyCode==27){$('%23kanban').remove();}});return%20div;}function%20addStyling(){$('%3Cstyle%20type=\'text/css\'%3E%20.ui-state-hover{%20background:%20blue%20!important;%20}\n'+'%23kanban%20{%20z-index:1000;position:absolute;left:0;top:0;width:100%25;min-height:100%25;background:%23164B69;%20}\n'+'.story-points%20{%20float:right;font-size:11px;}\n'+'.card,%20.column%20{%20border-radius:%204px;%20box-shadow:%200%200%208px%20rgba(0,%200,%200,%200.6),%20inset%200px%200px%206px%20rgba(64,%20116,%20188,%200.4);%20margin:%200%200%207px%200;%20}\n'+'.card%20{%20background:%20%23fefefe;%20padding:%205px;}\n'+'.ticket%20{border-left:%2012px%20solid%20%23212121;}\n'+'.ticket%20a%20{color:%20%2310384f;}\n'+'.ticket%20.icon%20{float:%20right;%20height:%2010px;%20opacity:%200.5;}'+'.ticket.nature-task%20.icon%20{background:%20url(http://twitter.github.com/bootstrap/assets/img/glyphicons-halflings.png)%20no-repeat;%20background-position:%20-380px%20-145px;}\n'+'.ticket.nature-features%20.icon%20{background:%20url(http://twitter.github.com/bootstrap/assets/img/glyphicons-halflings.png)%20no-repeat;%20background-position:%20-165px%200px;}\n'+'.ticket.nature-defects%20.icon%20{background:%20url(http://twitter.github.com/bootstrap/assets/img/glyphicons-halflings.png)%20no-repeat;%20background-position:%20-356px%20-145px;}\n'+'.ticket.nature-product-ideas%20.icon%20{background:%20url(http://twitter.github.com/bootstrap/assets/img/glyphicons-halflings.png);%20background-position:%20-20px%20-145px;}\n'+'.ticket.nature-feedback%20.icon%20{background:%20url(http://twitter.github.com/bootstrap/assets/img/glyphicons-halflings.png);%20background-position:%20-91px%20-120px;}\n'+'.ticket.children%20{width:%2092%25;%20margin-left:%202.8%25;}\n'+'.nature-features%20{border-left:%2012px%20solid%20%23a0d3d8;}\n'+'.nature-defects%20{border-left:%2012px%20solid%20%23dfa878;}\n'+'.nature-product-ideas%20{border-left:%2012px%20solid%20%23d9df78;}\n'+'.nature-feedback%20{border-left:%2012px%20solid%20%23dfa4dc;}\n'+'.severity-blocker%20{}'+'.severity-critical%20{}'+'.severity-major%20{}'+'.severity-moderate%20{}'+'.Immediate%20{width:20%25;%20float:left;margin-left:10px;}'+'.card%20h3{%20display:%20block;%20margin-bottom:%200.2em;%20overflow:%20hidden;}\n'+'.column%20{%20border:1px%20solid%20rgba(255,%20255,%20255,%200.1);margin:10px;padding:10px%2020px;background:%20%23084563;%20box-shadow:%20inset%200%200%2020px%20rgba(0,%200,%200,%200.3)}\n'+'.column%20h1%20{%20color:%20%23fff;margin-bottom:4px;display:block;%20}\n'+'.columnWrapper%20{%20float:left;width:%2025%25;%20}\n'+'.rowWrapper%20{%20}\n'+'.row%20{%20min-height:%20120px;}\n'+'.assigned-to%20{display:%20block;%20font-size:%2011px;%20text-transform:%20uppercase;}\n'+'.credits%20{%20clear:both;color:%23fff;font-size:0.7em;margin-left:20px;margin-bottom:%2020px;}\n'+'.credits%20a%20{%20color:%20%23fff;%20font-weight:%20bold}\n'+'div%23msgWin%20{position:fixed;right:0px;top:0px;z-index:30000;background:black;border:white%201px%20solid;padding:%203px;%20color:%20%23fff}\n'+'.placeholder%20{%20height:%2030px;background:%20yellow;}\n'+'ul.sortable%20{%20list-style-type:%20none;padding:0;margin-left:0}\n'+'.sortable%20li%20{cursor:wait;}\n'+'%3C/style%3E').appendTo('head');}addStyling();var%20issues=getIssues();var%20div=createBoard();$('body').append(div);drawBoard(issues);loadApiKey(issues);resizeColumns();};(function(){'use%20strict';var%20MIN_JQUERY_VERSION='1.11.0';var%20k=new%20Kanbanise();if(typeof(jasmine)!=='undefined'){return;}function%20loadJQueryUI(){Kanbanise.log('Loading%20jQuery%20UI...');var%20done=false;var%20script=document.createElement('script');script.src='//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js';script.onload=script.onreadystatechange=function(){if(!done%20%26%26(!this.readyState%20||%20this.readyState==='loaded'%20||%20this.readyState=='complete')){Kanbanise.log('Loaded%20jQuery%20UI');done=true;k.init();}};document.getElementsByTagName('head')[0].appendChild(script);}function%20loadJQuery(){Kanbanise.log('Loading%20jQuery...');var%20done=false;var%20script=document.createElement('script');script.src='//ajax.googleapis.com/ajax/libs/jquery/'+MIN_JQUERY_VERSION+'/jquery.min.js';script.onload=script.onreadystatechange=function(){if(!done%20%26%26(!this.readyState%20||%20this.readyState==='loaded'%20||%20this.readyState=='complete')){Kanbanise.log('loaded%20jQuery');$.noConflict();done=true;loadJQueryUI();}};document.getElementsByTagName('head')[0].appendChild(script);}Kanbanise.log('Loading%20Kanbanise...');if(window.jQuery===undefined%20||%20window.jQuery.fn.jquery%20%3C%20MIN_JQUERY_VERSION%20||%20window.jQueryUI===undefined){loadJQuery();}else{k.init();}}());})();

Changes to Redmine

See http://www.redmine.org/issues/11797 - in short, you have to patch one file - at least you do in Redmine 1.3.3, which this was build against. See the patch file included.

About

Display Redmine issues in a Kanban-style format.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%