Replace devise_error_messages! with partial

This commit is contained in:
Dominik M. Kwiatek 2020-05-22 22:14:40 +01:00
parent 984976a2f7
commit 689521c6ed
7 changed files with 15 additions and 6 deletions

View File

@ -6,7 +6,7 @@
.card-body .card-body
%h1 Resend confirmation instructions %h1 Resend confirmation instructions
= bootstrap_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| = bootstrap_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
= devise_error_messages! = render "devise/shared/error_messages", resource: resource
= f.text_field :screen_name, autofocus: true, label: 'User name' = f.text_field :screen_name, autofocus: true, label: 'User name'
= f.submit 'Resend confirmation instructions', class: 'btn btn-primary mb-3' = f.submit 'Resend confirmation instructions', class: 'btn btn-primary mb-3'

View File

@ -6,7 +6,7 @@
.card-body .card-body
%h1 Change your password %h1 Change your password
= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| = bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
= devise_error_messages! = render "devise/shared/error_messages", resource: resource
= f.hidden_field :reset_password_token = f.hidden_field :reset_password_token

View File

@ -6,7 +6,7 @@
.card-body .card-body
%h1 Forgot your password? %h1 Forgot your password?
= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| = bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
= devise_error_messages! = render "devise/shared/error_messages", resource: resource
= f.email_field :email, autofocus: true, label: 'Email address' = f.email_field :email, autofocus: true, label: 'Email address'
= f.submit 'Send me password reset instructions', class: 'btn btn-primary mb-3' = f.submit 'Send me password reset instructions', class: 'btn btn-primary mb-3'

View File

@ -6,7 +6,7 @@
.card-body .card-body
%h1= t('views.sessions.new') %h1= t('views.sessions.new')
= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| = bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
= devise_error_messages! = render "devise/shared/error_messages", resource: resource
= f.text_field :screen_name, autofocus: true, label: t('views.settings.account.username') = f.text_field :screen_name, autofocus: true, label: t('views.settings.account.username')
= f.email_field :email, autofocus: false, label: t('views.settings.account.email') = f.email_field :email, autofocus: false, label: t('views.settings.account.email')

View File

@ -0,0 +1,9 @@
- if resource.errors.any?
#error_explanation
%h2
= I18n.t("errors.messages.not_saved",
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)
%ul
- resource.errors.full_messages.each do |message|
%li= message

View File

@ -4,7 +4,7 @@
= render 'layouts/messages' = render 'layouts/messages'
= bootstrap_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| = bootstrap_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f|
= devise_error_messages! = render "devise/shared/error_messages", resource: resource
= f.email_field :email, autofocus: true, label: 'Email address' = f.email_field :email, autofocus: true, label: 'Email address'

View File

@ -3,7 +3,7 @@
= bootstrap_form_for(resource, as: resource_name, url: '/settings/account', html: { method: :put }) do |f| = bootstrap_form_for(resource, as: resource_name, url: '/settings/account', html: { method: :put }) do |f|
= render 'modal/password', f: f = render 'modal/password', f: f
= devise_error_messages! = render "devise/shared/error_messages", resource: resource
= f.text_field :screen_name, autofocus: true, label: t('views.settings.account.username') = f.text_field :screen_name, autofocus: true, label: t('views.settings.account.username')