-
Notifications
You must be signed in to change notification settings - Fork 50
Refactor thanks pages and a little bit of the self service page #331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
18964be
6c3ba9b
a1881a5
0523a84
f7573c2
937d3de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,20 +9,12 @@ | |
| <div class="wrapper single-column offset-top"> | ||
| <div class="bannerbox"> | ||
| <div class="bannerbox__content"> | ||
| <h1 id="thanks-header">Thank you</h1> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we keep the id for the h1 element until after Nov 7, please? The automated tests use it.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, let's update the tests when we merge after Nov 7. |
||
| <span id="sorryHeading" hidden style="display:none">We are sorry</span> | ||
|
|
||
| <p id="introPara">for offering a fellow American a ride to claim their vote! Together, our driving volunteers could help shape the outcome of this election.</p> | ||
| <span id="sorryPara" hidden style="display:none">It has not been possible to process your request. Please see the information below for more details. We want to help you to volunteer, so please contact our phone support if you cannot resolve this issue yourself.</span> | ||
|
|
||
| <div id="responseDetails" hidden style="display:none"> | ||
| <p>Response code: <b id="responseCode" class="uuid"></b></p> | ||
| <p>Response info: <b id="responseText" class="uuid"></b></p> | ||
| </div> | ||
|
|
||
| <div id="requestSuccessInfo"> | ||
| <div id="thanks"> | ||
| <h1>Thank you</h1> | ||
| <p>Thanks for offering a fellow American a ride to claim their vote! Together, our driving volunteers could help shape the outcome of this election.</p> | ||
| <p>We've sent you a message confirming that we've received your offer.</p> | ||
| <p>Your driver offer reference number is: <b class="uuid">ID not loaded, please try again</b>.</p> | ||
| <p><strong>If you do not receive a message via email, please check your spam folder.</strong></p> | ||
| <p>Your driver offer reference number is: <b class="uuid uuid--large">ID not loaded, please try again</b></p> | ||
| <p>Please <strong>keep this reference</strong> in case you need to manage your ride request.</p> | ||
| <p>To view or manage your matches, visit our <b><a class="self-service-url" href="../self-service/?type=driver">self-service portal</a></b>.</p> | ||
|
|
||
|
|
@@ -31,16 +23,21 @@ <h2>What happens next?</h2> | |
| <p>Once you have accepted a ride request, we'll send you a message with the rider's contact details. It's then up the you and the rider to arrange when and where you'd like to meet, and any other details of your trip.</p> | ||
|
|
||
| <p>Let your friends know!</p> | ||
|
|
||
| <ul class="social"> | ||
| <li role="presentation" class="social__twitter"> | ||
| <a href="https://twitter.com/intent/tweet" class="twitter-mention-button" data-text="I've signed up to offer a ride to a fellow American on @CarpoolVote. #Election2016 will be close. #CountEveryVote" data-related="" data-url="http://carpoolvote.com" data-show-count="false">Tweet to help others find out about this!</a> | ||
| </li> | ||
| <li role="presentation" class="social__facebook"> | ||
| <div class="fb-share-button" data-href="http://carpoolvote.com?v=1" data-layout="button"></div> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
|
|
||
| <ul class="social"> | ||
| <li role="presentation" class="social__twitter"> | ||
| <a href="https://twitter.com/intent/tweet" class="twitter-mention-button" data-text="I've signed up to offer a ride to a fellow American on @CarpoolVote. #Election2016 will be close. #CountEveryVote" data-related="" data-url="http://carpoolvote.com" data-show-count="false">Tweet to help others find out about this!</a> | ||
| </li> | ||
| <li role="presentation" class="social__facebook"> | ||
| <div class="fb-share-button" data-href="http://carpoolvote.com?v=1" data-layout="button"></div> | ||
| </li> | ||
| </ul> | ||
| <div id="sorry" style="display:none"> | ||
| <h1>We are sorry</h1> | ||
| <p>It has not been possible to process your request. Please see the information below for more details. We want to help you to volunteer, so please contact our phone support <a href="tel:5406569388">540-656-9388</a> if you cannot resolve this issue yourself.</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,40 +9,35 @@ | |
| <div class="wrapper single-column offset-top"> | ||
| <div class="bannerbox"> | ||
| <div class="bannerbox__content"> | ||
| <h1 id="thanks-header">Congratulations</h1> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we keep the id for the h1 element until after Nov 7, please? The automated tests use it.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, let's update the tests when we merge after Nov 7. |
||
| <span id="sorryHeading" hidden style="display:none">We are sorry</span> | ||
|
|
||
| <p id="introPara"> | ||
| on taking this step to claim your vote! We’ve sent you a message confirming that we’ve received your request. | ||
| <br><br> | ||
| <em><strong>If you do not receive a message via email, please check your spam folder.</strong></em> | ||
| </p> | ||
| <span id="sorryPara" hidden style="display:none">It has not been possible to process your request. Please see the information below for more details. We want to help you, so please contact our phone support if you cannot resolve this issue yourself.</span> | ||
| <div id="thanks"> | ||
| <h1>Congratulations</h1> | ||
| <p>Congratulations on taking this step to claim your vote! We’ve sent you a message confirming that we’ve received your request.</p> | ||
| <p><strong>If you do not receive a message via email, please check your spam folder.</strong></p> | ||
|
|
||
| <div id="responseDetails" hidden style="display:none"> | ||
| <p>Response code: <b id="responseCode" class="uuid"></b></p> | ||
| <p>Response info: <b id="responseText" class="uuid"></b></p> | ||
| </div> | ||
|
|
||
| <div id="requestSuccessInfo"> | ||
| <p>Your ride request reference number is: <b class="uuid">ID not loaded, please try again</b>.</p> | ||
| <p>Your ride request reference number is: <b class="uuid uuid--large">ID not loaded, please try again</b></p> | ||
| <p>Please <strong>keep this reference</strong> in case you need to manage your ride request.</p> | ||
| <p>To view or manage your ride request, visit our <b><a class="self-service-url" href="../self-service/?type=rider">self-service portal</a></b>.</p> | ||
|
|
||
| <h2>What happens next?</h2> | ||
| <p>Our system will match you with potential drivers, based on the information you’ve provided. We'll let you know as soon as a driver has accepted your request.</p> | ||
| <p>The driver will then get in touch with you through the preferred method of contact you specified on the form. It's then up the you and the driver to arrange when and where you'd like to meet, and any other details of your trip.</p> | ||
|
|
||
| <p>Let your friends know!</p> | ||
|
|
||
| <ul class="social"> | ||
| <li role="presentation" class="social__twitter"> | ||
| <a href="https://twitter.com/intent/tweet" class="twitter-mention-button" data-text="I’ve signed up for a ride to #ClaimMyVote on @CarpoolVote. #Election2016 will be close. #CountEveryVote" data-related="" data-url="http://carpoolvote.com" data-show-count="false">Tweet to help others find out about this!</a> | ||
| </li> | ||
| <li role="presentation" class="social__facebook"> | ||
| <div class="fb-share-button" data-href="http://carpoolvote.com?v=1" data-layout="button"></div> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
|
|
||
| <ul class="social"> | ||
| <li role="presentation" class="social__twitter"> | ||
| <a href="https://twitter.com/intent/tweet" class="twitter-mention-button" data-text="I’ve signed up for a ride to #ClaimMyVote on @CarpoolVote. #Election2016 will be close. #CountEveryVote" data-related="" data-url="http://carpoolvote.com" data-show-count="false">Tweet to help others find out about this!</a> | ||
| </li> | ||
| <li role="presentation" class="social__facebook"> | ||
| <div class="fb-share-button" data-href="http://carpoolvote.com?v=1" data-layout="button"></div> | ||
| </li> | ||
| </ul> | ||
| <div id="sorry" style="display:none"> | ||
| <h1>We are sorry</h1> | ||
| <p>It has not been possible to process your request. Please see the information below for more details. We want to help you, so please contact our phone support on <a href="tel:5406569388">540-656-9388</a> if you cannot resolve this issue yourself.</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,9 +32,9 @@ if (data.uuid_rider) { | |
| // Cache jQuery selectors: | ||
| var $login = $('#login'), | ||
| $manage = $('#manage'), | ||
| $info = $('#manage #infoAdmin'), | ||
| $info = $manage.find('#infoAdmin'), | ||
| $manageLogin = $('#manageLogin'), | ||
| $infoLogin = $('#manageLogin #infoLogin') | ||
| $infoLogin = $manageLogin.find('#infoLogin') | ||
| ; | ||
|
|
||
|
|
||
|
|
@@ -68,25 +68,23 @@ $login.validator().on('submit', function(e) { | |
| riderExists(); | ||
| } | ||
|
|
||
| // done in driver exists | ||
| // | ||
| // $(this).slideUp(300).attr('aria-hidden','true'); | ||
| // $manage.slideDown(300).attr('aria-hidden','false'); | ||
| // updateUI(); | ||
| e.preventDefault(); | ||
| }); | ||
|
|
||
| function updateUI(uuid, type, phone) { | ||
| // Hide login form and show user info | ||
| $login.slideUp(300).attr('aria-hidden','true'); | ||
| $manage.slideDown(300).attr('aria-hidden','false'); | ||
|
|
||
| // NOTE: this handling isn't quite correct, so avoid refactoring without full testing | ||
| var dataTypeDriver = data.type === 'driver'; | ||
| var dataTypeRider = data.type === 'rider'; | ||
|
|
||
| $manage.find('#btnCancelDriveOffer').toggle(dataTypeDriver); | ||
| $manage.find('#btnPauseDriverMatch').toggle(dataTypeDriver); | ||
| $manage.find('#btnCancelDriverMatch').toggle(dataTypeRider && data.uuid_driver !== undefined && data.score !== 'undefined'); | ||
| $manage.find('#btnCancelMatch').toggle(data.uuid_driver !== undefined && data.score !== 'undefined'); | ||
|
|
||
| $manage.find('#btnCancelRideRequest').toggle(dataTypeRider); | ||
| $manage.find('#btnCancelRiderMatch').toggle(dataTypeRider && data.uuid_driver !== undefined && data.score !== 'undefined'); | ||
|
|
||
| $manage.find('#btnAcceptDriverMatch').toggle(dataTypeRider && data.uuid_driver !== undefined && data.score !== 'undefined'); | ||
| } | ||
|
|
@@ -110,30 +108,14 @@ function updateUIbyRiderStatus (riderStatus) { | |
|
|
||
| $manage | ||
| .on('click', '#btnCancelRideRequest', cancelRideRequest) | ||
| .on('click', '#btnCancelRiderMatch', cancelRiderMatch) | ||
| .on('click', '#btnCancelMatch', cancelMatch) | ||
| .on('click', '#btnCancelDriveOffer', cancelDriveOffer) | ||
| .on('click', '#btnCancelDriverMatch', cancelDriverMatch) | ||
| .on('click', '#btnPauseDriverMatch', pauseDriverMatch) | ||
| .on('click', '#btnAcceptDriverMatch', acceptDriverMatch) | ||
| .on('click', '#logout', logout); | ||
|
|
||
|
|
||
| function cancelRiderMatch() { | ||
| if (!window.confirm('This will cancel your ride match. Are you sure you want to proceed?')) { | ||
| return; | ||
| } | ||
| sendAjaxRequest( | ||
| { | ||
| UUID_driver: data.uuid_driver, | ||
| UUID_rider: data.uuid, | ||
| Score: data.score, | ||
| RiderPhone: data.phone | ||
| }, | ||
| '/cancel-rider-match' | ||
| ); | ||
| } | ||
|
|
||
| function cancelDriverMatch() { | ||
| function cancelMatch() { | ||
| if (!window.confirm('This will cancel your ride match. Are you sure you want to proceed?')) { | ||
| return; | ||
| } | ||
|
|
@@ -144,7 +126,7 @@ function cancelDriverMatch() { | |
| Score: data.score, | ||
| RiderPhone: data.phone | ||
| }, | ||
| '/cancel-driver-match' | ||
| '/cancel-' + data.type + '-match' | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -225,8 +207,6 @@ function driverExists () { | |
| if (keys[0] == "driver_exists" && info === "") { | ||
| driverLoggedIn = true; | ||
|
|
||
| $(this).slideUp(300).attr('aria-hidden','true'); | ||
| $manage.slideDown(300).attr('aria-hidden','false'); | ||
| updateUI(); | ||
|
|
||
| clearDriverInfo (); | ||
|
|
@@ -619,8 +599,6 @@ function riderExists () { | |
| if (keys[0] == "rider_exists" && info === "") { | ||
| riderLoggedIn = true; | ||
|
|
||
| $(this).slideUp(300).attr('aria-hidden','true'); | ||
| $manage.slideDown(300).attr('aria-hidden','false'); | ||
| updateUI(); | ||
|
|
||
| clearRiderInfo (); | ||
|
|
@@ -799,20 +777,7 @@ function cancelRideRequest() { | |
| } | ||
|
|
||
| function createAPIurl (params, apiRoute) { | ||
| var url = ""; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this change might reflect our different coding styles. The tq lib is fantastic for changing the banners on the site for different partners, but I find when I come back to this code after a break, that it is slower for me to work out what is happening from the tq function name (set()) than reading some code. Usually, I have to find the library code and read that.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted, thanks! I just felt it would help simplify things. The library is already included so I thought, why not use it? The documentation is here: https://github.com/richardwestenra/tiny-query-string#set - it's linked to from the file where the library is included. I guess the method name isn't as clear as it could've been - what would you have called it?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @richardwestenra This just feels like a coding style thing, to me, which is absolutely fine. My style, in the lack of a framework (not inherently an issue), is just to use the standard browser API throughout this page. For me, that API is widely documented and doesn’t give contributors anything new to learn. Still, there are at least two sides to that debate. My general thoughts are the code should suit whoever is mostly taking ownership of the page. If that will be you, great, go ahead and make use of any libraries that can help. The name should match the behaviour if possible. I wasn’t sure if there were any side-effects to the lib function, and so issues arise if called twice before a call, etc? |
||
|
|
||
| var keys = Object.keys(params); | ||
|
|
||
| keys.forEach(function (key, idx) { | ||
| if (idx > 0) { | ||
| url += "&"; | ||
| } | ||
| url += key + "=" + params[key].toString(); | ||
| }); | ||
|
|
||
| url = remoteUrl + apiRoute + "?" + url; | ||
|
|
||
| return url; | ||
| return tinyQuery.set(params, remoteUrl + apiRoute); | ||
| } | ||
|
|
||
| function accessCarpoolvoteAPI (url, handlerFunction) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,15 @@ | ||
| var data = tinyQuery.getAll(); | ||
| var queryStringData = tinyQuery.getAll(); | ||
|
|
||
| var heading = document.getElementById("thanks-header"); | ||
| var introPara = document.getElementById("introPara"); | ||
| var successInfo = document.getElementById("requestSuccessInfo"); | ||
| var responseDetails = document.getElementById("responseDetails"); | ||
| var responseCode = document.getElementById("responseCode"); | ||
| var responseText = document.getElementById("responseText"); | ||
| if (queryStringData.code !== '0') { | ||
| $('#thanks').hide(); | ||
|
|
||
| var headingFailureText = document.getElementById("sorryHeading").innerHTML; | ||
| var paraFailureText = document.getElementById("sorryPara").innerHTML; | ||
| var responseInfo = ['code', 'info'].filter(function(d) { | ||
| return queryStringData[d]; | ||
| }) | ||
| .map(function(d) { | ||
| return '<p><small>Response ' + d + ': <b>' + queryStringData[d] + '</b></small></p>'; | ||
| }) | ||
| .join(''); | ||
|
|
||
| if (data.code != "0") { | ||
| heading.innerHTML = headingFailureText; | ||
| introPara.innerHTML = paraFailureText; | ||
|
|
||
| successInfo.setAttribute("hidden", "hidden"); | ||
| successInfo.setAttribute("style", "display:none"); | ||
|
|
||
| responseDetails.removeAttribute("hidden"); | ||
| responseDetails.setAttribute("style", ""); | ||
|
|
||
| responseCode.innerHTML = data.code; | ||
| responseText.innerHTML = data.info; | ||
| $('#sorry').show().append(responseInfo); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This merging of the two cancel functions and buttons looks like a very promising refactor. I've probably not got time to check it before the Nov 7 election, and the changes to element ids may stop my automated tests from working. With the limited time and support team numbers, I'd like to keep those tests going if possible. Can we put this change to one side until after Nov 7, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let's update the tests when we merge after Nov 7.