Working on time tracker

This commit is contained in:
Hillel Coren 2017-09-26 10:19:33 +03:00
parent 50fdf31121
commit 63c1e651cc
2 changed files with 21 additions and 0 deletions

View File

@ -421,6 +421,7 @@
}
ko.applyBindings(model);
model.refreshTitle();
model.tock();
if (isStorageSupported()) {

View File

@ -30,6 +30,23 @@
location.reload();
}
self.refreshTitle = function() {
var tasks = self.tasks();
var count = 0;
for (var i=0; i<tasks.length; i++) {
var task = tasks[i];
if (task.isRunning()) {
count++;
}
}
var title = '';
if (count > 0) {
title = '(' + count + ') ';
}
title += "{{ trans('texts.time_tracker') }} | {{ APP_NAME }}";
document.title = title;
}
self.submitBulkAction = function(action, task) {
if (! task || ! action) {
return false;
@ -53,6 +70,7 @@
self.selectTask(false);
$('#search').focus();
}
self.refreshTitle();
if (action == 'archive') {
toastr.success("{{ trans('texts.archived_task') }}");
} else if (action == 'delete') {
@ -185,6 +203,7 @@
task.addTime(time);
self.selectedTask(task);
self.addTask(task);
model.refreshTitle();
self.filter('');
task.focus();
}
@ -480,6 +499,7 @@
toastr.success("{{ trans('texts.stopped_task') }}");
}
}
model.refreshTitle();
setTimeout(function() {
model.isStartEnabled(true);
}, 1000);