Permalink
Browse files

Adding comment count mashup

  • Loading branch information...
1 parent c3cdc4c commit 366997e51cc05eaaa0e64c67bd9a25c2e869f8f9 @JonnyFunFun JonnyFunFun committed Feb 1, 2012
@@ -0,0 +1 @@
+Placeholders:Project_Planning_Kanban_KanbanBoard
@@ -0,0 +1,74 @@
+tau.mashups
+ .addDependency("libs/jquery/jquery")
+ .addMashup(function() {
+
+ var addCommentCountIcons = function() {
+ $('div.kanban-item').each(function() {
+ var el = $(this);
+ var itemType = null;
+ var itemId = el.find('.kanban-item-id:first').html();
+ if (el.id().match(/kanban-item-userstory-\d+/)) {
+ itemType = 'UserStories';
+ } else if (el.id().match(/kanban-item-bug-\d+/)) {
+ itemType = 'Bugs';
+ } else if (el.id().match(/kanban-item-feature-\d+/)) {
+ itemType = 'Features';
+ }
+ if (itemType == null)
+ return;
+ /* AJAX call to the REST API to gather the due date custom field information */
+ $.ajax({
+ type: 'GET',
+ url: appHostAndPath+'/api/v1/'+itemType+'/'+itemId+'?include=[Comments]&format=json',
+ context: el[0],
+ contentType: 'application/json',
+ dataType: 'json',
+ success: function(resp) {
+ if (resp.Comments.length != 0) {
+ if ($(this).find('.tasks-bugs')[0] == undefined) {
+ /* we need to add the .tasks-bugs div */
+ var tbd = $('<div class="tasks-bugs"></div>');
+ if ($(this).find('.kanban-avatars')[0] == undefined) {
+ /* we need to position around an avatar */
+ tbd.addClass('tasks-bugs-left');
+ }
+ $(this).append(tbd);
+ }
+ $(this).find('.tasks-bugs').append('<a href="'+appHostAndPath+'/View.aspx?id='+itemId+'" class="commentCount">'+resp.Comments.length+'</a>');
+ }
+ }
+ });
+ });
+ };
+
+ var addRequiredCSS = function() {
+ $('head').append('<style type="text/css">' +
+ '.kanban-item .tasks-bugs .commentCount {' +
+ 'background: url("'+appHostAndPath+'/JavaScript/tau/css/images/balloon.png") no-repeat;' +
+ 'width: auto; height: 16px; display: inline-block; padding: 0 3px 0 16px;' +
+ 'font-weight: bold; text-decoration: underline;'+
+ '}' +
+ '</style>');
+ };
+
+ /**
+ * our main rendering - we wait for doc.ready to deal with slow-rendering browsers and clients
+ */
+ $(document).ready(function() {
+ /* bind some CSS */
+ addRequiredCSS();
+ /* and make the magic happen */
+ addCommentCountIcons();
+ $.each(Tp.controls.kanbanboard.KanbanboardManager.getInstance().kanbanBoards, function() {
+ /* bind to reload button */
+ $(this)[0].controller.uxKanbanBoardPanel.on('reload', function() {
+ addCommentCountIcons();
+ });
+ /* and bind to when cards change columns */
+ $(this)[0].controller.on('statechanged', function(b, c) {
+ addCommentCountIcons();
+ });
+ });
+ });
+});
+
@@ -0,0 +1,46 @@
+Kanban Board Comment Count
+==========================
+
+The Kanban Board comment count Mashup adds an icon with the current comment
+count to each of your cards in similar fashion as to the task and bug count
+icons.
+
+![Kanban Board Comment Counts](https://raw.github.com/TargetProcess/MashupsLibrary/master/Kanban%20Board%20Comment%20Counts/screenshot.png)
+
+
+[Download the Mashup's ZIP Archive](https://github.com/downloads/TargetProcess/MashupsLibrary/Kanban%20Board%20Comment%20Counts.zip)
+
+
+How To Install and Use the Mashup
+---------------------------------
+
+1. Download the Mashup file either by cloning this repository or
+ downloading a ZIP.
+2. Extract/copy the "Kanban Board Comment Counts" folder to your
+ _<TargetProcess Install Path>/JavaScript/Mashups/_ folder.
+3. Open the Kanban Board
+4. ?
+5. Profit!
+
+
+Installing the Mashup with TargetProcess OnDemand
+-------------------------------------------------
+
+1. In your OnDemand site, navigate to ```Settings > (System Settings) > Mashups```
+2. Click "Add New Mashup"
+3. In the "Name" field, enter a name unique to this Mashup - for example "Kanban Comment Count"
+4. In the "Placeholders" field, enter ```Project_Planning_Kanban_KanbanBoard```
+5. Copy and paste the contents of the [KanbanBoardCommentCounts.js](https://raw.github.com/TargetProcess/MashupsLibrary/master/Kanban%20Board%20Comment%20Counts/KanbanBoardCommentCounts.js) file in the "Code" box.
+6. Click Save
+7. Open the Kanban Board
+8. ?
+9. PROFIT!
+
+
+Troubleshooting
+---------------
+
+**I don't have a _JavaScript/Mashups/_ folder in my TP install path!**
+
+1. Make sure that you are running TargetProcess version 2.22 or newer.
+2. By default, this folder can be found at _C:\inetpub\wwwroot\TargetProcess2\wwwroot\JavaScript\Mashups_
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -106,3 +106,10 @@ according to both tags and custom fields. This mashup will determine a base col
first match of either tags and custom fields that it finds. The cards are ultimately colored a particular shade of
this base color, depending on the entity's business value or priority. There are also some fail-safe mechanisms that
will ensure that you are never given black text over a dark-colored card. [(Download)](https://github.com/downloads/TargetProcess/MashupsLibrary/KanbanTagCustomFieldColorer.zip)
+
+
+[**Kanban Board Comment Counts**](https://github.com/TargetProcess/MashupsLibrary/tree/master/Kanban%20Board%20Comment%20Counts)
+
+The Kanban Board comment count Mashup adds an icon with the current comment
+count to each of your cards in similar fashion as to the task and bug count
+icons. [(Download)](https://github.com/downloads/TargetProcess/MashupsLibrary/Kanban%20Board%20Comment%20Counts.zip)

0 comments on commit 366997e

Please sign in to comment.