Skip to content
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

Merged
merged 17 commits into from
Feb 21, 2017

Conversation

albertocorrea
Copy link
Contributor

@albertocorrea albertocorrea commented Dec 15, 2016

JIRA

https://fameandpartners.atlassian.net/browse/WEBSITE-1239

Summary

404 new page redesign

  • Check error pages on staging
  • Fix CI state

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; }
Copy link
Contributor

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.

Copy link
Contributor

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 :)

@tiagoamaro
Copy link
Contributor

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>
Copy link
Contributor

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

Copy link
Contributor

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 ⚾️.

Copy link
Contributor

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.

@albertocorrea
Copy link
Contributor Author

@mmoraes I fix the css format and link. Also confirmed with Jess that this should be vertically centered.

@albertocorrea
Copy link
Contributor Author

@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.

@albertocorrea albertocorrea removed the wip label Dec 22, 2016
@sfate sfate force-pushed the feature/404-page-redesign-WEBSITE-1239 branch from 07d1185 to 6bf0207 Compare December 28, 2016 15:10
@sfate
Copy link
Contributor

sfate commented Dec 29, 2016

@albertocorrea @mmoraes @tiagoamaro
I've updated code for rendering errors templates in application's layout.
Please take a look on 422 and 500 pages. I think we need to tweak design for them as well.

@mmoraes
Copy link
Contributor

mmoraes commented Dec 29, 2016

@sfate With the new error rendering templates I guess the not_found.html.slim file is not needed anymore, right?

@sfate
Copy link
Contributor

sfate commented Dec 30, 2016

@mmoraes I've removed it previously. Seems something went bad after your merge with master.
Please avoid merges in development branches. You can always use rebase, e.g. git rebase master.

@sfate sfate force-pushed the feature/404-page-redesign-WEBSITE-1239 branch from 07cf0ad to 95b5bed Compare December 30, 2016 14:40
@sfate
Copy link
Contributor

sfate commented Dec 30, 2016

@mmoraes FYI: I've rebased branch and removed merge commit.

@mmoraes
Copy link
Contributor

mmoraes commented Dec 30, 2016

Thank you @sfate !

@mmoraes
Copy link
Contributor

mmoraes commented Jan 3, 2017

What's left for this PR? I think we can merge it...? @sfate

@sfate
Copy link
Contributor

sfate commented Jan 4, 2017

@mmoraes
I think we only need to get back 500.html to public folder.
And reconfigure a bit our nginx config for fallback error pages.
We need only to keep this page for 503 status when rails server is not reachable.

I think we need to discuss this w/ @tiagoamaro first.

extend ActiveSupport::Concern

included do
rescue_from Exception, with: -> { render_error(code: 500) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sfate,

  • 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

Copy link
Contributor

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.

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
Copy link
Contributor

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 ?

Copy link
Contributor

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:

  1. We need to add additional controller and change routes.
  2. 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:

  1. We can easily tweak error pages/paths/additional data for all error pages.
  2. We have all necessary errors listed at one place.
  3. We can change behavior of raising errors.
  4. We do not need to touch rotes.

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor

@tiagoamaro tiagoamaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to QA.

@tiagoamaro
Copy link
Contributor

@albertocorrea @mmoraes, any more changes to the 404 design? This was only missing the backend part, right?

@mmoraes
Copy link
Contributor

mmoraes commented Jan 11, 2017

@tiagoamaro Yes, that was the last pending part (backend). I think it's all good now.

@tiagoamaro tiagoamaro added wip and removed on-qa labels Jan 11, 2017
@tiagoamaro
Copy link
Contributor

This doesn't seem to be working on staging. Marking it as a WIP and moving back to in progress @sfate.

@tiagoamaro
Copy link
Contributor

@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 match '*path' matches anything :)

@sfate sfate force-pushed the feature/404-page-redesign-WEBSITE-1239 branch from 87ae851 to ab239d5 Compare February 17, 2017 01:23
@sfate
Copy link
Contributor

sfate commented Feb 17, 2017

@tiagoamaro updated code.. routes should work now as expected 😃

Copy link
Contributor

@tiagoamaro tiagoamaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sfate sfate self-assigned this Feb 17, 2017
@sfate sfate merged commit eca9243 into master Feb 21, 2017
@sfate sfate deleted the feature/404-page-redesign-WEBSITE-1239 branch February 21, 2017 15:01
gus4no pushed a commit that referenced this pull request Mar 7, 2017
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants