Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Add support for an 'area' field, if present
Browse files Browse the repository at this point in the history
  • Loading branch information
haugstrup committed Jun 3, 2012
1 parent 7289236 commit 2863a54
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 66 deletions.
10 changes: 10 additions & 0 deletions helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
40 changes: 38 additions & 2 deletions public/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ header h1 {
width:960px;
}

#dashboard .stories {
#dashboard .stories-wrapper {
width:630px;
float:left;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ header h1 {
#dashboard .stories > li .status-area {
height:50px;
float:left;

border-radius:4px;
background:#e7e7e7;
margin-right:15px;
Expand Down Expand Up @@ -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;
Expand All @@ -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; }

Expand Down
64 changes: 52 additions & 12 deletions public/scrumboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -20,7 +59,7 @@
initSingleStoryView();
$('html, body').scrollTop(0);
}

function initSingleStoryView() {
function resize_stories() {
// Recalculate width according to browser width
Expand All @@ -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;
Expand All @@ -44,7 +83,7 @@
current_height += $(this).outerHeight(true);
}
});

if (current_height > max_height) {
max_height = current_height;
}
Expand All @@ -53,7 +92,7 @@
}

resize_stories();

$(window).resize(function(){
resize_stories();
});
Expand All @@ -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
Expand All @@ -103,7 +142,7 @@
}
});
});

var collapsedData = getCollapsedData().split(',');
if (typeof collapsedData === 'object') {
$.each(collapsedData, function(index, value){
Expand All @@ -113,7 +152,7 @@
});
}
}

function onScrumBoardToggleClick(elmTarget, e) {
var elmParent = elmTarget.parents('.story-group');
elmParent.find('.user-list, .state').toggle();
Expand All @@ -125,7 +164,7 @@
removeCollapsed(elmParent.attr('data-id'));
}
}

function getCollapsedData() {
var data = false;
if (typeof localStorage !== 'undefined' ) {
Expand Down Expand Up @@ -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);
Loading

0 comments on commit 2863a54

Please sign in to comment.