mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Clean up domain show
This commit is contained in:
parent
075cdc0f0d
commit
cb1a9557de
6 changed files with 28 additions and 43 deletions
|
@ -19,7 +19,8 @@ class Domain < ActiveRecord::Base
|
|||
accepts_nested_attributes_for :nameservers, allow_destroy: true
|
||||
|
||||
has_many :domain_statuses, dependent: :delete_all
|
||||
accepts_nested_attributes_for :domain_statuses, allow_destroy: true, reject_if: proc {|attrs| attrs[:value].blank?}
|
||||
accepts_nested_attributes_for :domain_statuses, allow_destroy: true,
|
||||
reject_if: proc { |attrs| attrs[:value].blank? }
|
||||
|
||||
has_many :domain_transfers, dependent: :delete_all
|
||||
|
||||
|
@ -182,6 +183,13 @@ class Domain < ActiveRecord::Base
|
|||
errors.empty?
|
||||
end
|
||||
|
||||
# used for highlighting form tabs
|
||||
def parent_valid?
|
||||
assoc_errors = errors.keys.select { |x| x.match(/\./) }
|
||||
(errors.keys - assoc_errors).empty?
|
||||
end
|
||||
|
||||
# used for highlighting form tabs
|
||||
def associations_valid?(name)
|
||||
!errors.keys.any? { |x| x.match(/#{name.to_s}/) }
|
||||
end
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
.col-md-12
|
||||
/ Nav tabs
|
||||
%ul.nav.nav-tabs{:role => "tablist", id: 'tabs'}
|
||||
%li.active
|
||||
- li_class = @domain.parent_valid? ? 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'
|
||||
%li{class: li_class}
|
||||
|
|
|
@ -1,25 +1,20 @@
|
|||
- panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default'
|
||||
.panel{class: panel_class}
|
||||
.panel-heading.clearfix
|
||||
.pull-left
|
||||
= t('shared.admin_contacts')
|
||||
.pull-right
|
||||
= link_to(t('shared.add'), new_admin_domain_domain_contact_path(@domain, type: DomainContact::ADMIN), class: 'btn btn-primary btn-xs')
|
||||
= t('shared.admin_contacts')
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-bordered.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-4'}= t('shared.name')
|
||||
%th{class: 'col-xs-5'}= t('shared.email')
|
||||
%th{class: 'col-xs-3'}= t('shared.action')
|
||||
%th{class: 'col-xs-4'}= t('shared.code')
|
||||
%th{class: 'col-xs-4'}= t('shared.email')
|
||||
%tbody
|
||||
- @domain.domain_contacts.admin.each do |x|
|
||||
%tr
|
||||
%td= link_to(x.contact, root_path)
|
||||
%td= link_to(x.contact, admin_contact_path(x.contact))
|
||||
%td= x.contact.code
|
||||
%td= x.contact.email
|
||||
%td
|
||||
= link_to(t('shared.edit'), root_path, class: 'btn btn-primary btn-xs')
|
||||
= link_to(t('shared.detach'), admin_domain_domain_contact_path(@domain, x), method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-warning btn-xs')
|
||||
- if @domain.errors.messages[:admin_contacts]
|
||||
%tfoot
|
||||
- @domain.errors.messages[:admin_contacts].each do |x|
|
||||
|
|
|
@ -1,27 +1,20 @@
|
|||
- panel_class = @domain.errors.messages[:nameservers] ? 'panel-danger' : 'panel-default'
|
||||
#nameservers.panel{class: panel_class}
|
||||
.panel-heading.clearfix
|
||||
.pull-left
|
||||
= t('shared.nameservers')
|
||||
.pull-right
|
||||
= link_to(t('shared.add'), new_admin_domain_nameserver_path(@domain), class: 'btn btn-primary btn-xs')
|
||||
= t('shared.nameservers')
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-bordered.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-3'}= t('shared.hostname')
|
||||
%th{class: 'col-xs-3'}= t('shared.ipv4')
|
||||
%th{class: 'col-xs-3'}= t('shared.ipv6')
|
||||
%th{class: 'col-xs-3'}= t('shared.action')
|
||||
%th{class: 'col-xs-4'}= t('shared.hostname')
|
||||
%th{class: 'col-xs-4'}= t('shared.ipv4')
|
||||
%th{class: 'col-xs-4'}= t('shared.ipv6')
|
||||
%tbody
|
||||
- @domain.nameservers.each do |x|
|
||||
%tr
|
||||
%td= x
|
||||
%td= x.ipv4
|
||||
%td= x.ipv6
|
||||
%td
|
||||
= link_to(t('shared.edit'), edit_admin_domain_nameserver_path(@domain, x), class: 'btn btn-primary btn-xs')
|
||||
= link_to(t('shared.delete'), admin_domain_nameserver_path(@domain, x), method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-danger btn-xs')
|
||||
- if @domain.errors.messages[:nameservers]
|
||||
%tfoot
|
||||
- @domain.errors.messages[:nameservers].each do |x|
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
- panel_class = @domain.errors.messages[:domain_statuses] ? 'panel-danger' : 'panel-default'
|
||||
#domain_statuses.panel{class: panel_class}
|
||||
.panel-heading.clearfix
|
||||
.pull-left
|
||||
= t('shared.statuses')
|
||||
.pull-right
|
||||
= link_to(t('shared.add'), new_admin_domain_domain_status_path(@domain), class: 'btn btn-primary btn-xs')
|
||||
= t('shared.statuses')
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-bordered.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-4'}= t('shared.status')
|
||||
%th{class: 'col-xs-5'}= t('shared.description')
|
||||
%th{class: 'col-xs-3'}= t('shared.action')
|
||||
%th{class: 'col-xs-6'}= t('shared.status')
|
||||
%th{class: 'col-xs-6'}= t('shared.description')
|
||||
%tbody
|
||||
- @domain.domain_statuses.each do |x|
|
||||
%tr
|
||||
%td= x.value
|
||||
%td= x.description
|
||||
%td
|
||||
= link_to(t('shared.edit'), edit_admin_domain_domain_status_path(@domain, x), class: 'btn btn-primary btn-xs')
|
||||
= link_to(t('shared.delete'), admin_domain_domain_status_path(@domain, x), method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-danger btn-xs')
|
||||
- if @domain.errors.messages[:domain_statuses]
|
||||
%tfoot
|
||||
- @domain.errors.messages[:domain_statuses].each do |x|
|
||||
|
|
|
@ -1,25 +1,20 @@
|
|||
- panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default'
|
||||
#tech_contacts.panel{class: panel_class}
|
||||
.panel-heading.clearfix
|
||||
.pull-left
|
||||
= t('shared.tech_contacts')
|
||||
.pull-right
|
||||
= link_to(t('shared.add'), new_admin_domain_domain_contact_path(@domain, type: DomainContact::TECH), class: 'btn btn-primary btn-xs')
|
||||
= t('shared.tech_contacts')
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-bordered.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-4'}= t('shared.name')
|
||||
%th{class: 'col-xs-5'}= t('shared.email')
|
||||
%th{class: 'col-xs-3'}= t('shared.action')
|
||||
%th{class: 'col-xs-4'}= t('shared.code')
|
||||
%th{class: 'col-xs-4'}= t('shared.email')
|
||||
%tbody
|
||||
- @domain.domain_contacts.tech.each do |x|
|
||||
%tr
|
||||
%td= link_to(x.contact, root_path)
|
||||
%td= link_to(x.contact, admin_contact_path(x.contact))
|
||||
%td= x.contact.code
|
||||
%td= x.contact.email
|
||||
%td
|
||||
= link_to(t('shared.edit'), root_path, class: 'btn btn-primary btn-xs')
|
||||
= link_to(t('shared.detach'), admin_domain_domain_contact_path(@domain, x), method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-warning btn-xs')
|
||||
- if @domain.errors.messages[:tech_contacts]
|
||||
%tfoot
|
||||
- @domain.errors.messages[:tech_contacts].each do |x|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue