Style gantt links as invalid based on if the start/end dates are correct for the link type

This commit is contained in:
Nathan Gray 2014-06-10 18:52:50 +00:00
parent d1d11c63df
commit f8cb222580
2 changed files with 41 additions and 0 deletions

View File

@ -753,4 +753,33 @@ $j(function() {
return "weekend" return "weekend"
} }
}; };
// Link styling
gantt.templates.link_class = function(link) {
var link_class = '';
var source = gantt.getTask(link.source);
var target = gantt.getTask(link.target);
var valid = true;
var types = gantt.config.links;
switch (link.type)
{
case types.finish_to_start:
valid = (source.end_date <= target.start_date)
break;
case types.start_to_start:
valid = (source.start_date <= target.start_date);
break;
case types.finish_to_finish:
valid = (source.end_date >= target.end_date);
break;
case types.start_to_finish:
valid = (source.start_date >= target.end_date)
break;
}
link_class += valid ? '' : 'invalid_constraint';
return link_class;
}
}); });

View File

@ -1448,6 +1448,18 @@ div.ui-toolbar-menulist{
{ {
background-color: #f7eb91; background-color: #f7eb91;
} }
.et2_gantt .gantt_task_link.invalid_constraint .gantt_line_wrapper div
{
background-color: red;
}
.et2_gantt .gantt_task_link.invalid_constraint .gantt_link_arrow_left
{
border-right-color: red;
}
.et2_gantt .gantt_task_link.invalid_constraint .gantt_link_arrow_right
{
border-left-color: red;
}
/** /**
* Do not wrap content of a single widget incl. a label or children of a hbox. * Do not wrap content of a single widget incl. a label or children of a hbox.