From 01df965d66fa7223e98036908ed4f60dda5942f8 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 19 Mar 2019 18:20:05 +0100 Subject: support logging of cancelled journeys --- public/static/css/local.css | 4 +++- public/static/js/travelynx-actions.js | 20 +++++++++++++++++++- public/static/js/travelynx-actions.min.js | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'public') diff --git a/public/static/css/local.css b/public/static/css/local.css index 7502b64..68f9ab1 100644 --- a/public/static/css/local.css +++ b/public/static/css/local.css @@ -1,6 +1,8 @@ .action-checkin, .action-checkout, -.action-undo { +.action-undo, +.action-cancelled-from, +.action-cancelled-to { cursor: pointer; } 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='error',o=$('
');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='error',o=$('
');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},"/")})}); -- cgit v1.2.3