mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Add statuses to domain form
This commit is contained in:
parent
89295f5642
commit
44dce714b8
4 changed files with 32 additions and 2 deletions
|
@ -9,6 +9,7 @@ class Admin::DomainsController < ApplicationController
|
||||||
|
|
||||||
@domain.nameservers.build
|
@domain.nameservers.build
|
||||||
@domain.domain_contacts.build
|
@domain.domain_contacts.build
|
||||||
|
@domain.domain_statuses.build
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -69,7 +70,9 @@ class Admin::DomainsController < ApplicationController
|
||||||
:registrar_id,
|
:registrar_id,
|
||||||
:owner_contact_id,
|
:owner_contact_id,
|
||||||
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]
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_deletion
|
def verify_deletion
|
||||||
|
|
|
@ -19,6 +19,7 @@ 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
|
||||||
|
|
||||||
has_many :domain_transfers, dependent: :delete_all
|
has_many :domain_transfers, dependent: :delete_all
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
= render 'admin/domains/form_partials/nameservers', f: f
|
= render 'admin/domains/form_partials/nameservers', f: f
|
||||||
#contacts-tab.tab-pane
|
#contacts-tab.tab-pane
|
||||||
= render 'admin/domains/form_partials/contacts', f: f
|
= render 'admin/domains/form_partials/contacts', f: f
|
||||||
#statuses-tab.tab-pane ...
|
#statuses-tab.tab-pane
|
||||||
|
= render 'admin/domains/form_partials/statuses', f: f
|
||||||
.row
|
.row
|
||||||
.col-md-12.text-right
|
.col-md-12.text-right
|
||||||
= button_tag(t('shared.save'), class: 'btn btn-primary')
|
= button_tag(t('shared.save'), class: 'btn btn-primary')
|
||||||
|
|
25
app/views/admin/domains/form_partials/_statuses.haml
Normal file
25
app/views/admin/domains/form_partials/_statuses.haml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#domain_statuses
|
||||||
|
= f.fields_for :domain_statuses do |status_fields|
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-heading.text-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
|
||||||
|
.errors
|
||||||
|
= render 'admin/shared/errors', object: status_fields.object
|
||||||
|
.row
|
||||||
|
.col-md-6
|
||||||
|
.form-group
|
||||||
|
= status_fields.label :value
|
||||||
|
= status_fields.select :value, options_for_select(DomainStatus::STATUSES, status_fields.object.value), {include_blank: true}, {class: 'form-control'}
|
||||||
|
.col-md-6
|
||||||
|
.form-group
|
||||||
|
= status_fields.label :description
|
||||||
|
= status_fields.text_field :description, class: 'form-control', autocomplete: 'off'
|
||||||
|
:javascript
|
||||||
|
$("#domain_statuses").nestedAttributes({
|
||||||
|
bindAddTo: $(".add-domain-status"),
|
||||||
|
afterAdd: function(item) {
|
||||||
|
item.find('.errors').html('');
|
||||||
|
}
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue