[refs #230] error messages

This commit is contained in:
Alexander Machehin 2012-02-29 22:54:44 +06:00
parent 322e68212f
commit ba4fae071f
8 changed files with 103 additions and 42 deletions

View File

@ -170,21 +170,6 @@ div.in {
margin-right: 15px;
margin-top: 12px; }
div.error {
background: image-url("error-message.png");
width: 237px;
height: 35px;
font-size: 12px;
position: absolute;
margin-top: -159px;
margin-left: 645px;
display: none;
p {
margin: 0;
padding: 0;
padding-top: 7px;
text-align: center; } }
/* Footer */
footer {
@ -209,3 +194,34 @@ footer {
text-decoration: none;
&:hover {
text-decoration: underline; } } } } }
div.error {
background: image-url("error-message.png");
width: 237px;
height: 35px;
font-size: 12px;
position: absolute;
margin-top: -159px;
margin-left: 582px;
//display: none;
p {
margin: 0;
padding: 0;
padding-top: 7px;
text-align: center; }
&.login {
margin-top: -242px;
margin-left: 650px; }
&.name {
margin-top: -202px;
margin-left: 650px; }
&.email {
margin-top: -161px;
margin-left: 650px; }
&.password {
margin-top: -101px;
margin-left: 650px; } }
div.error.forgot {
margin-top: 8px;
margin-left: 308px; }

View File

@ -1,22 +1,22 @@
.block
%h2= title t('devise.passwords.link')
.content
- if resource.errors.present?
.flash
.message.error
- messages = resource.errors.full_messages.map { |msg| content_tag(:p, msg) }.join.html_safe
= messages
.wrap
%nav
%a{:href => new_register_request_path}
%p=t("layout.devise.shared_links.sign_up")
/ Top block
%header
.logo
/ Page
%article
%h2= title t('devise.passwords.forgot')
.content
- if resource.errors.present?
.flash
.message.error.forgot
- messages = resource.errors.full_messages.map { |msg| content_tag(:p, msg) }.join.html_safe
= messages
= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, :class => "form" }) do |f|
.group.wat-cf
.left
= f.label :email, :class => "label"
.right
= f.text_field :email, :class => "text_field"
.group.navform.wat-cf
%button.button{:tyle => "submit"}
= image_tag "choose.png", :alt => t("devise.passwords.button")
= t("devise.passwords.button")
%span.text_button_padding
= render :partial => "devise/shared/links"
= f.text_field :login, :name => 'user[email]', :class => "registartion-input", :onblur => "if(this.value==''){this.value='#{t('activerecord.attributes.user.email')}';this.className='registartion-input';} else{this.className='registartion-input-no-focus';};buttonCheck();", :onfocus => "if(this.value=='#{t('activerecord.attributes.user.email')}'){this.value='';this.className='registartion-input-focus';};", :onkeydown => "buttonCheck();", :type => "text", :value => t('activerecord.attributes.user.email')
.both
%br
=f.submit t("devise.passwords.send"), :class => 'button', :id => 'btnLogin'

View File

@ -5,31 +5,31 @@
/ Page
- uname_error = name_error = email_error = password_error = password_confirm_error = nil
- if resource.errors.present? # Trash
.flash
- resource.errors.each do |attr, array|
-uname_error = array if attr == :uname
-name_error = array if attr == :name
-email_error = array if attr == :email
-password_error = array if attr == :password
-password_confirm_error = array if attr == :password_confirmation
%article
= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :class => "form" }) do |f|
= hidden_field_tag :invitation_token, @invitation_token
.left.first=t('activerecord.attributes.user.uname')
.right.first
= f.text_field :uname, :id => 'login', :class => "registartion-input #{uname_error ? "registartion-input-error" : ''}", :onClick => "this.className='registartion-input-focus';disError(this);", :onblur => "if(this.value==''){this.value='';this.className='registartion-input';}else{this.className='registartion-input-no-focus';};buttonCheck();", :onfocus => "if(this.value==''){this.value='';this.className='registartion-input-focus';};", :onkeydown => "buttonCheck();"
= f.text_field :uname, :id => 'login', :class => "registartion-input #{uname_error ? "registartion-input-error" : ''}", :onblur => "if(this.value==''){this.value='';this.className='registartion-input';}else{this.className='registartion-input-no-focus';};", :onfocus => "if(this.value==''){this.value='';this.className='registartion-input-focus';};"
.both
.left=t('activerecord.attributes.user.name')
.right
= f.text_field :name, :id => 'name', :class => "registartion-input #{name_error ? "registartion-input-error" : ''}", :onClick => "this.className='registartion-input-focus';disError(this);", :onblur => "if(this.value==''){this.value='';this.className='registartion-input';}else{this.className='registartion-input-no-focus';};buttonCheck();", :onfocus => "if(this.value==''){this.value='';this.className='registartion-input-focus';};", :onkeydown => "buttonCheck();"
= f.text_field :name, :id => 'name', :class => "registartion-input #{name_error ? "registartion-input-error" : ''}", :onblur => "if(this.value==''){this.value='';this.className='registartion-input';}else{this.className='registartion-input-no-focus';};", :onfocus => "if(this.value==''){this.value='';this.className='registartion-input-focus';};"
.both
.left=t('activerecord.attributes.user.email')
.right
= f.text_field :email, :id => 'email', :readonly => 'readonly', :class => "registartion-input #{email_error ? "registartion-input-error" : ''}", :onClick => "this.className='registartion-input-focus';disError(this);", :onblur => "if(this.value==''){this.value='';this.className='registartion-input';}else{this.className='registartion-input-no-focus';};buttonCheck();", :onfocus => "if(this.value==''){this.value='';this.className='registartion-input-focus';};", :onkeydown => "buttonCheck();"
= f.text_field :email, :id => 'email', :readonly => 'readonly', :class => "registartion-input #{email_error ? "registartion-input-error" : ''}", :onblur => "if(this.value==''){this.value='';this.className='registartion-input';}else{this.className='registartion-input-no-focus';};", :onfocus => "if(this.value==''){this.value='';this.className='registartion-input-focus';};"
.both
.left=t('activerecord.attributes.user.password')
.right
= f.text_field :password, :id => 'pass', :class => "registartion-input #{password_error ? "registartion-input-error" : ''}", :onClick => "this.className='registartion-input-focus';disError(this);", :onblur => "if(this.value==''){this.value='';this.className='registartion-input';}else{this.className='registartion-input-no-focus';};buttonCheck();", :onfocus => "if(this.value==''){this.value='';this.className='registartion-input-focus';};", :onkeydown => "buttonCheck();"
= f.text_field :password, :id => 'pass', :class => "registartion-input #{password_error ? "registartion-input-error" : ''}", :onblur => "if(this.value==''){this.value='';this.className='registartion-input';}else{this.className='registartion-input-no-focus';};", :onfocus => "if(this.value==''){this.value='';this.className='registartion-input-focus';};"
.both
.left=t('activerecord.attributes.user.password_confirm')
.right
@ -38,3 +38,16 @@
.in
=f.submit t("layout.devise.shared_links.sign_up"), :class => 'button', :id => 'btnLogin'
.both
-if uname_error
.error.login#hintLogin
%p=uname_error
-if name_error
.error.name#hintName
%p=name_error
-if email_error
.error.email#hintEmail
%p=email_error
-if password_error
.error.password#hintPassword
%p=password_error

View File

@ -6,10 +6,14 @@
- if controller_name == 'sessions' && action_name == 'new'
= stylesheet_link_tag "login"
= javascript_include_tag "login"
- elsif controller_name == 'registrations' && ['new', 'create'].include?(action_name)
- elsif ['registrations', 'passwords'].include?(controller_name) && ['new', 'create'].include?(action_name)
= stylesheet_link_tag "registration"
= javascript_include_tag "registration"
= csrf_meta_tag
%body
=controller_name
=action_name
-# render :partial => "layouts/flashes"
= yield

View File

@ -30,6 +30,8 @@ en:
updated: 'Your password was changed successfully. You are now signed in.'
updated_not_active: 'Your password was changed successfully.'
send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
forgot: 'Forgot password'
send: 'Send'
confirmations:
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'

View File

@ -32,6 +32,8 @@ ru:
updated: "Ваш пароль изменён. Теперь вы вошли в систему."
updated_not_active: 'Ваш пароль успешно изменён.'
send_paranoid_instructions: "Если Ваш e-mail существует, в течение нескольких минут вы получите e-mail с инструкциями по восстановлению вашего пароля."
forgot: 'Забыли пароль'
send: 'Послать'
confirmations:
send_instructions: "В течение нескольких минут вы получите e-mail с инструкциями по подтверждению вашей учётной записи."
send_paranoid_instructions: 'Если Ваш e-mail существует, то в течение нескольких минут вы получите e-mail с инструкциями по подтверждению вашей учётной записи.'

View File

@ -609,3 +609,13 @@ en:
issue_assign_notification: New task assigned
new_commit_comment_notification: New comment to commit
invite_approve_notification: Invitation to ABF
activerecord:
errors:
messages:
too_long:
one: "maximum is %{count} character"
other: "maximum is %{count} characters"
too_short:
one: "minimum is %{count} character"
other: "minimum is %{count} characters"

View File

@ -604,3 +604,17 @@ ru:
issue_assign_notification: Вам назначили задачу
new_commit_comment_notification: Новый комментарий к коммиту
invite_approve_notification: Приглашение в ABF
activerecord:
errors:
messages:
too_long:
one: "не может быть больше чем %{count} символ"
few: "не может быть больше чем %{count} символа"
many: "не может быть больше чем %{count} символов"
other: "не может быть больше чем %{count} символа"
too_short:
one: "не может быть меньше %{count} символа"
few: "не может быть меньше %{count} символов"
many: "не может быть меньше %{count} символов"
other: "не может быть меньше %{count} символа"