Commit 5a5b06de authored by Phil Hughes's avatar Phil Hughes

Fixed task status with mobile

parent 5a95d6f8
...@@ -56,19 +56,25 @@ ...@@ -56,19 +56,25 @@
}); });
}, },
taskStatus() { taskStatus() {
const $issueableHeader = $('.issuable-header'); const taskRegexMatches = this.taskStatus.match(/(\d+) of (\d+)/);
const $issueableHeader = $('.issuable-meta');
let $tasks = $('#task_status'); let $tasks = $('#task_status');
let $tasksShort = $('#task_status_short'); let $tasksShort = $('#task_status_short');
if (this.taskStatus.indexOf('0 of 0') >= 0) { if (this.taskStatus.indexOf('0 of 0') >= 0 || this.taskStatus.trim() === '') {
$tasks.remove(); $tasks.remove();
$tasksShort.remove(); $tasksShort.remove();
} else if (!$tasks.length && !$tasksShort.length) { } else if (!$tasks.length && !$tasksShort.length) {
$tasks = $issueableHeader.append('<span id="task_status"></span>'); $tasks = $issueableHeader.append('<span id="task_status" class="hidden-xs hidden-sm"></span>')
$tasksShort = $issueableHeader.append('<span id="task_status_short"></span>'); .find('#task_status');
$tasksShort = $issueableHeader.append('<span id="task_status_short" class="hidden-md hidden-lg"></span>')
.find('#task_status_short');
} }
$tasks.text(this.taskStatus); if (taskRegexMatches) {
$tasks.text(this.taskStatus);
$tasksShort.text(`${taskRegexMatches[1]}/${taskRegexMatches[2]} task${taskRegexMatches[2] > 1 ? 's' : ''}`);
}
}, },
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment