Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
Use new date_due_not_defined and date_started_not_defined to show "gr…
Browse files Browse the repository at this point in the history
…ay" border instead of a completely black element
  • Loading branch information
oliviermaridat authored and fguillot committed Feb 21, 2018
1 parent d4114a0 commit 815c869
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
47 changes: 25 additions & 22 deletions Assets/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,6 @@ Gantt.prototype.getVerticalHeaderTooltip = function(record) {
Gantt.prototype.getBarTooltip = function(record) {
var tooltip = "";

if (record.not_defined) {
tooltip = $(this.options.container).data("label-not-defined");
}
else {
if (record.type == "task") {
var assigneeLabel = $(this.options.container).data("label-assignee");
tooltip += jQuery("<strong>").text('#'+record.id+' '+record.title+' ('+record.progress+')').prop('outerHTML');
Expand All @@ -262,36 +258,43 @@ Gantt.prototype.getBarTooltip = function(record) {
tooltip += "<br>";
}

if (record.not_defined) {
tooltip += jQuery("<i>").text($(this.options.container).data("label-not-defined")).prop('outerHTML');
tooltip += "<br>";
}
tooltip += $(this.options.container).data("label-start-date") + " " + $.datepicker.formatDate('yy-mm-dd', record.start) + "<br/>";
tooltip += $(this.options.container).data("label-end-date") + " " + $.datepicker.formatDate('yy-mm-dd', record.end);
}

return tooltip;
};

// Set bar color
Gantt.prototype.setBarColor = function(block, record) {
block.css("background-color", record.color.background);
block.css("border-color", record.color.border);
if (record.not_defined) {
block.addClass("ganttview-block-not-defined");
}
else {
block.css("background-color", record.color.background);
block.css("border-color", record.color.border);

if (record.progress != "0%") {
block.append(jQuery("<div>", {
"css": {
"z-index": 0,
"position": "absolute",
"top": 0,
"bottom": 0,
"background-color": record.color.border,
"width": record.progress,
"opacity": 0.4
}
}));
if (record.date_started_not_defined) {
block.css("border-left", "2px solid gray");
}
if (record.date_due_not_defined) {
block.css("border-right", "2px solid gray");
}
}

if (record.progress != "0%") {
block.append(jQuery("<div>", {
"css": {
"z-index": 0,
"position": "absolute",
"top": 0,
"bottom": 0,
"background-color": record.color.border,
"width": record.progress,
"opacity": 0.4
}
}));
}
};

// Setup jquery-ui resizable
Expand Down
5 changes: 0 additions & 5 deletions Assets/gantt.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ div.ganttview-block {
cursor: move;
}

div.ganttview-block-not-defined {
border-color: #000;
background-color: #000;
}

div.ganttview-block-text {
position: absolute;
height: 12px;
Expand Down
4 changes: 3 additions & 1 deletion Formatter/TaskGanttFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TaskGanttFormatter extends BaseFormatter implements FormatterInterface
* @var array
*/
private $columns = array();

/**
* Apply formatter
*
Expand Down Expand Up @@ -74,6 +74,8 @@ private function formatTask(array $task)
'link' => $this->helper->url->href('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])),
'color' => $this->colorModel->getColorProperties($task['color_id']),
'not_defined' => empty($task['date_due']) || empty($task['date_started']),
'date_started_not_defined' => empty($task['date_started']),
'date_due_not_defined' => empty($task['date_due']),
);
}
}

0 comments on commit 815c869

Please sign in to comment.