Added & cleaned up messages relating to a given user not existing

The following pages now have a <title> that can be set in localizations:

 * /user/USER_DOES_NOT_EXIST
 * /user/USER_DOES_NOT_EXIST/diary
 * /user/USER_DOES_NOT_EXIST/traces
 * /message/*/ID_DOES_NOT_EXIST

In addition I've cleaned up the i18n message keys of all the
''no_such_user.rhtml'' pages involved. They now all use
title/heading/body for the <title>, <h2> and <p> respectively. And the
message key {{user}} instead of {{name}}.
This commit is contained in:
Ævar Arnfjörð Bjarmason 2009-06-06 13:15:53 +00:00
parent f798504669
commit db51d7f3dd
18 changed files with 60 additions and 39 deletions

View file

@ -63,6 +63,7 @@ class DiaryEntryController < ApplicationController
:order => 'created_at DESC',
:per_page => 20)
else
@title = t'diary_entry.no_such_user.title'
@not_found_user = params[:display_name]
render :action => 'no_such_user', :status => :not_found

View file

@ -29,6 +29,7 @@ class MessageController < ApplicationController
@title = params[:title]
end
rescue ActiveRecord::RecordNotFound
@title = t'message.no_such_user.title'
render :action => 'no_such_user', :status => :not_found
end
@ -40,6 +41,7 @@ class MessageController < ApplicationController
@to_user = User.find(message.from_user_id)
render :action => 'new'
rescue ActiveRecord::RecordNotFound
@title = t'message.no_such_user.title'
render :action => 'no_such_user', :status => :not_found
end
@ -50,6 +52,7 @@ class MessageController < ApplicationController
@message.message_read = true if @message.to_user_id == @user.id
@message.save
rescue ActiveRecord::RecordNotFound
@title = t'message.no_such_user.title'
render :action => 'no_such_user', :status => :not_found
end
@ -90,6 +93,7 @@ class MessageController < ApplicationController
end
end
rescue ActiveRecord::RecordNotFound
@title = t'message.no_such_user.title'
render :action => 'no_such_user', :status => :not_found
end
end

View file

@ -18,6 +18,7 @@ class TraceController < ApplicationController
if target_user.nil? and !display_name.blank?
target_user = User.find(:first, :conditions => [ "visible = ? and display_name = ?", true, display_name])
if target_user.nil?
@title = t'trace.no_such_user.title'
@not_found_user = display_name
render :action => 'no_such_user', :status => :not_found
return

View file

@ -251,6 +251,7 @@ class UserController < ApplicationController
if @this_user
@title = @this_user.display_name
else
@title = t 'user.no_such_user.title'
@not_found_user = params[:display_name]
render :action => 'no_such_user', :status => :not_found
end