mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 02:09:39 +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
|
accepts_nested_attributes_for :nameservers, allow_destroy: true
|
||||||
|
|
||||||
has_many :domain_statuses, dependent: :delete_all
|
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
|
has_many :domain_transfers, dependent: :delete_all
|
||||||
|
|
||||||
|
@ -182,6 +183,13 @@ class Domain < ActiveRecord::Base
|
||||||
errors.empty?
|
errors.empty?
|
||||||
end
|
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)
|
def associations_valid?(name)
|
||||||
!errors.keys.any? { |x| x.match(/#{name.to_s}/) }
|
!errors.keys.any? { |x| x.match(/#{name.to_s}/) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
.col-md-12
|
.col-md-12
|
||||||
/ Nav tabs
|
/ Nav tabs
|
||||||
%ul.nav.nav-tabs{:role => "tablist", id: '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')
|
%a{"data-toggle" => "tab", :href => "#general-tab", :role => "tab"}= t('shared.general')
|
||||||
- li_class = @domain.associations_valid?(:nameservers) ? nil : 'error-tab'
|
- li_class = @domain.associations_valid?(:nameservers) ? nil : 'error-tab'
|
||||||
%li{class: li_class}
|
%li{class: li_class}
|
||||||
|
|
|
@ -1,25 +1,20 @@
|
||||||
- panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default'
|
- panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default'
|
||||||
.panel{class: panel_class}
|
.panel{class: panel_class}
|
||||||
.panel-heading.clearfix
|
.panel-heading.clearfix
|
||||||
.pull-left
|
|
||||||
= t('shared.admin_contacts')
|
= 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')
|
|
||||||
.table-responsive
|
.table-responsive
|
||||||
%table.table.table-hover.table-bordered.table-condensed
|
%table.table.table-hover.table-bordered.table-condensed
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th{class: 'col-xs-4'}= t('shared.name')
|
%th{class: 'col-xs-4'}= t('shared.name')
|
||||||
%th{class: 'col-xs-5'}= t('shared.email')
|
%th{class: 'col-xs-4'}= t('shared.code')
|
||||||
%th{class: 'col-xs-3'}= t('shared.action')
|
%th{class: 'col-xs-4'}= t('shared.email')
|
||||||
%tbody
|
%tbody
|
||||||
- @domain.domain_contacts.admin.each do |x|
|
- @domain.domain_contacts.admin.each do |x|
|
||||||
%tr
|
%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= 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]
|
- if @domain.errors.messages[:admin_contacts]
|
||||||
%tfoot
|
%tfoot
|
||||||
- @domain.errors.messages[:admin_contacts].each do |x|
|
- @domain.errors.messages[:admin_contacts].each do |x|
|
||||||
|
|
|
@ -1,27 +1,20 @@
|
||||||
- panel_class = @domain.errors.messages[:nameservers] ? 'panel-danger' : 'panel-default'
|
- panel_class = @domain.errors.messages[:nameservers] ? 'panel-danger' : 'panel-default'
|
||||||
#nameservers.panel{class: panel_class}
|
#nameservers.panel{class: panel_class}
|
||||||
.panel-heading.clearfix
|
.panel-heading.clearfix
|
||||||
.pull-left
|
|
||||||
= t('shared.nameservers')
|
= t('shared.nameservers')
|
||||||
.pull-right
|
|
||||||
= link_to(t('shared.add'), new_admin_domain_nameserver_path(@domain), class: 'btn btn-primary btn-xs')
|
|
||||||
.table-responsive
|
.table-responsive
|
||||||
%table.table.table-hover.table-bordered.table-condensed
|
%table.table.table-hover.table-bordered.table-condensed
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th{class: 'col-xs-3'}= t('shared.hostname')
|
%th{class: 'col-xs-4'}= t('shared.hostname')
|
||||||
%th{class: 'col-xs-3'}= t('shared.ipv4')
|
%th{class: 'col-xs-4'}= t('shared.ipv4')
|
||||||
%th{class: 'col-xs-3'}= t('shared.ipv6')
|
%th{class: 'col-xs-4'}= t('shared.ipv6')
|
||||||
%th{class: 'col-xs-3'}= t('shared.action')
|
|
||||||
%tbody
|
%tbody
|
||||||
- @domain.nameservers.each do |x|
|
- @domain.nameservers.each do |x|
|
||||||
%tr
|
%tr
|
||||||
%td= x
|
%td= x
|
||||||
%td= x.ipv4
|
%td= x.ipv4
|
||||||
%td= x.ipv6
|
%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]
|
- if @domain.errors.messages[:nameservers]
|
||||||
%tfoot
|
%tfoot
|
||||||
- @domain.errors.messages[:nameservers].each do |x|
|
- @domain.errors.messages[:nameservers].each do |x|
|
||||||
|
|
|
@ -1,25 +1,18 @@
|
||||||
- panel_class = @domain.errors.messages[:domain_statuses] ? 'panel-danger' : 'panel-default'
|
- panel_class = @domain.errors.messages[:domain_statuses] ? 'panel-danger' : 'panel-default'
|
||||||
#domain_statuses.panel{class: panel_class}
|
#domain_statuses.panel{class: panel_class}
|
||||||
.panel-heading.clearfix
|
.panel-heading.clearfix
|
||||||
.pull-left
|
|
||||||
= t('shared.statuses')
|
= t('shared.statuses')
|
||||||
.pull-right
|
|
||||||
= link_to(t('shared.add'), new_admin_domain_domain_status_path(@domain), class: 'btn btn-primary btn-xs')
|
|
||||||
.table-responsive
|
.table-responsive
|
||||||
%table.table.table-hover.table-bordered.table-condensed
|
%table.table.table-hover.table-bordered.table-condensed
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th{class: 'col-xs-4'}= t('shared.status')
|
%th{class: 'col-xs-6'}= t('shared.status')
|
||||||
%th{class: 'col-xs-5'}= t('shared.description')
|
%th{class: 'col-xs-6'}= t('shared.description')
|
||||||
%th{class: 'col-xs-3'}= t('shared.action')
|
|
||||||
%tbody
|
%tbody
|
||||||
- @domain.domain_statuses.each do |x|
|
- @domain.domain_statuses.each do |x|
|
||||||
%tr
|
%tr
|
||||||
%td= x.value
|
%td= x.value
|
||||||
%td= x.description
|
%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]
|
- if @domain.errors.messages[:domain_statuses]
|
||||||
%tfoot
|
%tfoot
|
||||||
- @domain.errors.messages[:domain_statuses].each do |x|
|
- @domain.errors.messages[:domain_statuses].each do |x|
|
||||||
|
|
|
@ -1,25 +1,20 @@
|
||||||
- panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default'
|
- panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default'
|
||||||
#tech_contacts.panel{class: panel_class}
|
#tech_contacts.panel{class: panel_class}
|
||||||
.panel-heading.clearfix
|
.panel-heading.clearfix
|
||||||
.pull-left
|
|
||||||
= t('shared.tech_contacts')
|
= 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')
|
|
||||||
.table-responsive
|
.table-responsive
|
||||||
%table.table.table-hover.table-bordered.table-condensed
|
%table.table.table-hover.table-bordered.table-condensed
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th{class: 'col-xs-4'}= t('shared.name')
|
%th{class: 'col-xs-4'}= t('shared.name')
|
||||||
%th{class: 'col-xs-5'}= t('shared.email')
|
%th{class: 'col-xs-4'}= t('shared.code')
|
||||||
%th{class: 'col-xs-3'}= t('shared.action')
|
%th{class: 'col-xs-4'}= t('shared.email')
|
||||||
%tbody
|
%tbody
|
||||||
- @domain.domain_contacts.tech.each do |x|
|
- @domain.domain_contacts.tech.each do |x|
|
||||||
%tr
|
%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= 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]
|
- if @domain.errors.messages[:tech_contacts]
|
||||||
%tfoot
|
%tfoot
|
||||||
- @domain.errors.messages[:tech_contacts].each do |x|
|
- @domain.errors.messages[:tech_contacts].each do |x|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue