-
Notifications
You must be signed in to change notification settings - Fork 5
Dist landing page #33
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?
Dist landing page #33
Conversation
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 all looks great, thanks! I added some comments on some things that I think would make it cleaner, but they're not requirements.
Is this ready to merge otherwise? Or is that where #34 comes in?
}); | ||
|
||
input.addEventListener('keyup', function () { | ||
input.value = input.value.replace(new RegExp("([^a-zA-Z0-9\-]+)", "g"), ""); |
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.
You can do this without JavaScript if you'd like by using the <input pattern="..." />
HTML attribute (MDN docs). If the input doesn't pass validation, the submit
event shouldn't(?) happen.
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.
It's just a preference, I prefer validating the input and preventing the characters this way.
} | ||
}; | ||
|
||
let dists = [ |
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 might be better as let dists = <%= encode_json $dists %>
, but that's just an opinion, not a requirement :)
setupEvents: function () { | ||
let self = this; | ||
let input = self.search_form.querySelector('input#search'); | ||
self.search_form.addEventListener('submit', function (evt) { |
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.
If you use arrow functions, you can get rid of the need to do let self = this;
:
this.search_form.addEventListener('submit', (evt) => {
// inside here, `this` is the same as outside
});
Yes you can merge this without merging #34 as 34 is just a fork of this with the main changes being on the /dist/ pages. |
No description provided.