mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
Merge branch 'master' into registry-623
# Conflicts: # app/controllers/admin/registrars_controller.rb # app/models/registrar.rb # app/views/admin/registrars/_billing.html.erb # app/views/admin/registrars/show.html.erb # config/locales/admin/registrars.en.yml # config/locales/en.yml # db/migrate/20180309053424_add_registrars_unique_constraints.rb # db/structure.sql # test/fixtures/registrars.yml # test/integration/admin/registrars/delete_test.rb # test/integration/admin/registrars/new_test.rb # test/models/registrar_test.rb
This commit is contained in:
commit
837f326ef6
37 changed files with 232 additions and 245 deletions
|
@ -9,6 +9,7 @@
|
|||
#= require select2
|
||||
#= require jquery.doubleScroll
|
||||
#= require datepicker
|
||||
#= require spell_check
|
||||
#= require admin/application
|
||||
#= require admin/app
|
||||
#= require_tree ./admin
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
#= require jquery-ui/datepicker
|
||||
#= require select2
|
||||
#= require datepicker
|
||||
#= require spell_check
|
||||
#= require shared/general
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#= require jquery-ui/datepicker
|
||||
#= require select2
|
||||
#= require datepicker
|
||||
#= require spell_check
|
||||
#= require shared/general
|
||||
#= require registrar/autocomplete
|
||||
#= require registrar/application
|
||||
|
|
12
app/assets/javascripts/spell_check.js
Normal file
12
app/assets/javascripts/spell_check.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
(function() {
|
||||
function disableSpellCheck() {
|
||||
let selector = 'input[type=text], textarea';
|
||||
let textFields = document.querySelectorAll(selector);
|
||||
|
||||
for (let field of textFields) {
|
||||
field.spellcheck = false;
|
||||
}
|
||||
}
|
||||
|
||||
disableSpellCheck();
|
||||
})();
|
|
@ -43,8 +43,13 @@ module Admin
|
|||
end
|
||||
|
||||
def destroy
|
||||
@registrar.destroy!
|
||||
redirect_to admin_registrars_url, notice: t('.deleted')
|
||||
if @registrar.destroy
|
||||
flash[:notice] = t('.deleted')
|
||||
redirect_to admin_registrars_url
|
||||
else
|
||||
flash[:alert] = @registrar.errors.full_messages.first
|
||||
redirect_to admin_registrar_url(@registrar)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -64,7 +69,6 @@ module Admin
|
|||
:email,
|
||||
:phone,
|
||||
:website,
|
||||
:billing_email,
|
||||
:code,
|
||||
:test_registrar,
|
||||
:vat_no,
|
||||
|
|
|
@ -3,7 +3,7 @@ class Registrar
|
|||
protect_from_forgery except: :back
|
||||
|
||||
skip_authorization_check # actually anyone can pay, no problems at all
|
||||
skip_before_action :authenticate_user!, :check_ip, only: [:back]
|
||||
skip_before_action :authenticate_user!, :check_ip_restriction, only: [:back]
|
||||
before_action :check_bank
|
||||
|
||||
# to handle existing model we should
|
||||
|
|
|
@ -14,9 +14,10 @@ class Registrar < ActiveRecord::Base
|
|||
delegate :balance, to: :cash_account, allow_nil: true
|
||||
|
||||
validates :name, :reg_no, :country_code, :email, :code, presence: true
|
||||
validates :name, :reg_no, :reference_no, :code, uniqueness: true
|
||||
validates :name, :reference_no, :code, uniqueness: true
|
||||
validates :accounting_customer_code, presence: true
|
||||
validates :language, presence: true
|
||||
validate :forbid_special_code
|
||||
|
||||
validates :vat_rate, presence: true, if: 'foreign_vat_payer? && vat_no.blank?'
|
||||
validates :vat_rate, absence: true, if: :home_vat_payer?
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
%dt= t(:currency)
|
||||
%dd= @bank_transaction.currency
|
||||
|
||||
%dt= t(:reference_no)
|
||||
%dt= BankTransaction.human_attribute_name :reference_no
|
||||
%dd= @bank_transaction.reference_no
|
||||
|
||||
%dt= t(:paid_at)
|
||||
|
|
24
app/views/admin/registrars/_contacts.html.erb
Normal file
24
app/views/admin/registrars/_contacts.html.erb
Normal file
|
@ -0,0 +1,24 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<%= t '.header' %>
|
||||
</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><%= Registrar.human_attribute_name :billing_email %></dt>
|
||||
<dd><%= @registrar.billing_email %></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
27
app/views/admin/registrars/_details.html.erb
Normal file
27
app/views/admin/registrars/_details.html.erb
Normal file
|
@ -0,0 +1,27 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<%= t '.header' %>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt><%= Registrar.human_attribute_name :name %></dt>
|
||||
<dd><%= registrar.name %></dd>
|
||||
|
||||
<dt><%= Registrar.human_attribute_name :reg_no %></dt>
|
||||
<dd><%= registrar.reg_no %></dd>
|
||||
|
||||
<dt><%= Registrar.human_attribute_name :reference_no %></dt>
|
||||
<dd><%= registrar.reference_no %></dd>
|
||||
|
||||
<dt><%= Registrar.human_attribute_name :code %></dt>
|
||||
<dd><%= registrar.code %></dd>
|
||||
|
||||
<dt><%= Registrar.human_attribute_name :balance %></dt>
|
||||
<dd><%= registrar.balance %></dd>
|
||||
|
||||
<dt><%= Registrar.human_attribute_name :website %></dt>
|
||||
<dd><%= registrar.website %></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
28
app/views/admin/registrars/_users.html.erb
Normal file
28
app/views/admin/registrars/_users.html.erb
Normal file
|
@ -0,0 +1,28 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<%= t '.header' %>
|
||||
</div>
|
||||
|
||||
<table class="table table-hover table-bordered table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-6"><%= ApiUser.human_attribute_name :username %></th>
|
||||
<th class="col-xs-6"><%= ApiUser.human_attribute_name :active %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% registrar.api_users.each do |user| %>
|
||||
<tr>
|
||||
<td><%= link_to(user, [:admin, user]) %></td>
|
||||
<td><%= user.active %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="panel-footer text-right">
|
||||
<%= link_to t('.new_btn'), new_admin_registrar_api_user_path(registrar),
|
||||
class: 'btn btn-default btn-xs' %>
|
||||
</div>
|
||||
</div>
|
38
app/views/admin/registrars/_white_ips.html.erb
Normal file
38
app/views/admin/registrars/_white_ips.html.erb
Normal file
|
@ -0,0 +1,38 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<%= t '.header' %>
|
||||
</div>
|
||||
|
||||
<table class="table table-hover table-bordered table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-4"><%= WhiteIp.human_attribute_name :ipv4 %></th>
|
||||
<th class="col-xs-6"><%= WhiteIp.human_attribute_name :ipv6 %></th>
|
||||
<th class="col-xs-2"><%= WhiteIp.human_attribute_name :interfaces %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% registrar.white_ips.each do |white_ip| %>
|
||||
<tr>
|
||||
<td>
|
||||
<% if white_ip.ipv4.present? %>
|
||||
<%= link_to(white_ip.ipv4, [:admin, registrar, white_ip]) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if white_ip.ipv6.present? %>
|
||||
<%= link_to(white_ip.ipv6, [:admin, registrar, white_ip]) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= white_ip.interfaces.join(', ').upcase %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="panel-footer text-right">
|
||||
<%= link_to t('.new_btn'), new_admin_registrar_white_ip_path(registrar),
|
||||
class: 'btn btn-default btn-xs' %>
|
||||
</div>
|
||||
</div>
|
|
@ -20,10 +20,10 @@
|
|||
<%= sort_link(@q, 'name') %>
|
||||
</th>
|
||||
<th class="col-xs-4">
|
||||
<%= sort_link(@q, 'reg_no', t(:reg_no)) %>
|
||||
<%= sort_link(@q, 'reg_no', Registrar.human_attribute_name(:reg_no)) %>
|
||||
</th>
|
||||
<th class="col-xs-4">
|
||||
<%= t(:credit_balance) %>
|
||||
<%= Registrar.human_attribute_name :balance %>
|
||||
</th>
|
||||
<th class="col-xs-4">
|
||||
<%= t(:test_registrar) %>
|
||||
|
|
|
@ -26,198 +26,25 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<% 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(: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>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<%= render 'details', registrar: @registrar %>
|
||||
</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_email) %>
|
||||
</dt>
|
||||
<dd>
|
||||
<%= @registrar.billing_email %>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<%= render 'contacts', registrar: @registrar %>
|
||||
<%= render 'billing', registrar: @registrar %>
|
||||
<%= render 'admin/registrars/show/preferences', registrar: registrar %>
|
||||
<%= render 'preferences', registrar: registrar %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<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>
|
||||
<%= render 'users', registrar: @registrar %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<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>
|
||||
<%= render 'white_ips', registrar: @registrar %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- content_for :actions do
|
||||
= link_to(t(:back_to_registrar), admin_registrar_path(@registrar), class: 'btn btn-default')
|
||||
|
||||
= render 'shared/title', name: t(:create_new_white_ip)
|
||||
= render 'shared/title', name: t('.header')
|
||||
= render 'form'
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
%dt= t(:registrar_name)
|
||||
%dd= link_to(@registrar, [:admin, @registrar])
|
||||
|
||||
%dt= t(:ipv4)
|
||||
%dt= WhiteIp.human_attribute_name :ipv4
|
||||
%dd= @white_ip.ipv4
|
||||
|
||||
%dt= t(:ipv6)
|
||||
%dt= WhiteIp.human_attribute_name :ipv6
|
||||
%dd= @white_ip.ipv6
|
||||
|
||||
%dt= t(:interfaces)
|
||||
%dt= WhiteIp.human_attribute_name :interfaces
|
||||
%dd= @white_ip.interfaces.join(', ').upcase
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
%th{class: 'col-xs-6'}
|
||||
= sort_link(@q, 'name')
|
||||
%th{class: 'col-xs-6'}
|
||||
= sort_link(@q, 'reg_no', t(:reg_no))
|
||||
= sort_link(@q, 'reg_no', Registrar.human_attribute_name(:reg_no))
|
||||
%tbody
|
||||
- @registrars.each do |x|
|
||||
%tr
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
%dt= t(:name)
|
||||
%dd= @registrar.name
|
||||
|
||||
%dt= t(:reg_no)
|
||||
%dt= Registrar.human_attribute_name :reg_no
|
||||
%dd= @registrar.reg_no
|
||||
|
||||
%dt= Registrar.human_attribute_name :vat_no
|
||||
|
|
|
@ -32,5 +32,5 @@
|
|||
%dt= t(:description)
|
||||
%dd=@invoice.description
|
||||
|
||||
%dt= t(:reference_no)
|
||||
%dt= Invoice.human_attribute_name :reference_no
|
||||
%dd= @invoice.reference_no
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%dt= t(:name)
|
||||
%dd= @invoice.seller_name
|
||||
|
||||
%dt= t(:reg_no)
|
||||
%dt= Registrar.human_attribute_name :reg_no
|
||||
%dd= @invoice.seller_reg_no
|
||||
|
||||
%dt= t(:iban)
|
||||
|
|
|
@ -182,7 +182,7 @@
|
|||
%dt= t(:description)
|
||||
%dd=@invoice.description
|
||||
|
||||
%dt= t(:reference_no)
|
||||
%dt= Invoice.human_attribute_name :reference_no
|
||||
%dd= @invoice.reference_no
|
||||
|
||||
.col-md-6.right
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
<div class="col-md-5">
|
||||
<%= text_field_tag :old_hostname, params[:old_hostname], autofocus: true,
|
||||
required: true,
|
||||
spellcheck: false,
|
||||
class: 'form-control' %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -19,7 +18,6 @@
|
|||
|
||||
<div class="col-md-5">
|
||||
<%= text_field_tag :new_hostname, params[:new_hostname], required: true,
|
||||
spellcheck: false,
|
||||
class: 'form-control' %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -30,7 +28,7 @@
|
|||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<%= text_area_tag :ipv4, params[:ipv4], spellcheck: false, class: 'form-control' %>
|
||||
<%= text_area_tag :ipv4, params[:ipv4], class: 'form-control' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -40,7 +38,7 @@
|
|||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<%= text_area_tag :ipv6, params[:ipv6], spellcheck: false, class: 'form-control' %>
|
||||
<%= text_area_tag :ipv6, params[:ipv6], class: 'form-control' %>
|
||||
<span class="help-block"><%= t '.ip_hint' %></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue