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
|
||||
|
||||
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
|
||||
redirect_to [:admin, @domain]
|
||||
|
@ -20,6 +24,10 @@ class Admin::DomainsController < ApplicationController
|
|||
@domains = @q.result.page(params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
@domain.all_dependencies_valid?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_domain
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Admin::NameserversController < ApplicationController
|
||||
def new
|
||||
@domain = Domain.find_by(params[:id])
|
||||
@domain = Domain.find(params[:domain_id])
|
||||
@nameserver = @domain.nameservers.build
|
||||
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')
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-bordered.table-condensed
|
||||
|
@ -15,4 +16,8 @@
|
|||
%td
|
||||
= 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')
|
||||
|
||||
- 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
|
||||
.pull-left
|
||||
= t('shared.nameservers')
|
||||
|
@ -21,7 +22,9 @@
|
|||
%td
|
||||
= 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')
|
||||
%tfoot
|
||||
%tr
|
||||
%td{colspan: 4}
|
||||
Nameservers count must be between %{min}-%{max}
|
||||
- if @domain.errors.messages[:nameservers]
|
||||
%tfoot
|
||||
- @domain.errors.messages[:nameservers].each do |x|
|
||||
%tr
|
||||
%td{colspan: 4}= x
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue