Working on time tracker

This commit is contained in:
Hillel Coren 2017-09-25 09:27:55 +03:00
parent d7371aed2b
commit 6c5dc29749
3 changed files with 21 additions and 6 deletions

View File

@ -2455,6 +2455,7 @@ $LANG = array(
'no_description' => 'No Description',
'time_tracker_login' => 'Time Tracker Login',
'save_or_discard' => 'Please save or discard your changes',
'discard_changes' => 'Discard Changes',
);

View File

@ -362,14 +362,20 @@
model.onArchiveClick();
});
/*
$(window).on('beforeunload', function () {
console.log('beforeunload');
if (model.selectedTask() && model.formChanged()) {
console.log('changed');
swal("{{ trans('texts.save_or_discard') }}");
return false;
//return trans('texts.save_or_discard');
} else {
console.log('not changed');
return undefined;
}
});
*/
/*
$( window ).scroll(function() {

View File

@ -85,7 +85,7 @@
task.update(task.data);
}
self.formChanged(false);
});
}, "{{ trans('texts.discard_changes') }}");
return false;
}
@ -430,9 +430,11 @@
for (var i=0; i<parts.length; i++) {
var part = parts[i];
var isMatch = false;
if (self.description()) {
if (self.description().toLowerCase().indexOf(part) >= 0) {
isMatch = true;
}
}
if (self.project()) {
var projectName = self.project().name();
if (projectName && projectName.toLowerCase().indexOf(part) >= 0) {
@ -457,7 +459,6 @@
return false;
}
self.isStartEnabled(false);
if (self.isRunning()) {
var data = 'is_running=0&';
var time = self.lastTime();
@ -468,8 +469,12 @@
time.startTime(moment().unix());
self.addTime(time);
}
if (self.public_id()) {
self.isStartEnabled(false);
self.save(data + 'time_log=' + JSON.stringify(self.times()));
}
}
self.listItemState = ko.computed(function() {
var str = '';
@ -515,6 +520,9 @@
});
self.description.truncated = ko.computed(function() {
if (! self.description()) {
return '';
}
return truncate(self.description(), self.actionButtonVisible() ? 35 : 60);
});