Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixed title for submitting with enter
  • Loading branch information
Harm Akkerman committed Aug 20, 2022
commit baae5a744eb1c937f38b2b92e1b6843de525c62d
15 changes: 9 additions & 6 deletions js/src/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,17 +580,20 @@ function() {
}

function createWorkItem() {
$('#work-input').val($(this).data('work-name'));
startTimer($(this).data('projectid'), $(this).data('tagids'));
var wiPlay = $('.wi-play');
var workName = $('#work-input').val();

$('#work-input').val(wiPlay.data('work-name'));
startTimer(wiPlay.data('projectid'), wiPlay.data('tagids'), workName);
return false;
}

function startTimer(projectId = null, tags = ""){
function startTimer(projectId = null, tags = "", inputWorkName = null){
if(localStorage.getItem('isTimerStarted') === 'true'){
stopTimer(startTimer, [projectId, tags]);
stopTimer(startTimer, [projectId, tags, inputWorkName]);
return;
}
var workName = $('#work-input').val();
var workName = inputWorkName ?? $('#work-input').val();
if (workName == ''){
workName = 'no description';
}
Expand Down Expand Up @@ -630,7 +633,7 @@ function() {
localStorage.setItem('isTimerStarted', false);
$('#start-tracking > span').addClass("play-button").removeClass("stop-button");
if (onStopped != null){
onStopped(args[0], args[1]);
onStopped(...args);
} else {
getWorkItems();
}
Expand Down