Skip to content

Commit

Permalink
fix setting zoned timers
Browse files Browse the repository at this point in the history
  • Loading branch information
rand256 committed Jul 23, 2019
1 parent de46277 commit 8b0172c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions client/settings-timers.html
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@
if (res == null || res.length == 0) {
timersList.firstElementChild.style.display = "";
} else {
let index = 0;
res.forEach(function (timer) {
if (zoned) timer.id = index++;
//ADD EDIT (equals create new + delete!)
var elem = ons.createElement(
"<ons-list-item data-id='" + timer.id + "'>\n" +
Expand All @@ -478,11 +480,11 @@
);

elem.querySelector('.timer-active-switch').addEventListener('change', function (event) {
toggleTimer(timer.id, event.value);
toggleTimer(timer.id, event.value, zoned);
});

elem.querySelector('.timer-delete').addEventListener('click', function (event) {
deleteTimer(timer.id);
deleteTimer(timer.id, zoned);
});

timersList.appendChild(elem);
Expand Down Expand Up @@ -527,7 +529,7 @@
});
}

function deleteTimer(id,zoned) {
function deleteTimer(id, zoned) {
zoned = zoned || false;
disableTimerInputElements(zoned);
ons.notification.confirm('Do you really want to delete this timer?').then(function (answer) {
Expand Down

0 comments on commit 8b0172c

Please sign in to comment.