-
Notifications
You must be signed in to change notification settings - Fork 1
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
Post feedback to feedback api #303
Conversation
d4263b0
to
3b7f2ec
Compare
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.
Appreciate you didn't write any of this code but let's try and tidy up what's left
- Replace all global
var
with eitherconst
orlet
- Prefix all jQuery objects with a $
js/app/improve-this-page.js
Outdated
feedbackURL = feedbackOrigin + feedbackURL; | ||
} | ||
|
||
var feedbackURL = document.querySelector("#feedback-api-url").value; |
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.
Replace the var
with const
and prefix jQuery objects with a $
var feedbackURL = document.querySelector("#feedback-api-url").value; | |
const $feedbackURL = document.querySelector("#feedback-api-url").value; |
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.
Done
58a916a
to
e86623b
Compare
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.
Some unnecessary whitespace needs removing - double check the hooks on some as the space between selectors will be required
js/app/improve-this-page.js
Outdated
} | ||
e.preventDefault(); | ||
|
||
let id = $(this).attr("id"); |
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.
let id = $(this).attr("id"); | |
let $id = $(this).attr("id"); |
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.
Done
js/app/improve-this-page.js
Outdated
hasErrors = true | ||
} | ||
e.preventDefault(); | ||
let $emailField = $(" #email-field "); |
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.
whitespace?
let $emailField = $(" #email-field "); | |
let $emailField = $("#email-field"); |
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.
Done
js/app/improve-this-page.js
Outdated
} | ||
e.preventDefault(); | ||
let $emailField = $(" #email-field "); | ||
let $nameField = $(" #name-field "); |
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.
whitespace
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.
Done
js/app/improve-this-page.js
Outdated
e.preventDefault(); | ||
let $emailField = $(" #email-field "); | ||
let $nameField = $(" #name-field "); | ||
let $descriptionField = $(" #description-field "); |
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.
whitespace
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.
Done
js/app/improve-this-page.js
Outdated
let $descriptionField = $(" #description-field "); | ||
$descriptionField.removeClass("form-control__error"); | ||
$emailField.removeClass("form-control__error"); | ||
$(" .form-error ").each(function () { |
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.
more whitespace
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.
Done
js/app/improve-this-page.js
Outdated
let hasErrors = false; | ||
|
||
if ($descriptionField.val() === "") { | ||
let descriptionError = |
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.
think this can be a const
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.
Done
js/app/improve-this-page.js
Outdated
if ($descriptionField.val() === "") { | ||
let descriptionError = | ||
'<span class="form-error" role="alert">Write some feedback</span>'; | ||
if (!$(" #description-field-label .form-error").length) { |
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.
more whitespace
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.
Done
b0a0e27
to
0fddf0e
Compare
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.
Last minor amends 👍
js/app/improve-this-page.js
Outdated
feedbackURL = feedbackOrigin + feedbackURL; | ||
} | ||
const pageURL = window.location.href; | ||
const $feedbackURL = document.querySelector("#feedback-api-url").value; |
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 isn't actually a jQuery object (sorry!)
const $feedbackURL = document.querySelector("#feedback-api-url").value; | |
const feedbackURL = document.querySelector("#feedback-api-url").value; |
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.
Done
js/app/improve-this-page.js
Outdated
|
||
if (!emailReg.test($email)) { | ||
if (!$("#email-field-label .form-error").length) { | ||
$("#email-field-label ").append(emailError); |
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.
Whitespace
$("#email-field-label ").append(emailError); | |
$("#email-field-label").append(emailError); |
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.
Done
8221bdb
to
bc2c02c
Compare
What
dp-feedback-api
viadp-api-router
How to review
dp-frontend-homepage-controller
feedback-api-url
in elements on devtools and value ishttp://localhost:23200/v1/feedback
Who can review
!Me