mirror of
https://github.com/internetee/registry.git
synced 2025-07-19 17:25:57 +02:00
Display correct errors on different tabs
This commit is contained in:
parent
93930a1243
commit
df5f987551
7 changed files with 32 additions and 52 deletions
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
4
app/views/admin/shared/_errors_array.haml
Normal file
4
app/views/admin/shared/_errors_array.haml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- if errors.any?
|
||||
- errors.each do |err|
|
||||
= err
|
||||
%br
|
Loading…
Add table
Add a link
Reference in a new issue