Handle task duration change before focusout

This commit is contained in:
Hillel Coren 2017-12-02 23:39:55 +02:00
parent 75260b6fd3
commit 0aa0fb859e

View File

@ -125,7 +125,7 @@
</div> </div>
</td> </td>
<td style="padding: 0px 12px 12px 0 !important; width:100px"> <td style="padding: 0px 12px 12px 0 !important; width:100px">
<input type="text" data-bind="value: duration.pretty, visible: !isEmpty(), valueUpdate: 'afterkeydown'" class="form-control duration"></div> <input type="text" data-bind="value: duration.pretty, visible: !isEmpty()" class="form-control duration"></div>
<a href="#" data-bind="click: function() { setNow(), $root.refresh() }, visible: isEmpty()">{{ trans('texts.set_now') }}</a> <a href="#" data-bind="click: function() { setNow(), $root.refresh() }, visible: isEmpty()">{{ trans('texts.set_now') }}</a>
</td> </td>
<td style="width:30px" class="td-icon"> <td style="width:30px" class="td-icon">
@ -352,11 +352,6 @@
self.duration.pretty = ko.computed({ self.duration.pretty = ko.computed({
read: function() { read: function() {
// handle the input being changed and the form is submitted before focus out
if ($("input.duration").is(":focus")) {
return $("input.duration").val();
}
var duration = false; var duration = false;
var start = self.startTime(); var start = self.startTime();
var end = self.endTime(); var end = self.endTime();
@ -541,6 +536,13 @@
showTimeDetails(); showTimeDetails();
@endif @endif
$('input.duration').keydown(function(event){
if (event.keyCode == 13) {
event.preventDefault();
return false;
}
});
// setup clients and project comboboxes // setup clients and project comboboxes
var clientId = {{ $clientPublicId }}; var clientId = {{ $clientPublicId }};
var projectId = {{ $projectPublicId }}; var projectId = {{ $projectPublicId }};