Commit f901405829d16257d603d21451503a1ced808db4

Authored by Joenio Costa
Committed by Antonio Terceiro
1 parent 660411f4

ActionItem898: nice looking page for "not found" error

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
... ... @@ -1,11 +0,0 @@
1   -<html>
2   - <head>
3   - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
4   - <title>
5   - <%= _('Page not found') %>
6   - </title>
7   - </head>
8   - <body>
9   - <%= yield %>
10   - </body>
11   -</html>
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>
... ...
public/images/icons-app/alert-icon.png 0 → 100644

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 +}
... ...