Display correct errors on different tabs

This commit is contained in:
Martin Lensment 2014-09-22 17:23:02 +03:00
parent 93930a1243
commit df5f987551
7 changed files with 32 additions and 52 deletions

View file

@ -1,14 +1,9 @@
= form_for([:admin, @domain]) do |f|
.row
.col-md-12
= render 'admin/shared/errors', object: f.object
- if f.object.errors.any?
%hr
.row
.col-md-12
/ Nav tabs
%ul.nav.nav-tabs{:role => "tablist", id: 'tabs'}
- li_class = @domain.parent_valid? ? nil : 'error-tab'
- li_class = @domain.general_tab_errors.empty? ? nil : 'error-tab'
%li.active{class: li_class}
%a{"data-toggle" => "tab", :href => "#general-tab", :role => "tab"}= t('shared.general')
- li_class = @domain.associations_valid?(:nameservers) ? nil : 'error-tab'

View file

@ -1,3 +1,6 @@
= render 'admin/shared/errors_array', errors: @domain.errors[:domain_contacts]
- if @domain.errors[:domain_contacts].any?
%hr
#domain_contacts
= f.fields_for :domain_contacts do |contact_fields|
.panel.panel-default

View file

@ -1,3 +1,8 @@
.row
.col-md-12
= render 'admin/shared/errors_array', errors: @domain.general_tab_errors
- if @domain.general_tab_errors.any?
%hr
.row
.col-md-6
.form-group

View file

@ -1,3 +1,6 @@
= render 'admin/shared/errors_array', errors: @domain.errors[:nameservers]
- if @domain.errors[:nameservers].any?
%hr
#nameservers
= f.fields_for :nameservers do |ns_fields|
.panel.panel-default

View file

@ -1,3 +1,6 @@
= render 'admin/shared/errors_array', errors: @domain.errors[:domain_statuses]
- if @domain.errors[:domain_statuses].any?
%hr
#domain_statuses
= f.fields_for :domain_statuses do |status_fields|
.panel.panel-default

View file

@ -0,0 +1,4 @@
- if errors.any?
- errors.each do |err|
= err
%br