mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
use I18n'ed header on error messages block
This commit is contained in:
parent
69ecbd1fa3
commit
a1c80b6211
3 changed files with 8 additions and 2 deletions
|
@ -3,7 +3,9 @@ module DeviseHelper
|
|||
return "" if resource.errors.empty?
|
||||
|
||||
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
|
||||
sentence = "#{pluralize(resource.errors.count, "error")} prohibited this #{resource_name} from being saved:"
|
||||
sentence = I18n.t("errors.messages.not_saved",
|
||||
:count => resource.errors.count,
|
||||
:resource => resource_name)
|
||||
|
||||
html = <<-HTML
|
||||
<div id="error_explanation">
|
||||
|
@ -14,4 +16,4 @@ module DeviseHelper
|
|||
|
||||
html.html_safe
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,9 @@ en:
|
|||
not_found: "not found"
|
||||
already_confirmed: "was already confirmed"
|
||||
not_locked: "was not locked"
|
||||
not_saved:
|
||||
one: "1 error prohibited this %{resource} from being saved:"
|
||||
other: "%{count} errors prohibited this %{resource} from being saved:"
|
||||
|
||||
devise:
|
||||
failure:
|
||||
|
|
|
@ -51,6 +51,7 @@ class RegistrationTest < ActionController::IntegrationTest
|
|||
assert_have_selector '#error_explanation'
|
||||
assert_contain "Email is invalid"
|
||||
assert_contain "Password doesn't match confirmation"
|
||||
assert_contain "2 errors prohibited"
|
||||
assert_nil User.first
|
||||
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
|
Loading…
Reference in a new issue