mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Contextual panels in domain show
This commit is contained in:
parent
7f26c8c769
commit
df5da8dc4b
4 changed files with 25 additions and 9 deletions
|
@ -6,7 +6,11 @@ class Admin::DomainsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@domain = Domain.new(domain_params)
|
@domain = Domain.new({
|
||||||
|
valid_from: Date.today,
|
||||||
|
valid_to: Date.today + 1.year,
|
||||||
|
registered_at: Time.zone.now
|
||||||
|
}.merge(domain_params))
|
||||||
|
|
||||||
if @domain.save
|
if @domain.save
|
||||||
redirect_to [:admin, @domain]
|
redirect_to [:admin, @domain]
|
||||||
|
@ -20,6 +24,10 @@ class Admin::DomainsController < ApplicationController
|
||||||
@domains = @q.result.page(params[:page])
|
@domains = @q.result.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@domain.all_dependencies_valid?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_domain
|
def set_domain
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Admin::NameserversController < ApplicationController
|
class Admin::NameserversController < ApplicationController
|
||||||
def new
|
def new
|
||||||
@domain = Domain.find_by(params[:id])
|
@domain = Domain.find(params[:domain_id])
|
||||||
@nameserver = @domain.nameservers.build
|
@nameserver = @domain.nameservers.build
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
.panel.panel-default
|
- panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default'
|
||||||
|
.panel{class: panel_class}
|
||||||
.panel-heading= t('shared.admin_contacts')
|
.panel-heading= t('shared.admin_contacts')
|
||||||
.table-responsive
|
.table-responsive
|
||||||
%table.table.table-hover.table-bordered.table-condensed
|
%table.table.table-hover.table-bordered.table-condensed
|
||||||
|
@ -15,4 +16,8 @@
|
||||||
%td
|
%td
|
||||||
= link_to(t('shared.edit'), root_path, class: 'btn btn-primary btn-xs')
|
= link_to(t('shared.edit'), root_path, class: 'btn btn-primary btn-xs')
|
||||||
= link_to(t('shared.detach'), root_path, method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-warning btn-xs')
|
= link_to(t('shared.detach'), root_path, method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-warning btn-xs')
|
||||||
|
- if @domain.errors.messages[:admin_contacts]
|
||||||
|
%tfoot
|
||||||
|
- @domain.errors.messages[:admin_contacts].each do |x|
|
||||||
|
%tr
|
||||||
|
%td{colspan: 4}= x
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
.panel.panel-default
|
- panel_class = @domain.errors.messages[:nameservers] ? 'panel-danger' : 'panel-default'
|
||||||
|
.panel{class: panel_class}
|
||||||
.panel-heading.clearfix
|
.panel-heading.clearfix
|
||||||
.pull-left
|
.pull-left
|
||||||
= t('shared.nameservers')
|
= t('shared.nameservers')
|
||||||
|
@ -21,7 +22,9 @@
|
||||||
%td
|
%td
|
||||||
= link_to(t('shared.edit'), root_path, class: 'btn btn-primary btn-xs')
|
= link_to(t('shared.edit'), root_path, class: 'btn btn-primary btn-xs')
|
||||||
= link_to(t('shared.delete'), root_path, method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-danger btn-xs')
|
= link_to(t('shared.delete'), root_path, method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-danger btn-xs')
|
||||||
|
- if @domain.errors.messages[:nameservers]
|
||||||
%tfoot
|
%tfoot
|
||||||
|
- @domain.errors.messages[:nameservers].each do |x|
|
||||||
%tr
|
%tr
|
||||||
%td{colspan: 4}
|
%td{colspan: 4}= x
|
||||||
Nameservers count must be between %{min}-%{max}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue