From 2982b229210ea77b77b5e9f7ac11fb27fee74fc7 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Thu, 11 Sep 2014 12:24:19 +0300 Subject: [PATCH] Fix domain view --- app/controllers/admin/domains_controller.rb | 1 + app/models/domain.rb | 5 +++++ config/locales/en.yml | 9 +++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/domains_controller.rb b/app/controllers/admin/domains_controller.rb index 84a9983b6..d2fdab71e 100644 --- a/app/controllers/admin/domains_controller.rb +++ b/app/controllers/admin/domains_controller.rb @@ -38,3 +38,4 @@ class Admin::DomainsController < ApplicationController params.require(:domain).permit(:name, :period, :registrar_id, :owner_contact_id) end end + diff --git a/app/models/domain.rb b/app/models/domain.rb index 9b92c163f..b7b4b9f30 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -103,6 +103,11 @@ class Domain < ActiveRecord::Base errors.add(:period, :out_of_range) unless valid_values.include?(period.to_s) end + def all_dependencies_valid? + validate_nameservers_count + validate_admin_contacts_count + end + ## SHARED def to_s diff --git a/config/locales/en.yml b/config/locales/en.yml index a4e0f2aae..275431cb5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -67,7 +67,7 @@ en: blank: "Required parameter missing - ident" domains: exist: 'Object association prohibits operation' - epp_domain: + epp_domain: &epp_domain_ar_attributes attributes: name_dirty: invalid: 'Domain name is invalid' @@ -93,6 +93,8 @@ en: domain_statuses: not_found: 'Status was not found' taken: 'Status already exists on this domain' + domain: + <<: *epp_domain_ar_attributes nameserver: attributes: hostname: @@ -110,12 +112,15 @@ en: setting_id: taken: 'Status already exists on this domain' attributes: - epp_domain: + epp_domain: &epp_domain_attributes name: 'Domain name' name_dirty: 'Domain name' name_puny: 'Domain name' owner_contact: 'Registrant' nameservers: 'Nameservers' + domain: + <<: *epp_domain_attributes + errors: messages: