Commit f901405829d16257d603d21451503a1ced808db4
Committed by
Antonio Terceiro
1 parent
660411f4
Exists in
master
and in
22 other branches
ActionItem898: nice looking page for "not found" error
Showing
5 changed files
with
22 additions
and
15 deletions
Show diff stats
app/controllers/application.rb
| ... | ... | @@ -93,8 +93,7 @@ class ApplicationController < ActionController::Base |
| 93 | 93 | |
| 94 | 94 | def render_not_found(path = nil) |
| 95 | 95 | @path ||= request.path |
| 96 | -# raise "#{@path} not found" | |
| 97 | - render(:file => File.join(RAILS_ROOT, 'app', 'views', 'shared', 'not_found.rhtml'), :layout => 'not_found', :status => 404) | |
| 96 | + render :template => 'shared/not_found.rhtml', :status => 404 | |
| 98 | 97 | end |
| 99 | 98 | |
| 100 | 99 | def user | ... | ... |
app/views/layouts/not_found.rhtml
app/views/shared/not_found.rhtml
| 1 | -<h1><%= _('There is no such page: %s') % (content_tag('tt', @path)) %></h1> | |
| 2 | - | |
| 1 | +<div id='not-found'> | |
| 2 | + <h1><%= _('There is no such page: %s') % (content_tag('tt', @path)) %></h1> | |
| 3 | + <p><%= _('You may have clicked an expired link or mistyped the address.') %></p> | |
| 4 | + <ul> | |
| 5 | + <li><%= link_to _(' Return home page'), :controller => 'home' %></li> | |
| 6 | + <li><%= link_to _('Go back'), :back %></li> | |
| 7 | + <ul> | |
| 8 | +</div> | ... | ... |
1 KB
public/stylesheets/common.css
| ... | ... | @@ -418,3 +418,16 @@ div.pending-tasks { |
| 418 | 418 | #theme-test-panel .button-bar { |
| 419 | 419 | margin: 1em; |
| 420 | 420 | } |
| 421 | + | |
| 422 | +#content #not-found { | |
| 423 | + padding: 20px; | |
| 424 | + margin: 20px; | |
| 425 | + border: 1px solid #DDD; | |
| 426 | + -moz-border-radius: 6px; | |
| 427 | +} | |
| 428 | + | |
| 429 | +#content #not-found h1 { | |
| 430 | + text-align: left; | |
| 431 | + background: url(../images/icons-app/alert-icon.png) no-repeat; | |
| 432 | + padding-left: 30px; | |
| 433 | +} | ... | ... |