* fix product tasks tree view.

This commit is contained in:
Catouse
2016-04-21 15:12:54 +08:00
parent 0524386afb
commit 9f2e4e99ea
5 changed files with 84 additions and 44 deletions
+12 -4
View File
@@ -46,7 +46,6 @@ $(function()
var hoursFormat = '<?php echo $lang->project->hours ?>';
var viewLevel = '<?php echo $level ?>' || 'custom';
var data = $.parseJSON('<?php echo json_encode($tree, JSON_HEX_QUOT | JSON_HEX_APOS);?>');
console.log('data', data);
var $tree = $('#projectTree');
var statusMap = $.parseJSON('<?php echo json_encode($lang->task->statusList);?>');
var selectCustomLevel = function() {$('.tree-view-btn.active').removeClass('active').filter('[data-type="custom"]').addClass('active');};
@@ -82,7 +81,11 @@ $(function()
}
else if(item.type === 'story')
{
$li.append('<span><i class="icon icon-lightbulb text-muted"></i> </span>').append($('<a>').attr({href: item.url}).text('#' + item.storyId + ' ' + item.title).css('color', item.color));
$li.append('<span class="tree-item-title"><i class="icon icon-lightbulb text-muted"></i> </span>').append($('<a>').attr({href: item.url}).text('#' + item.storyId + ' ' + item.title).css('color', item.color));
if(item.children && item.children.length)
{
if(item.tasksCount) $li.append(' <span class="label label-task-count label-badge">' + item.tasksCount + '</span>');
}
}
else if(item.type === 'task')
{
@@ -97,10 +100,10 @@ $(function()
$.each(item.tasks, function(idx, task)
{
var $tr = $('<tr class="text-center"/>');
$tr.append($('<td width="30"/>').append('<span class="pri' + task.pri + '">' + task.pri + '</span>'));
$tr.append($('<td width="30"/>').append('<span class="pri' + task.pri + '">' + (task.pri || '') + '</span>'));
$tr.append($('<td/>').addClass('text-left').append($('<a>').attr({href: task.url}).text('#' + task.id + ' ' + task.title).css('color', task.color)));
$tr.append($('<td width="70"/>').addClass(task.storyChanged ? 'warning' : task.status).text(statusMap[task.status]));
$tr.append($('<td width="90"/>').html(task.assignedTo ? ('<i class="icon icon-user text-muted"></i> ' + task.assignedTo) : ''));
$tr.append($('<td width="70"/>').addClass(task.storyChanged ? 'warning' : task.status).text(statusMap[task.status]));
$tr.append($('<td width="140"/>').text(hoursFormat.replace('%s', task.estimate).replace('%s', task.consumed).replace('%s', task.left)));
$tr.append($('<td width="130"/>').html(task.buttons));
$tbody.append($tr);
@@ -108,6 +111,11 @@ $(function()
$li.append($table);
}
}
else if(item.type === 'unlinkStory')
{
$li.append($('<span class="tree-item-title"><i class="icon icon-tasks text-muted"></i> ' + item.title + '</span>')).addClass('tree-toggle');
if(item.tasksCount) $li.append(' <span class="label label-task-count label-badge">' + item.tasksCount + '</span>');
}
else
{
$li.addClass('tree-toggle').append($('<span class="tree-toggle"><i class="icon icon-bookmark-empty text-muted"></i> ' + (item.title || item.name) + '</span>'));