Merge branch 'refactor-admin-registrars' into registry-640

This commit is contained in:
Artur Beljajev 2017-11-22 03:08:46 +02:00
commit e7d23c2678
13 changed files with 481 additions and 259 deletions

View file

@ -1,105 +0,0 @@
= form_for([:admin, @registrar], html: {class: 'form-horizontal'}) do |f|
= render 'shared/full_errors', object: @registrar
.row
.col-md-8
.panel.panel-default
.panel-heading.clearfix
.pull-left= t(:general)
.panel-body
.form-group
.col-md-4.control-label
= f.label :name
.col-md-7
= f.text_field(:name, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :reg_no
.col-md-7
= f.text_field(:reg_no, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :vat_no
.col-md-7
= f.text_field(:vat_no, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :phone
.col-md-7
= f.text_field(:phone, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :website
.col-md-7
= f.url_field :website, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :email
.col-md-7
= f.email_field :email, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :billing_email
.col-md-7
= f.email_field :billing_email, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :accounting_customer_code
.col-md-7
= f.text_field :accounting_customer_code, class: 'form-control', required: true
.row
.col-md-8
.panel.panel-default
.panel-heading.clearfix
.pull-left= t(:address)
.panel-body
.form-group
.col-md-4.control-label
= f.label :street
.col-md-7
= f.text_field(:street, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :city
.col-md-7
= f.text_field(:city, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :state
.col-md-7
= f.text_field(:state, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :zip
.col-md-7
= f.text_field(:zip, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :country_code, t(:country)
.col-md-7
= f.select(:country_code,
SortedCountry.all_options(f.object.country_code), {}, class: 'form-control')
.row
.col-md-8
.panel.panel-default
.panel-heading.clearfix
.pull-left= t('.misc')
.panel-body
.form-group
.col-md-4.control-label
= f.label :code
.col-md-7
= f.text_field(:code, class: 'form-control', disabled: !f.object.new_record?)
.form-group
.col-md-4.control-label
= f.label :test_registrar
.col-md-7
= f.check_box :test_registrar, class: 'form-control'
%hr
.row
.col-md-8.text-right
= button_tag(t(".#{f.object.new_record? ? 'create' : 'update'}_btn"), class: 'btn btn-success')

View file

@ -0,0 +1,158 @@
<%= form_for([:admin, @registrar], html: { class: 'form-horizontal' }) do |f| %>
<%= render 'shared/full_errors', object: @registrar %>
<div class="row">
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="pull-left">
<%= t(:general) %>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :name %>
</div>
<div class="col-md-7">
<%= f.text_field :name, required: true, autofocus: true, class: 'form-control' %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :reg_no %>
</div>
<div class="col-md-7">
<%= f.text_field :reg_no, required: true, class: 'form-control' %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :phone %>
</div>
<div class="col-md-7">
<%= f.text_field(:phone, class: 'form-control') %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :website %>
</div>
<div class="col-md-7">
<%= f.url_field :website, class: 'form-control' %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :email %>
</div>
<div class="col-md-7">
<%= f.email_field :email, required: true, class: 'form-control' %>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="pull-left">
<%= t(:address) %>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :street %>
</div>
<div class="col-md-7">
<%= f.text_field(:street, class: 'form-control') %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :city %>
</div>
<div class="col-md-7">
<%= f.text_field(:city, class: 'form-control') %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :state %>
</div>
<div class="col-md-7">
<%= f.text_field(:state, class: 'form-control') %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :zip %>
</div>
<div class="col-md-7">
<%= f.text_field(:zip, class: 'form-control') %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :country_code, t(:country) %>
</div>
<div class="col-md-7">
<%= f.select(:country_code, SortedCountry.all_options(f.object.country_code), {}, class: 'form-control') %>
</div>
</div>
</div>
</div>
</div>
</div>
<%= render 'admin/registrars/form/billing', f: f %>
<div class="row">
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="pull-left">
<%= t('.misc') %>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :code %>
</div>
<div class="col-md-7">
<%= f.text_field :code, required: f.object.new_record?, class: 'form-control', disabled: !f.object.new_record? %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :test_registrar %>
</div>
<div class="col-md-7">
<%= f.check_box :test_registrar, class: 'form-control' %>
</div>
</div>
</div>
</div>
</div>
</div>
<hr/>
<div class="row">
<div class="col-md-8 text-right">
<%= button_tag(t(".#{f.object.new_record? ? 'create' : 'update'}_btn"), class: 'btn btn-success') %>
</div>
</div>
<% end %>

View file

@ -1,5 +0,0 @@
- content_for :actions do
= link_to(t(:back_to_registrar), [:admin, @registrar], class: 'btn btn-default')
= render 'shared/title', name: "#{t(:edit)}: #{@registrar.name}"
= render 'form'

View file

@ -0,0 +1,5 @@
<% content_for :actions do %>
<%= link_to(t(:back_to_registrar), [:admin, @registrar], class: 'btn btn-default') %>
<% end %>
<%= render 'shared/title', name: "#{t(:edit)}: #{@registrar.name}" %>
<%= render 'form' %>

View file

@ -0,0 +1,40 @@
<div class="row">
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="pull-left">
<%= t '.header' %>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :vat_no %>
</div>
<div class="col-md-7">
<%= f.text_field :vat_no, class: 'form-control' %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :accounting_customer_code %>
</div>
<div class="col-md-7">
<%= f.text_field :accounting_customer_code, class: 'form-control', required: true %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :billing_email %>
</div>
<div class="col-md-7">
<%= f.email_field :billing_email, class: 'form-control' %>
</div>
</div>
</div>
</div>
</div>
</div>

View file

@ -1,28 +0,0 @@
- content_for :actions do
= link_to(t('.new_btn'), new_admin_registrar_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:registrars)
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}
= sort_link(@q, 'name')
%th{class: 'col-xs-4'}
= sort_link(@q, 'reg_no', t(:reg_no))
%th{class: 'col-xs-4'}
= t(:credit_balance)
%th{class: 'col-xs-4'}
= t(:test_registrar)
%tbody
- @registrars.each do |x|
%tr
%td= link_to(x, [:admin, x])
%td= x.reg_no
%td= "#{x.balance}"
%td= "#{x.test_registrar}"
.row
.col-md-12
= paginate @registrars

View file

@ -0,0 +1,51 @@
<% content_for :actions do %>
<%= link_to(t('.new_btn'), new_admin_registrar_path, class: 'btn btn-primary') %>
<% end %>
<%= render 'shared/title', name: t(:registrars) %>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-hover table-bordered table-condensed">
<thead>
<tr>
<th class="col-xs-4">
<%= sort_link(@q, 'name') %>
</th>
<th class="col-xs-4">
<%= sort_link(@q, 'reg_no', t(:reg_no)) %>
</th>
<th class="col-xs-4">
<%= t(:credit_balance) %>
</th>
<th class="col-xs-4">
<%= t(:test_registrar) %>
</th>
</tr>
</thead>
<tbody>
<% @registrars.each do |x| %>
<tr>
<td>
<%= link_to(x, [:admin, x]) %>
</td>
<td>
<%= x.reg_no %>
</td>
<td>
<%= "#{x.balance}" %>
</td>
<td>
<%= "#{x.test_registrar}" %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<%= paginate @registrars %>
</div>
</div>

View file

@ -1,3 +0,0 @@
= render 'shared/title', name: t(:new_registrar)
= render 'form'

View file

@ -0,0 +1,2 @@
<%= render 'shared/title', name: t(:new_registrar) %>
<%= render 'form' %>

View file

@ -1,118 +0,0 @@
- content_for :actions do
= link_to(t(:edit), edit_admin_registrar_path(@registrar), class: 'btn btn-primary')
= link_to(t(:delete), admin_registrar_path(@registrar),
method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger')
- content_for :page_name do
= @registrar.name
- if @registrar.test_registrar?
%span{style: "color: #c9302c;"} (test)
= render 'shared/title', name: @registrar.name
- if @registrar.errors.any?
- @registrar.errors.each do |attr, err|
= err
%br
- if @registrar.errors.any?
%hr
.row
.col-md-6
.panel.panel-default
.panel-heading
%h3.panel-title= t(:general)
.panel-body
%dl.dl-horizontal
%dt= t(:name)
%dd= @registrar.name
%dt= t(:reg_no)
%dd= @registrar.reg_no
%dt= t(:vat_no)
%dd= @registrar.vat_no
%dt= t(:reference_no)
%dd= @registrar.reference_no
%dt= t(:id)
%dd= @registrar.code
%dt= t(:credit_balance)
%dd= @registrar.balance
%dt= Registrar.human_attribute_name :website
%dd= @registrar.website
%dt= Registrar.human_attribute_name :accounting_customer_code
%dd= @registrar.accounting_customer_code
.col-md-6
.panel.panel-default
.panel-heading
%h3.panel-title= t(:contact)
.panel-body
%dl.dl-horizontal
%dt= t(:country)
%dd= @registrar.country
%dt= t(:address)
%dd= @registrar.address
%dt= t(:contact_phone)
%dd= @registrar.phone
%dt= t(:contact_email)
%dd= @registrar.email
%dt= t(:billing_address)
%dd= @registrar.billing_address
%dt= t(:billing_email)
%dd= @registrar.billing_email
.row
.col-md-12
#epp-users.panel.panel-default
.panel-heading.clearfix
.pull-left
= t('.api_users')
.pull-right
= link_to(t('.new_api_use_btn'), new_admin_registrar_api_user_path(@registrar), class: 'btn btn-default btn-xs')
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-6'}= t(:username)
%th{class: 'col-xs-6'}= t('.active')
%tbody
- @registrar.api_users.each do |x|
%tr
%td= link_to(x, [:admin, x])
%td= x.active
.row
.col-md-12
#epp-users.panel.panel-default
.panel-heading.clearfix
.pull-left
= t(:white_ips)
.pull-right
= link_to(t(:create_new_white_ip), new_admin_registrar_white_ip_path(@registrar), class: 'btn btn-default btn-xs')
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t(:ipv4)
%th{class: 'col-xs-6'}= t(:ipv6)
%th{class: 'col-xs-2'}= t(:interfaces)
%tbody
- @registrar.white_ips.each do |x|
%tr
%td
- if x.ipv4.present?
= link_to(x.ipv4, [:admin, @registrar, x])
%td
- if x.ipv6.present?
= link_to(x.ipv6, [:admin, @registrar, x])
%td= x.interfaces.join(', ').upcase

View file

@ -0,0 +1,222 @@
<% content_for :actions do %>
<%= link_to(t(:edit), edit_admin_registrar_path(@registrar), class: 'btn btn-primary') %>
<%= link_to(t(:delete), admin_registrar_path(@registrar), method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger') %>
<% end %>
<% content_for :page_name do %>
<%= @registrar.name %>
<% if @registrar.test_registrar? %>
<span style="color: #c9302c;">(test)</span>
<% end %>
<% end %>
<%= render 'shared/title', name: @registrar.name %>
<% if @registrar.errors.any? %>
<% @registrar.errors.each do |attr, err| %>
<%= err %>
<br/>
<% end %>
<% end %>
<% if @registrar.errors.any? %>
<hr/>
<% end %>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<%= t(:general) %>
</h3>
</div>
<div class="panel-body">
<dl class="dl-horizontal">
<dt>
<%= t(:name) %>
</dt>
<dd>
<%= @registrar.name %>
</dd>
<dt>
<%= t(:reg_no) %>
</dt>
<dd>
<%= @registrar.reg_no %>
</dd>
<dt>
<%= t(:vat_no) %>
</dt>
<dd>
<%= @registrar.vat_no %>
</dd>
<dt>
<%= t(:reference_no) %>
</dt>
<dd>
<%= @registrar.reference_no %>
</dd>
<dt>
<%= t(:id) %>
</dt>
<dd>
<%= @registrar.code %>
</dd>
<dt>
<%= t(:credit_balance) %>
</dt>
<dd>
<%= @registrar.balance %>
</dd>
<dt>
<%= Registrar.human_attribute_name :website %>
</dt>
<dd>
<%= @registrar.website %>
</dd>
<dt>
<%= Registrar.human_attribute_name :accounting_customer_code %>
</dt>
<dd>
<%= @registrar.accounting_customer_code %>
</dd>
</dl>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<%= t(:contact) %>
</h3>
</div>
<div class="panel-body">
<dl class="dl-horizontal">
<dt>
<%= t(:country) %>
</dt>
<dd>
<%= @registrar.country %>
</dd>
<dt>
<%= t(:address) %>
</dt>
<dd>
<%= @registrar.address %>
</dd>
<dt>
<%= t(:contact_phone) %>
</dt>
<dd>
<%= @registrar.phone %>
</dd>
<dt>
<%= t(:contact_email) %>
</dt>
<dd>
<%= @registrar.email %>
</dd>
<dt>
<%= t(:billing_address) %>
</dt>
<dd>
<%= @registrar.billing_address %>
</dd>
<dt>
<%= t(:billing_email) %>
</dt>
<dd>
<%= @registrar.billing_email %>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default" id="epp-users">
<div class="panel-heading clearfix">
<div class="pull-left">
<%= t('.api_users') %>
</div>
<div class="pull-right">
<%= link_to(t('.new_api_use_btn'), new_admin_registrar_api_user_path(@registrar), class: 'btn btn-default btn-xs') %>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover table-bordered table-condensed">
<thead>
<tr>
<th class="col-xs-6">
<%= t(:username) %>
</th>
<th class="col-xs-6">
<%= t('.active') %>
</th>
</tr>
</thead>
<tbody>
<% @registrar.api_users.each do |x| %>
<tr>
<td>
<%= link_to(x, [:admin, x]) %>
</td>
<td>
<%= x.active %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default" id="epp-users">
<div class="panel-heading clearfix">
<div class="pull-left">
<%= t(:white_ips) %>
</div>
<div class="pull-right">
<%= link_to(t(:create_new_white_ip), new_admin_registrar_white_ip_path(@registrar), class: 'btn btn-default btn-xs') %>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover table-bordered table-condensed">
<thead>
<tr>
<th class="col-xs-4">
<%= t(:ipv4) %>
</th>
<th class="col-xs-6">
<%= t(:ipv6) %>
</th>
<th class="col-xs-2">
<%= t(:interfaces) %>
</th>
</tr>
</thead>
<tbody>
<% @registrar.white_ips.each do |x| %>
<tr>
<td>
<% if x.ipv4.present? %>
<%= link_to(x.ipv4, [:admin, @registrar, x]) %>
<% end %>
</td>
<td>
<% if x.ipv6.present? %>
<%= link_to(x.ipv6, [:admin, @registrar, x]) %>
<% end %>
</td>
<td>
<%= x.interfaces.join(', ').upcase %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>

View file

@ -21,3 +21,6 @@ en:
misc: Miscellaneous misc: Miscellaneous
create_btn: Create registrar create_btn: Create registrar
update_btn: Update registrar update_btn: Update registrar
billing:
header: Billing