-
Notifications
You must be signed in to change notification settings - Fork 36
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
Redesign and modernize lockup #56
Conversation
@dankimio Some killer work here, thank you! This project started long before I was aware of things like rubocop or setting good style guides, so it’ll be nice to tighten it up and modernize it. I’m going to give the changes some more thorough review, testing, and thought as soon as I can. |
@dankimio I’ve spent a bit of time with this… Overall, I’m a fan of updating the architecture, the design, etc. The philosophical issue I’m running into is backwards compatibility. I’m open to input from others, but as it stands, a lot of the changes that take advantage of more modern Ruby/Rails syntax break the gem for Rails 3.X and in some cases Rails 4.X. Ideally, we could incorporate a lot of this work you’ve done, but without breaking the gem for older versions. At its core, it’s a really simple gem, so I’m having trouble trying to convince myself that it’s worth ditching older Rails versions. What do you think? @danrabinowitz do you have any thoughts along these lines? |
Worth noting that Rails versions below 5.1 and Ruby versions below 2.4 are no longer maintained, they do not receive security updates and their use is discouraged. For older apps there's always an option to use older versions of the gem. We could revert safe navigation operator, this would be an easy fix. |
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.
Overall, I really like this. I suggest splitting it into smaller PRs. I'd aim for:
-
The pure refactor changes (from rubocop, I assume) such as replacing double quotes with single quotes, etc. Ideally, if you're going to use rubocop, you'd include the rubocop gem as a development dependency and include a rubocop.yml
This PR would have little risk. It's just about style. -
The css, HTML, JS changes. This PR would have low risk related to ruby versions, but we'd just need to check against older browsers. (Maybe not a huge issue these days?)
-
The ruby changes, such:
user_agent && user_agent.downcase.match(CRAWLER_REGEX)
vs
user_agent&.downcase&.match(CRAWLER_REGEX)
That particular change is NOT a good idea because of older ruby versions, but there might be other ruby changes buried in this PR that we could consider.
Thanks for the contribution! I think most of these changes would be GREAT to include.
@@ -11,7 +11,7 @@ class LockupController < Lockup::ApplicationController | |||
def unlock | |||
if params[:lockup_codeword].present? | |||
user_agent = request.env['HTTP_USER_AGENT'].presence | |||
if user_agent && user_agent.downcase.match(CRAWLER_REGEX) | |||
if user_agent&.downcase&.match(CRAWLER_REGEX) |
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 is not a good idea, as it will break for older ruby versions.
@danrabinowitz Thanks for the input Dan. I like the idea of separate PR’s as well. I can get a CI-solution running on this repo too so that we can automate tests and rubocop. |
- Add ie=edge meta tag - Clean up viewport tag - Clean up UTF-8 tag
This is a very big pull request. I would love to get some feedback on it first, and then I can split it into smaller chunks, revert unwanted changes if there are any. Then we can merge them one-by-one.
This pull request should resolve issues #54, #55.
Major changes
prefers-color-scheme: dark
in Safari)h1
withOne more step
(inspired by CloudFlare's robot pages) and description paragraph, which should be more semantic.title
HTML attribute andhelp
cursor.Minor changes
…
) since we're using UTF-8.Things to consider
inline_css
andnormalize
partials and inlining everything in the layout.Screenshots
This is how it looks like on Desktop screens