Add custom validation to nameservers uniqueness

This commit is contained in:
Martin Lensment 2014-09-22 13:44:42 +03:00
parent 44dce714b8
commit f65cf32991
7 changed files with 45 additions and 17 deletions

View file

@ -1,23 +1,24 @@
= form_for([:admin, @domain]) do |f|
- if @domain.errors.any?
- @domain.errors.each do |attr, err|
= err
%br
- if @domain.errors.any?
%hr
.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.active
%a{"data-toggle" => "tab", :href => "#general-tab", :role => "tab"} general-tab
%li
%a{"data-toggle" => "tab", :href => "#nameservers-tab", :role => "tab"} nameservers-tab
%li
%a{"data-toggle" => "tab", :href => "#contacts-tab", :role => "tab"} contacts-tab
%li
%a{"data-toggle" => "tab", :href => "#statuses-tab", :role => "tab"} statuses-tab
%a{"data-toggle" => "tab", :href => "#general-tab", :role => "tab"}= t('shared.general')
- li_class = @domain.associations_valid?(:nameservers) ? nil : 'error-tab'
%li{class: li_class}
%a{"data-toggle" => "tab", :href => "#nameservers-tab", :role => "tab"}= t('shared.nameservers')
- li_class = @domain.associations_valid?(:domain_contacts) ? nil : 'error-tab'
%li{class: li_class}
%a{"data-toggle" => "tab", :href => "#contacts-tab", :role => "tab"}= t('shared.contacts')
- li_class = @domain.associations_valid?(:domain_statuses) ? nil : 'error-tab'
%li{class: li_class}
%a{"data-toggle" => "tab", :href => "#statuses-tab", :role => "tab"}= t('shared.statuses')
/ Tab panes
.tab-content{style:'margin-top: 20px;'}
#general-tab.tab-pane.active

View file

@ -7,6 +7,8 @@
.panel-body
.errors
= render 'admin/shared/errors', object: contact_fields.object
- if contact_fields.object.errors.any?
%hr
.row
.col-md-6
.form-group

View file

@ -7,6 +7,8 @@
.panel-body
.errors
= render 'admin/shared/errors', object: ns_fields.object
- if ns_fields.object.errors.any?
%hr
.row
.col-md-12
.form-group
@ -28,5 +30,3 @@
item.find('.errors').html('');
}
});

View file

@ -7,6 +7,8 @@
.panel-body
.errors
= render 'admin/shared/errors', object: status_fields.object
- if status_fields.object.errors.any?
%hr
.row
.col-md-6
.form-group

View file

@ -1,5 +1,6 @@
- if object.errors.any?
- object.errors.each do |attr, err|
- next if attr.match(/\./)
- next if attr == :epp_errors
= err
%br