mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Attach typeahead fields directly to domain
This commit is contained in:
parent
df5f987551
commit
8ea865f1b2
3 changed files with 17 additions and 4 deletions
|
@ -73,6 +73,8 @@ class Admin::DomainsController < ApplicationController
|
||||||
:period_unit,
|
:period_unit,
|
||||||
:registrar_id,
|
:registrar_id,
|
||||||
:owner_contact_id,
|
:owner_contact_id,
|
||||||
|
:owner_contact_typeahead,
|
||||||
|
:registrar_typeahead,
|
||||||
nameservers_attributes: [:id, :hostname, :ipv4, :ipv6, :_destroy],
|
nameservers_attributes: [:id, :hostname, :ipv4, :ipv6, :_destroy],
|
||||||
domain_contacts_attributes: [:id, :contact_type, :contact_id, :typeahead_value, :_destroy],
|
domain_contacts_attributes: [:id, :contact_type, :contact_id, :typeahead_value, :_destroy],
|
||||||
domain_statuses_attributes: [:id, :value, :description, :_destroy]
|
domain_statuses_attributes: [:id, :value, :description, :_destroy]
|
||||||
|
|
|
@ -45,6 +45,9 @@ class Domain < ActiveRecord::Base
|
||||||
validate :validate_admin_contacts_uniqueness, if: :new_record?
|
validate :validate_admin_contacts_uniqueness, if: :new_record?
|
||||||
validate :validate_domain_statuses_uniqueness, if: :new_record?
|
validate :validate_domain_statuses_uniqueness, if: :new_record?
|
||||||
|
|
||||||
|
attr_accessor :owner_contact_typeahead
|
||||||
|
attr_accessor :registrar_typeahead
|
||||||
|
|
||||||
def name=(value)
|
def name=(value)
|
||||||
value.strip!
|
value.strip!
|
||||||
write_attribute(:name, SimpleIDN.to_unicode(value))
|
write_attribute(:name, SimpleIDN.to_unicode(value))
|
||||||
|
@ -52,6 +55,14 @@ class Domain < ActiveRecord::Base
|
||||||
write_attribute(:name_dirty, value)
|
write_attribute(:name_dirty, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def owner_contact_typeahead
|
||||||
|
@owner_contact_typeahead || owner_contact.try(:name) || nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def registrar_typeahead
|
||||||
|
@registrar_typeahead || registrar || nil
|
||||||
|
end
|
||||||
|
|
||||||
def pending_transfer
|
def pending_transfer
|
||||||
domain_transfers.find_by(status: DomainTransfer::PENDING)
|
domain_transfers.find_by(status: DomainTransfer::PENDING)
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,14 +17,14 @@
|
||||||
= f.select :period_unit, options_for_select(['y', 'm', 'd'], @domain.period_unit), {}, {class: 'form-control'}
|
= f.select :period_unit, options_for_select(['y', 'm', 'd'], @domain.period_unit), {}, {class: 'form-control'}
|
||||||
.col-md-6
|
.col-md-6
|
||||||
.form-group.has-feedback.js-typeahead-container
|
.form-group.has-feedback.js-typeahead-container
|
||||||
= f.label :registrar
|
= f.label :registrar_typeahead
|
||||||
= text_field_tag(:domain_registrar, params[:registrar], class: 'form-control js-registrar-typeahead', placeholder: t('shared.registrar_name'), autocomplete: 'off')
|
= f.text_field(:registrar_typeahead, class: 'form-control js-registrar-typeahead', placeholder: t('shared.registrar_name'), autocomplete: 'off')
|
||||||
%span.glyphicon.glyphicon-ok.form-control-feedback.js-typeahead-ok.hidden
|
%span.glyphicon.glyphicon-ok.form-control-feedback.js-typeahead-ok.hidden
|
||||||
%span.glyphicon.glyphicon-remove.form-control-feedback.js-typeahead-remove
|
%span.glyphicon.glyphicon-remove.form-control-feedback.js-typeahead-remove
|
||||||
= f.hidden_field(:registrar_id, class: 'js-registrar-id')
|
= f.hidden_field(:registrar_id, class: 'js-registrar-id')
|
||||||
.form-group.has-feedback.js-typeahead-container
|
.form-group.has-feedback.js-typeahead-container
|
||||||
= f.label :owner_contact
|
= f.label :owner_contact_typeahead
|
||||||
= text_field_tag(:domain_owner_contact, params[:domain_owner_contact], class: 'form-control js-contact-typeahead', placeholder: t('shared.contact_code'), autocomplete: 'off')
|
= f.text_field(:owner_contact_typeahead, class: 'form-control js-contact-typeahead', placeholder: t('shared.contact_code'), autocomplete: 'off')
|
||||||
%span.glyphicon.glyphicon-ok.form-control-feedback.js-typeahead-ok.hidden
|
%span.glyphicon.glyphicon-ok.form-control-feedback.js-typeahead-ok.hidden
|
||||||
%span.glyphicon.glyphicon-remove.form-control-feedback.js-typeahead-remove
|
%span.glyphicon.glyphicon-remove.form-control-feedback.js-typeahead-remove
|
||||||
= f.hidden_field(:owner_contact_id, class: 'js-contact-id')
|
= f.hidden_field(:owner_contact_id, class: 'js-contact-id')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue