Permalink
Browse files

Add support for an 'area' field, if present

  • Loading branch information...
haugstrup committed Jun 3, 2012
1 parent 7289236 commit 2863a54675905f8437db50ccef355c2290c70eff
Showing with 198 additions and 66 deletions.
  1. +10 −0 helpers.php
  2. +38 −2 public/dashboard.css
  3. +52 −12 public/scrumboard.js
  4. +59 −36 scrumio.classes.php
  5. +13 −6 views/_dashboard_story.html.php
  6. +5 −0 views/_filters.html.php
  7. +4 −0 views/_story.html.php
  8. +17 −10 views/index.html.php
View
@@ -4,3 +4,13 @@ function avatar_url($user_id, $size = 'tiny') {
return 'https://files.podio.com/'.$user_id.'/'.$size;
}
+function story_area_field($app) {
+ if (defined('STORY_AREA_ID')) {
+ foreach ($app['fields'] as $field) {
+ if ($field['field_id'] == STORY_AREA_ID) {
+ return $field;
+ }
+ }
+ }
+ return false;
+}
View
@@ -44,7 +44,7 @@ header h1 {
width:960px;
}
-#dashboard .stories {
+#dashboard .stories-wrapper {
width:630px;
float:left;
}
@@ -111,7 +111,7 @@ header h1 {
#dashboard .stories > li .status-area {
height:50px;
float:left;
-
+
border-radius:4px;
background:#e7e7e7;
margin-right:15px;
@@ -156,6 +156,24 @@ header h1 {
background: #339933;
}
+.area {
+ border-radius:4px;
+ padding:0 4px;
+}
+.story-group .area {
+ margin-left:13px;
+}
+#dashboard .stories > li .metadata .area {
+ margin-left:5px;
+}
+#dashboard .stories > li .metadata .area:first-child {
+ margin-left:0;
+}
+
+#dashboard .stories > li .metadata .estimate {
+ margin:0 10px;
+}
+
#dashboard .stories > li .metadata .testing {
background:#006699;
color:#fff;
@@ -172,6 +190,24 @@ header h1 {
padding:0 2px;
}
+/* Filter list */
+.filter {
+}
+.filter ul {
+ display:inline-block;
+ margin-bottom:20px;
+}
+.filter ul li {
+ cursor:pointer;
+ display:inline-block;
+ border-radius:4px;
+ padding:0 4px;
+ margin:0 10px;
+}
+.filter ul li.active {
+ font-weight:bold;
+}
+
/* BULLET GRAPH */
div.box-wrap { position: relative; width: 370px; height: 21px; top: 0; left: 0; margin: 0; padding: 0; background: #bad6ec; }
View
@@ -5,7 +5,46 @@
$('.graph .target, .graph .actual').tipsy({gravity: 's'});
$('.tooltip').tipsy({gravity: 'n'});
}
-
+
+ function onFilterClick(elmTarget, e) {
+ elmTarget.toggleClass('active');
+ var enabled = elmTarget.hasClass('active');
+ if (enabled) {
+ elmTarget.css('background-color', elmTarget.data('color'));
+ }
+ else {
+ elmTarget.css('background-color', 'transparent');
+ }
+ var currentFilter = [];
+ elmTarget.parent().find('li.active').each(function(){
+ currentFilter.push('area-'+$(this).data('id'));
+ });
+ if (currentFilter.length === 0) {
+ $('ul.stories > li').show();
+ $('#stories > .items > .story-group').show();
+ }
+ else {
+ $('ul.stories > li').each(function(){
+ var is_visible = false;
+ var currentStory = $(this);
+ $.each(currentFilter, function(index, value) {
+ console.log('testing '+value);
+ if (currentStory.hasClass(value)) {
+ is_visible = true;
+ }
+ });
+ if (is_visible) {
+ $(this).show();
+ $('#story-'+$(this).data('id')).show();
+ }
+ else {
+ $(this).hide();
+ $('#story-'+$(this).data('id')).hide();
+ }
+ });
+ }
+ }
+
function onDashBoardStoryClick(elmTarget, e) {
if (!$(e.target).hasClass('external-link')) {
e.preventDefault();
@@ -20,7 +59,7 @@
initSingleStoryView();
$('html, body').scrollTop(0);
}
-
+
function initSingleStoryView() {
function resize_stories() {
// Recalculate width according to browser width
@@ -31,9 +70,9 @@
var count = $('#stories').data('count');
var wrapper_width = Math.floor(total_width/count);
$('.story, .state,.header h1').width(wrapper_width);
-
+
}
-
+
function set_story_height(current_id) {
var states = $(current_id).find('.state');
var max_height = 0;
@@ -44,7 +83,7 @@
current_height += $(this).outerHeight(true);
}
});
-
+
if (current_height > max_height) {
max_height = current_height;
}
@@ -53,7 +92,7 @@
}
resize_stories();
-
+
$(window).resize(function(){
resize_stories();
});
@@ -75,14 +114,14 @@
$(current_id+' .story-item-state').droppable({
accept: current_id+' .story-item-state > li',
activeClass: 'ui-state-highlight',
- tolerance: 'pointer',
+ tolerance: 'pointer',
drop: function(event, ui) {
var old_state = $(ui.draggable).parents('ul').data('state');
var state = $(this).data('state');
if (state != old_state) {
var item_id = $(ui.draggable).data('id');
$(this).append(ui.draggable);
-
+
set_story_height('#'+$(this).parents('.story-group').attr('id'));
// Make Ajax request to change state on Podio
@@ -103,7 +142,7 @@
}
});
});
-
+
var collapsedData = getCollapsedData().split(',');
if (typeof collapsedData === 'object') {
$.each(collapsedData, function(index, value){
@@ -113,7 +152,7 @@
});
}
}
-
+
function onScrumBoardToggleClick(elmTarget, e) {
var elmParent = elmTarget.parents('.story-group');
elmParent.find('.user-list, .state').toggle();
@@ -125,7 +164,7 @@
removeCollapsed(elmParent.attr('data-id'));
}
}
-
+
function getCollapsedData() {
var data = false;
if (typeof localStorage !== 'undefined' ) {
@@ -170,5 +209,6 @@
Podio.Event.UI.bind('click', '#dashboard ul.stories > li', onDashBoardStoryClick, true);
Podio.Event.UI.bind('click', '#switch-view', onDashBoardToggleClick);
Podio.Event.UI.bind('click', '.story-group h2', onScrumBoardToggleClick);
+ Podio.Event.UI.bind('click', '.filter li', onFilterClick);
-})(window, jQuery);
+})(window, jQuery);
Oops, something went wrong.

0 comments on commit 2863a54

Please sign in to comment.