mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +02:00
Domain form has now domain_contact part
This commit is contained in:
parent
4fef7e94c8
commit
d3e3c9e8b0
6 changed files with 41 additions and 12 deletions
2
Gemfile
2
Gemfile
|
@ -97,7 +97,7 @@ group :development, :test do
|
|||
|
||||
# For debugging
|
||||
gem 'pry', '~> 0.10.1'
|
||||
gem 'pry-byebug', '~> 1.3.3'
|
||||
# gem 'pry-byebug', '~> 1.3.3'
|
||||
|
||||
# Testing framework
|
||||
gem 'rspec-rails', '~> 3.0.2'
|
||||
|
|
|
@ -32,9 +32,6 @@ GEM
|
|||
bootstrap-sass (3.2.0.1)
|
||||
sass (~> 3.2)
|
||||
builder (3.2.2)
|
||||
byebug (2.7.0)
|
||||
columnize (~> 0.3)
|
||||
debugger-linecache (~> 1.2)
|
||||
capybara (2.4.1)
|
||||
mime-types (>= 1.16)
|
||||
nokogiri (>= 1.3.3)
|
||||
|
@ -52,9 +49,7 @@ GEM
|
|||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.7.0)
|
||||
columnize (0.8.9)
|
||||
database_cleaner (1.3.0)
|
||||
debugger-linecache (1.2.0)
|
||||
diff-lcs (1.2.5)
|
||||
epp (1.4.0)
|
||||
hpricot
|
||||
|
@ -136,9 +131,6 @@ GEM
|
|||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
slop (~> 3.4)
|
||||
pry-byebug (1.3.3)
|
||||
byebug (~> 2.7)
|
||||
pry (~> 0.10)
|
||||
rack (1.5.2)
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
|
@ -272,7 +264,6 @@ DEPENDENCIES
|
|||
phantomjs (~> 1.9.7.1)
|
||||
poltergeist (~> 1.5.1)
|
||||
pry (~> 0.10.1)
|
||||
pry-byebug (~> 1.3.3)
|
||||
rails (= 4.1.4)
|
||||
ransack (~> 1.3.0)
|
||||
rspec-rails (~> 3.0.2)
|
||||
|
|
|
@ -8,6 +8,7 @@ class Admin::DomainsController < ApplicationController
|
|||
params[:domain_owner_contact] = owner_contact
|
||||
|
||||
@domain.nameservers.build
|
||||
@domain.domain_contacts.build
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -61,7 +62,14 @@ class Admin::DomainsController < ApplicationController
|
|||
end
|
||||
|
||||
def domain_params
|
||||
params.require(:domain).permit(:name, :period, :period_unit, :registrar_id, :owner_contact_id, nameservers_attributes: [:id, :hostname, :ipv4, :ipv6, :_destroy])
|
||||
params.require(:domain).permit(
|
||||
:name,
|
||||
:period,
|
||||
:period_unit,
|
||||
:registrar_id,
|
||||
:owner_contact_id,
|
||||
nameservers_attributes: [:id, :hostname, :ipv4, :ipv6, :_destroy],
|
||||
domain_contacts_attributes: [:id, :contact_type, :contact_id, :_destroy])
|
||||
end
|
||||
|
||||
def verify_deletion
|
||||
|
|
|
@ -4,7 +4,8 @@ class Domain < ActiveRecord::Base
|
|||
belongs_to :registrar
|
||||
belongs_to :owner_contact, class_name: 'Contact'
|
||||
|
||||
has_many :domain_contacts, dependent: :delete_all, autosave: true
|
||||
has_many :domain_contacts, dependent: :delete_all
|
||||
accepts_nested_attributes_for :domain_contacts, allow_destroy: true
|
||||
|
||||
has_many :tech_contacts, -> do
|
||||
where(domain_contacts: { contact_type: DomainContact::TECH })
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#nameservers-tab.tab-pane
|
||||
= render 'admin/domains/form_partials/nameservers', f: f
|
||||
#tech-contacts-tab.tab-pane
|
||||
= render 'admin/domains/form_partials/tech_contacts', f: f
|
||||
#admin-contacts-tab.tab-pane ...
|
||||
#statuses-tab.tab-pane ...
|
||||
.row
|
||||
|
|
28
app/views/admin/domains/form_partials/_tech_contacts.haml
Normal file
28
app/views/admin/domains/form_partials/_tech_contacts.haml
Normal file
|
@ -0,0 +1,28 @@
|
|||
#domain_contacts
|
||||
= f.fields_for :domain_contacts do |contact_fields|
|
||||
.panel.panel-default
|
||||
.panel-heading.text-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
|
||||
.errors
|
||||
= render 'admin/shared/errors', object: contact_fields.object
|
||||
.row
|
||||
.col-md-6
|
||||
.form-group
|
||||
= contact_fields.label :contact_type
|
||||
= contact_fields.select :contact_type, options_for_select(DomainContact::TYPES, contact_fields.object.contact_type), {}, {class: 'form-control'}
|
||||
.col-md-6
|
||||
.form-group.has-feedback
|
||||
= label_tag :contact
|
||||
= text_field_tag(:contact, params[:contact], 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-remove.form-control-feedback.js-typeahead-remove
|
||||
= contact_fields.hidden_field(:contact_id, class: 'js-contact-id')
|
||||
:javascript
|
||||
$("#domain_contacts").nestedAttributes({
|
||||
bindAddTo: $(".add-domain-contact"),
|
||||
afterAdd: function(item) {
|
||||
item.find('.errors').html('');
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue