mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 01:33:36 +02:00
Remove most of the tabs on domain form
This commit is contained in:
parent
03b143eef2
commit
44424984f0
7 changed files with 27 additions and 83 deletions
|
@ -161,29 +161,6 @@ class Domain < ActiveRecord::Base
|
|||
(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
|
||||
|
||||
def general_tab_errors
|
||||
collect_errors_with_keys([:name_dirty, :period, :period_unit, :registrar, :owner_contact])
|
||||
end
|
||||
|
||||
def contacts_tab_valid?
|
||||
(
|
||||
associations_valid?(:domain_contacts) &&
|
||||
associations_valid?(:admin_contacts) &&
|
||||
associations_valid?(:tech_contacts)
|
||||
)
|
||||
end
|
||||
|
||||
def collect_errors_with_keys(keys)
|
||||
res = []
|
||||
errors.each { |attr, err| res << err if keys.include?(attr) }
|
||||
res
|
||||
end
|
||||
|
||||
## SHARED
|
||||
|
||||
def to_s
|
||||
|
|
|
@ -1,35 +1,16 @@
|
|||
= form_for([:admin, @domain]) do |f|
|
||||
= render 'admin/shared/errors', object: @domain
|
||||
- unless @domain.parent_valid?
|
||||
%hr
|
||||
.row
|
||||
.col-md-12
|
||||
/ Nav tabs
|
||||
%ul.nav.nav-tabs{:role => "tablist", id: 'tabs'}
|
||||
- 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'
|
||||
%li{class: li_class}
|
||||
%a{"data-toggle" => "tab", :href => "#nameservers-tab", :role => "tab"}= t('shared.nameservers')
|
||||
- li_class = @domain.contacts_tab_valid? ? 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
|
||||
= render 'admin/domains/form_partials/general', f: f
|
||||
#nameservers-tab.tab-pane
|
||||
= render 'admin/domains/form_partials/nameservers', f: f
|
||||
#contacts-tab.tab-pane
|
||||
%hr
|
||||
= render 'admin/domains/form_partials/contacts', f: f
|
||||
#statuses-tab.tab-pane
|
||||
%hr
|
||||
= render 'admin/domains/form_partials/statuses', f: f
|
||||
%hr
|
||||
= render 'admin/domains/form_partials/nameservers', f: f
|
||||
.row
|
||||
.col-md-12.text-right
|
||||
= button_tag(t('shared.save'), class: 'btn btn-primary')
|
||||
|
||||
:javascript
|
||||
$(function () {
|
||||
$('#tabs a:first').tab('show')
|
||||
})
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
= render 'admin/shared/errors_array', errors: @domain.errors[:domain_contacts]
|
||||
= render 'admin/shared/errors_array', errors: @domain.errors[:admin_contacts]
|
||||
= render 'admin/shared/errors_array', errors: @domain.errors[:tech_contacts]
|
||||
- if (@domain.errors[:domain_contacts] + @domain.errors[:admin_contacts] + @domain.errors[:tech_contacts]).any?
|
||||
%hr
|
||||
#domain_contacts
|
||||
= f.fields_for :domain_contacts do |contact_fields|
|
||||
.panel.panel-default
|
||||
.panel-heading.text-right
|
||||
.panel-heading.clearfix
|
||||
.pull-left= t('shared.contact')
|
||||
.pull-right
|
||||
= link_to(t('shared.add_another'), '#', class: 'btn btn-primary btn-xs add-domain-contact')
|
||||
= link_to(t('shared.delete'), '#', class: 'btn btn-danger btn-xs destroy')
|
||||
.panel-body
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
.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,10 +1,9 @@
|
|||
= 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
|
||||
.panel-heading.text-right
|
||||
.panel-heading.clearfix
|
||||
.pull-left= t('shared.nameserver')
|
||||
.pull-right
|
||||
= link_to(t('shared.add_another'), '#', class: 'btn btn-primary btn-xs add-nameserver')
|
||||
= link_to(t('shared.delete'), '#', class: 'btn btn-danger btn-xs destroy')
|
||||
.panel-body
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
= 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
|
||||
.panel-heading.text-right
|
||||
.panel-heading.clearfix
|
||||
.pull-left= t('shared.status')
|
||||
.pull-right
|
||||
= link_to(t('shared.add_another'), '#', class: 'btn btn-primary btn-xs add-domain-status')
|
||||
= link_to(t('shared.delete'), '#', class: 'btn btn-danger btn-xs destroy')
|
||||
.panel-body
|
||||
|
|
|
@ -221,12 +221,7 @@ en:
|
|||
contact_code: 'Contact code'
|
||||
add: 'Add'
|
||||
domain: 'Domain'
|
||||
new_nameserver: 'New nameserver'
|
||||
edit_nameserver: 'Edit nameserver'
|
||||
nameserver_deleted: 'Nameserver deleted!'
|
||||
failed_to_delete_nameserver: 'Failed to delete nameserver!'
|
||||
failed_to_add_nameserver: 'Failed to add nameserver!'
|
||||
nameserver_added: 'Nameserver added!'
|
||||
nameserver: 'Nameserver'
|
||||
back_to_domain: 'Back to domain'
|
||||
edit_domain: 'Edit domain'
|
||||
contact_was_not_found: 'Contact was not found!'
|
||||
|
@ -275,4 +270,5 @@ en:
|
|||
reg_no: 'Reg. no'
|
||||
setting_updated: 'Setting updated!'
|
||||
failed_to_update_setting: 'Failed to update setting'
|
||||
status: 'Status'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue