diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-11-02 21:35:53 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-11-02 21:35:53 +0100 |
commit | f87306dc34e91ade3e55d67ac776fd5c7fd3bb15 (patch) | |
tree | 47be4ecfc7539b1abecb7198f4d8c8d0b9611755 /public/static/js | |
parent | 6933b8ee45bee33562ac3bf9cd864e6d09e6917b (diff) |
allow undo for checkins
Diffstat (limited to 'public/static/js')
-rw-r--r-- | public/static/js/travelynx-actions.js | 7 | ||||
-rw-r--r-- | public/static/js/travelynx-actions.min.js | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js index 70c5d39..86ad87d 100644 --- a/public/static/js/travelynx-actions.js +++ b/public/static/js/travelynx-actions.js @@ -39,4 +39,11 @@ $(document).ready(function() { link.data('force', true); }); }); + $('.action-undo').click(function() { + var link = $(this); + var req = { + action: 'undo', + }; + tvly_run(link, req, window.location.href); + }); }); diff --git a/public/static/js/travelynx-actions.min.js b/public/static/js/travelynx-actions.min.js index 2ecfe38..0393b42 100644 --- a/public/static/js/travelynx-actions.min.js +++ b/public/static/js/travelynx-actions.min.js @@ -1 +1 @@ -function tvly_run(t,a,n,i){var c='<i class="material-icons">error</i>',o=$('<div class="progress"><div class="indeterminate"></div></div>');t.hide(),t.after(o),$.post("/action",a,function(a){a.success?$(location).attr("href",n):(M.toast({html:c+" "+a.error}),o.remove(),i&&i(),t.append(" "+c),t.show())})}$(document).ready(function(){$(".action-checkin").click(function(){var t=$(this);tvly_run(t,{action:"checkin",station:t.data("station"),train:t.data("train")},"/")}),$(".action-checkout").click(function(){var t=$(this),a={action:"checkout",station:t.data("station"),force:t.data("force")};tvly_run(t,a,"/"+a.station,function(){t.append(" – Keine Echtzeitdaten vorhanden"),t.data("force",!0)})})}); +function tvly_run(t,n,i,a){var c='<i class="material-icons">error</i>',o=$('<div class="progress"><div class="indeterminate"></div></div>');t.hide(),t.after(o),$.post("/action",n,function(n){n.success?$(location).attr("href",i):(M.toast({html:c+" "+n.error}),o.remove(),a&&a(),t.append(" "+c),t.show())})}$(document).ready(function(){$(".action-checkin").click(function(){var t=$(this);tvly_run(t,{action:"checkin",station:t.data("station"),train:t.data("train")},"/")}),$(".action-checkout").click(function(){var t=$(this),n={action:"checkout",station:t.data("station"),force:t.data("force")};tvly_run(t,n,"/"+n.station,function(){t.append(" – Keine Echtzeitdaten vorhanden"),t.data("force",!0)})}),$(".action-undo").click(function(){tvly_run($(this),{action:"undo"},window.location.href)})}); |