diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-03-19 18:20:05 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-03-19 18:20:05 +0100 |
commit | 01df965d66fa7223e98036908ed4f60dda5942f8 (patch) | |
tree | 9a7efc5a2d1025305c8a3ccd54333ff8e39e87fb /public/static/js | |
parent | e24f89530376641f56d3b037c2a7dcd485b1ccd8 (diff) |
support logging of cancelled journeys
Diffstat (limited to 'public/static/js')
-rw-r--r-- | public/static/js/travelynx-actions.js | 20 | ||||
-rw-r--r-- | public/static/js/travelynx-actions.min.js | 2 |
2 files changed, 20 insertions, 2 deletions
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js index 0a3d092..d47df77 100644 --- a/public/static/js/travelynx-actions.js +++ b/public/static/js/travelynx-actions.js @@ -44,6 +44,24 @@ $(document).ready(function() { var req = { action: 'undo', }; - tvly_run(link, req, window.location.href); + tvly_run(link, req, '/'); + }); + $('.action-cancelled-from').click(function() { + var link = $(this); + var req = { + action: 'cancelled_from', + station: link.data('station'), + train: link.data('train'), + }; + tvly_run(link, req, '/'); + }); + $('.action-cancelled-to').click(function() { + var link = $(this); + var req = { + action: 'cancelled_to', + station: link.data('station'), + force: true, + }; + tvly_run(link, req, '/'); }); }); diff --git a/public/static/js/travelynx-actions.min.js b/public/static/js/travelynx-actions.min.js index 9c37d8d..4fe0e76 100644 --- a/public/static/js/travelynx-actions.min.js +++ b/public/static/js/travelynx-actions.min.js @@ -1 +1 @@ -function tvly_run(n,t,i,a){var c='<i class="material-icons">error</i>',o=$('<div class="progress"><div class="indeterminate"></div></div>');n.hide(),n.after(o),$.post("/action",t,function(t){t.success?$(location).attr("href",i):(M.toast({html:c+" "+t.error}),o.remove(),a&&a(),n.append(" "+c),n.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,"/s/"+n.station,function(){t.append(" – Ohne Echtzeitdaten auschecken?"),t.data("force",!0)})}),$(".action-undo").click(function(){tvly_run($(this),{action:"undo"},window.location.href)})}); +function tvly_run(n,t,a,c){var i='<i class="material-icons">error</i>',o=$('<div class="progress"><div class="indeterminate"></div></div>');n.hide(),n.after(o),$.post("/action",t,function(t){t.success?$(location).attr("href",a):(M.toast({html:i+" "+t.error}),o.remove(),c&&c(),n.append(" "+i),n.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,"/s/"+n.station,function(){t.append(" – Ohne Echtzeitdaten auschecken?"),t.data("force",!0)})}),$(".action-undo").click(function(){tvly_run($(this),{action:"undo"},"/")}),$(".action-cancelled-from").click(function(){var t=$(this);tvly_run(t,{action:"cancelled_from",station:t.data("station"),train:t.data("train")},"/")}),$(".action-cancelled-to").click(function(){var t=$(this);tvly_run(t,{action:"cancelled_to",station:t.data("station"),force:!0},"/")})}); |