-
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
[Feature] [WEBSITE-1239] 404 page redesign #2253
Conversation
public/404.html
Outdated
@@ -5,53 +5,39 @@ | |||
<style type="text/css"> | |||
@import url(//fonts.googleapis.com/css?family=Forum); | |||
|
|||
body { background-color: #fff; color: #333; text-align: center; font-family: arial, sans-serif; font-size: 14px; } | |||
a{ | |||
body { font-family: "brandon-grotesque",sans-serif; background-color: #fff; color: #333; text-align: center; font-family: arial, sans-serif; font-size: 20px; } |
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.
Why this even one line?
Would be much readable to have it line by line.
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.
Agreed. No need to inline nothing here :)
Now, for the missing feature: applying the application layout for the new 404 html. |
public/404.html
Outdated
<div class="dialog"> | ||
<h1>Looking for something?</h1> | ||
<h2><em>Sorry,</em> this page doesn't exist.</h2> | ||
<p>Try our <a href="https://www.fameandpartners.com/?cf=404">homepage</a> to see what's new and start customizing.</p> |
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.
How about just using href="/"
, so that it redirects to AU or US' homepages accordingly?
Would it have any side-effect? @tiagoamaro @sfate
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.
@mmoraes, negative. Actually this is wanted. Good catch ⚾️.
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.
@mmoraes very good point.
It shouldn't have any side-effects.
@mmoraes I fix the css format and link. Also confirmed with Jess that this should be vertically centered. |
@sfate @mmoraes I follow https://mattbrictson.com/dynamic-rails-error-pages as per Tiago's suggestion. According to me is looking ok but I haven't done this in a long time. Let me know if we need to fix anything. Also want to make sure I that the 500 error page will still work as before. |
07d1185
to
6bf0207
Compare
@albertocorrea @mmoraes @tiagoamaro |
@sfate With the new error rendering templates I guess the not_found.html.slim file is not needed anymore, right? |
@mmoraes I've removed it previously. Seems something went bad after your merge with master. |
07cf0ad
to
95b5bed
Compare
@mmoraes FYI: I've rebased branch and removed merge commit. |
Thank you @sfate ! |
What's left for this PR? I think we can merge it...? @sfate |
@mmoraes I think we need to discuss this w/ @tiagoamaro first. |
app/controllers/concerns/errors.rb
Outdated
extend ActiveSupport::Concern | ||
|
||
included do | ||
rescue_from Exception, with: -> { render_error(code: 500) } |
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.
- Don't think rescuing 500 errors is necessary:
- 500 errors should never happen. Don't think it's a need to turn them into a pretty dynamic ERB
- Deleting 500 static HTML (
public/500.html
) will result in nginx errors if the 500 dynamic page has errors by itself
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.
@tiagoamaro Also though about this as well.
Will move it back.
app/controllers/concerns/errors.rb
Outdated
rescue_from ActionController::UnknownController, with: -> { render_error(code: 404) } | ||
rescue_from ActionController::UnknownAction, with: -> { render_error(code: 404) } | ||
rescue_from ActionController::RoutingError, with: -> { render_error(code: 404) } | ||
end |
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.
Since we're on Rails 3, do you think it would be possible replacing those ActiveRecord/ActionController
exceptions to something like this: https://mattbrictson.com/dynamic-rails-error-pages ?
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.
@tiagoamaro
I don't like this behavior (from the article) by this points:
- We need to add additional controller and change routes.
- It wouldn't work for most cases. I've tried this approach w/ raising
ActiveRecord::NotFound
exception and it showed up an a standard rails error page (instead of 404's page from controller).
Why I'd prefer solution with catching exceptions in concern:
- We can easily tweak error pages/paths/additional data for all error pages.
- We have all necessary errors listed at one place.
- We can change behavior of raising errors.
- We do not need to touch rotes.
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.
Agreed. Continue and will check it back when the 500 HTML is restored.
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.
@tiagoamaro returned back 500 static page: 4930a91
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.
@sfate already deploying your changes to staging. Nice timing.
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.
Ready to QA.
@albertocorrea @mmoraes, any more changes to the 404 design? This was only missing the backend part, right? |
@tiagoamaro Yes, that was the last pending part (backend). I think it's all good now. |
This doesn't seem to be working on staging. Marking it as a WIP and moving back to in progress @sfate. |
@sfate incredible reason to have acceptance tests: Afterpay routes are getting mounted after main app routing, which means anything from the Afterpay engine is being seen, since |
87ae851
to
ab239d5
Compare
@tiagoamaro updated code.. routes should work now as expected 😃 |
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.
LGTM
* 404 page redesign * Fix css format * Fix link destination * Remove old 404 file * Add new controller and helper * Add new 404 template * Add new route to the 404 page * Tell rails to use tempaltes * Error pages sass * Catch errors with custom error pages yielded w/ application layout * update styling and put content inside .container * Optimize calls + raise exception for development mode * Return back static 500 page * Make rails app available to catch RoutingError (raised by ActionDispatch) Ref: rails/rails#671 * Fix not found routes spec * Fix unmactched routes catch * Fix specs
JIRA
https://fameandpartners.atlassian.net/browse/WEBSITE-1239
Summary
404 new page redesign