Registrar refactor

This commit is contained in:
Priit Tark 2015-04-09 17:09:18 +03:00
parent 6573d81b94
commit ec4c06bb06
95 changed files with 564 additions and 539 deletions

View file

@ -1,24 +0,0 @@
= form_for(@contact, html: {class: 'form-horizontal js-contact-form'}) do |f|
= render 'depp/shared/error_messages', f: f
= f.hidden_field :id
= f.hidden_field :password
.row
.col-md-12
= render 'depp/contacts/form_partials/general', f: f
.row
.col-md-12
= render 'depp/contacts/form_partials/address', f: f
- if !@contact.persisted?
.row
.col-md-12
= render 'depp/contacts/form_partials/code', f: f
.row
.col-md-12
= render 'depp/contacts/form_partials/legal_document', f: f
.row
.col-md-12.text-right
- if @contact.persisted?
= button_tag(t(:save), class: 'btn btn-primary')
- else
= button_tag(t(:create), class: 'btn btn-primary')

View file

@ -1,33 +0,0 @@
= render 'depp/shared/title', name: t(:contact_info)
%hr
.row
.col-md-12
= form_tag check_contacts_path, class: 'form-horizontal', method: :get do
.col-md-11
.form-group
= text_field_tag :contacts, params[:contacts], class: 'form-control', autocomplete: 'off'
.col-md-1.text-right.text-center-xs
.form-group
.col-md-offset-2.col-md-10
%button.btn.btn-primary
 
%span.glyphicon.glyphicon-search
 
- if @contacts
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th= t('id')
%th= t('value')
%tbody
- @contacts.each do |contact|
%tr
%td= contact[:id]
%td= contact[:reason]

View file

@ -1,18 +0,0 @@
- if @contact.persisted?
= render 'depp/shared/title', name: "#{t(:delete)}: #{@contact.name}"
= form_for(@contact, class: 'form-horizontal', multipart: true, method: :delete) do |f|
= render 'depp/shared/error_messages', f: f
= f.hidden_field :id
= f.hidden_field :password
.row
.col-md-12
= render 'depp/contacts/form_partials/legal_document', f: f
%hr
.row
.col-md-12.text-right
= button_tag t(:delete), class: 'btn btn-danger'
- else
%h2= "#{t(:delete)}: #{t(:not_found)}"

View file

@ -1,3 +0,0 @@
= render 'depp/shared/title', name: "#{t(:edit)}: #{@contact.name}"
= render 'form'

View file

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

View file

@ -1,16 +0,0 @@
- if @contact.id.present?
- content_for :actions do
= link_to(t(:edit), edit_contact_path(@contact.id), class: 'btn btn-primary')
= link_to(t(:delete), delete_contact_path(@contact.id), class: 'btn btn-default')
= render 'depp/shared/title', name: truncate(@contact.name)
.row
.col-md-6= render 'depp/contacts/partials/general'
.col-md-6= render 'depp/contacts/partials/address'
.row
.col-md-12= render 'depp/contacts/partials/statuses', statuses: @contact.statuses
- else
.row
.col-sm-6
%h1= t(:not_found)

View file

@ -1,5 +0,0 @@
= render 'depp/shared/title', name: t(:check_domain)
.row
.col-md-12
= render 'check_form'

View file

@ -1,4 +0,0 @@
= render 'depp/shared/title', name: "#{t(:edit)}: #{params[:domain_name]}"
%hr
= render 'form'

View file

@ -1,26 +0,0 @@
- content_for :actions do
= link_to(t(:edit), edit_domains_path(domain_name: params[:domain_name]),
class: 'btn btn-primary')
= link_to(t(:renew), renew_domains_path(domain_name: params[:domain_name]),
class: 'btn btn-default')
= link_to(t(:delete), delete_domains_path(domain_name: params[:domain_name]),
class: 'btn btn-default')
= render 'depp/shared/title', name: truncate(@data.css('name').text)
.row
.col-sm-12
- if @data.css('result').first['code'] == '1000'
.row
.col-md-12= render 'depp/domains/partials/general'
.row
.col-md-12= render 'depp/domains/partials/contacts'
.row
.col-md-12= render 'depp/domains/partials/statuses'
.row
.col-md-12= render 'depp/domains/partials/nameservers'
.row
.col-md-12= render 'depp/domains/partials/dnskeys'
- else
.row
.col-sm-6
%h1= t(:not_found)

View file

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

View file

@ -28,39 +28,42 @@
- if current_user
.navbar-collapse.collapse
%ul.nav.navbar-nav.public-nav
- active_class = %w(depp/domains depp/check depp/renew depp/tranfer depp/keyrelays).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:domains), depp.domains_path
- active_class = ['depp/contacts'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:contacts), depp.contacts_path
- if can? :view, Depp::Domain
- active_class = %w(registrar/domains registrar/check registrar/renew registrar/tranfer registrar/keyrelays).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:domains), registrar_domains_path
- if can? :view, Depp::Contact
- active_class = ['registrar/contacts'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:contacts), registrar_contacts_path
- if can? :show, Invoice
- active_class = ['registrar/invoices'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t('invoices'), main_app.registrar_invoices_path
- active_class = ['depp/xml_consoles'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:xml_console), depp.xml_console_path
- if can? :view, :registrar_xml_console
- active_class = ['registrar/xml_consoles'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:xml_console), registrar_xml_console_path
%ul.nav.navbar-nav.navbar-right
%li= link_to t('log_out', user: current_user), '/registrar/logout'
%li.dropdown
= link_to 'Registrar <span class="caret"></span>'.html_safe, '#',
class: 'dropdown-toggle', 'data-toggle': 'dropdown', role: 'button'
%ul.dropdown-menu{'role': 'menu'}
%li.dropdown-header= t(:switch_to) + ':'
%li= link_to t(:registrant), '#'
%li= link_to t(:registrar), '#'
- if user_signed_in?
%li= link_to t('log_out', user: current_user), '/registrar/logout'
-# %li.dropdown
-# = link_to 'Registrar <span class="caret"></span>'.html_safe, '#',
-# class: 'dropdown-toggle', 'data-toggle': 'dropdown', role: 'button'
-# %ul.dropdown-menu{'role': 'menu'}
-# %li.dropdown-header= t(:switch_to) + ':'
-# %li= link_to t(:registrant), '#'
-# %li= link_to t(:registrar), '#'
/ /.nav-collapse
.container
- if params[:controller].start_with?('depp/')
= render 'depp/shared/flash'
= render 'depp/shared/epp_results'
- else
- display = (flash.empty?) ? 'none' : 'block'
#flash{style: "display: #{display};"}
- type = (flash[:notice]) ? 'bg-success' : 'bg-danger'
.alert{class: type}= flash[:notice] || flash[:alert]
-# - if params[:controller].start_with?('depp/')
-# = render 'depp/shared/flash'
-# = render 'depp/shared/epp_results'
-# - else
- display = (flash.empty?) ? 'none' : 'block'
#flash{style: "display: #{display};"}
- type = (flash[:notice]) ? 'bg-success' : 'bg-danger'
.alert{class: type}= flash[:notice] || flash[:alert]
= yield
.footer.text-right

View file

@ -0,0 +1,23 @@
= render 'registrar/shared/error_messages', f: f
= f.hidden_field :id
= f.hidden_field :password
.row
.col-md-12
= render 'registrar/contacts/form_partials/general', f: f
.row
.col-md-12
= render 'registrar/contacts/form_partials/address', f: f
- if !@contact.persisted?
.row
.col-md-12
= render 'registrar/contacts/form_partials/code', f: f
.row
.col-md-12
= render 'registrar/contacts/form_partials/legal_document', f: f
.row
.col-md-12.text-right
- if @contact.persisted?
= button_tag(t(:save), class: 'btn btn-primary')
- else
= button_tag(t(:create), class: 'btn btn-primary')

View file

@ -0,0 +1,20 @@
- if @contact.persisted?
= render 'registrar/shared/title', name: "#{t(:delete)}: #{@contact.name}"
= form_for(@contact, url: registrar_contact_path(@contact),
class: 'form-horizontal', multipart: true, method: :delete) do |f|
= render 'registrar/shared/error_messages', f: f
= f.hidden_field :id
= f.hidden_field :password
.row
.col-md-12
= render 'registrar/contacts/form_partials/legal_document', f: f
%hr
.row
.col-md-12.text-right
= button_tag t(:delete), class: 'btn btn-danger'
- else
%h2= "#{t(:delete)}: #{t(:not_found)}"

View file

@ -0,0 +1,5 @@
= render 'registrar/shared/title', name: "#{t(:edit)}: #{@contact.name}"
= form_for(@contact, url: registrar_contact_path(@contact),
html: {class: 'form-horizontal js-contact-form'}) do |f|
- render 'form', f: f

View file

@ -1,6 +1,6 @@
- content_for :actions do
= link_to(t(:new), new_contact_path, class: 'btn btn-primary')
= render 'depp/shared/title', name: t(:contacts)
= link_to(t(:new), new_registrar_contact_path, class: 'btn btn-primary')
= render 'registrar/shared/title', name: t(:contacts)
- if @response
.panel.panel-default
@ -15,11 +15,11 @@
%tbody
- @contacts.each do |c|
%tr
%td= link_to(c[:name], contact_path(id: c[:code]))
%td= link_to(c[:name], registrar_contact_path(id: c[:code]))
%td= c[:code]
%td= c[:ident]
%td
= link_to(t(:edit), edit_contact_path(c[:code]), class: 'btn btn-primary btn-xs')
= link_to(t(:delete), delete_contact_path(c[:code]), class: 'btn btn-default btn-xs')
= link_to(t(:edit), edit_registrar_contact_path(c[:code]), class: 'btn btn-primary btn-xs')
= link_to(t(:delete), delete_registrar_contact_path(c[:code]), class: 'btn btn-default btn-xs')
= paginate @paginatable_array

View file

@ -1,8 +1,8 @@
= render 'depp/shared/title', name: t(:contacts_info)
= render 'registrar/shared/title', name: t(:contacts_info)
.row
.col-md-12
= form_tag contact_path, class: 'form-horizontal', method: :get do
= form_tag registrar_contact_path, class: 'form-horizontal', method: :get do
.form-group
= label_tag :contact_id, t('contact_id'), class: 'col-md-2 control-label'
.col-md-10

View file

@ -0,0 +1,5 @@
= render 'registrar/shared/title', name: t(:new_contact)
= form_for(@contact, url: registrar_contacts_path,
html: {class: 'form-horizontal js-contact-form'}) do |f|
- render 'form', f: f

View file

@ -0,0 +1,16 @@
- if @contact.id.present?
- content_for :actions do
= link_to(t(:edit), edit_registrar_contact_path(@contact.id), class: 'btn btn-primary')
= link_to(t(:delete), delete_registrar_contact_path(@contact.id), class: 'btn btn-default')
= render 'registrar/shared/title', name: truncate(@contact.name)
.row
.col-md-6= render 'registrar/contacts/partials/general'
.col-md-6= render 'registrar/contacts/partials/address'
.row
.col-md-12= render 'registrar/contacts/partials/statuses', statuses: @contact.statuses
- else
.row
.col-sm-6
%h1= t(:not_found)

View file

@ -1,4 +1,4 @@
= form_tag check_domains_path, class: 'form-horizontal', method: :get do
= form_tag check_registrar_domains_path, class: 'form-horizontal', method: :get do
.col-md-11
.form-group
= text_field_tag :domain_name, params[:domain_name], class: 'form-control', placeholder: t('domain_name'), autocomplete: 'off'

View file

@ -1,4 +1,4 @@
- path = (params[:domain_name]) ? update_domains_path : domains_path
- path = (params[:domain_name]) ? update_registrar_domains_path : registrar_domains_path
= form_tag(path, class: 'form-horizontal', multipart: true) do
.row
.col-md-12
@ -12,15 +12,15 @@
/ Tab panes
.tab-content
#general-tab.tab-pane.active
= render 'depp/domains/form_partials/general'
= render 'depp/domains/form_partials/contacts'
= render 'registrar/domains/form_partials/general'
= render 'registrar/domains/form_partials/contacts'
%hr
= render 'depp/domains/form_partials/nameservers'
= render 'registrar/domains/form_partials/nameservers'
%hr
= render 'depp/domains/form_partials/dnskeys'
= render 'registrar/domains/form_partials/dnskeys'
- if params['domain_name']
#statuses-tab.tab-pane
= render 'depp/domains/form_partials/statuses'
= render 'registrar/domains/form_partials/statuses'
.panel.panel-default
.panel-heading.clearfix

View file

@ -1,4 +1,4 @@
= render 'depp/shared/title', name: t(:check_domain)
= render 'registrar/shared/title', name: t(:check_domain)
.row
.col-md-12

View file

@ -0,0 +1,5 @@
= render 'registrar/shared/title', name: t(:check_domain)
.row
.col-md-12
= render 'check_form'

View file

@ -1,6 +1,6 @@
= render 'depp/shared/title', name: "#{t(:delete)}: #{params[:domain_name]}"
= render 'registrar/shared/title', name: "#{t(:delete)}: #{params[:domain_name]}"
= form_tag(destroy_domains_path, class: 'form-horizontal', multipart: true, method: :delete) do
= form_tag(destroy_registrar_domains_path, class: 'form-horizontal', multipart: true, method: :delete) do
.panel.panel-default
.panel-heading.clearfix
= t(:legal_document)

View file

@ -0,0 +1,4 @@
= render 'registrar/shared/title', name: "#{t(:edit)}: #{params[:domain_name]}"
%hr
= render 'form'

View file

@ -1,12 +1,12 @@
- content_for :actions do
= link_to(t(:new), new_domain_path, class: 'btn btn-primary')
= link_to(t(:transfer), transfer_domains_path, class: 'btn btn-default')
= link_to(t(:keyrelay), keyrelay_path, class: 'btn btn-default')
= render 'depp/shared/title', name: t(:domains)
= link_to(t(:new), new_registrar_domain_path, class: 'btn btn-primary')
= link_to(t(:transfer), transfer_registrar_domains_path, class: 'btn btn-default')
= link_to(t(:keyrelay), registrar_keyrelay_path, class: 'btn btn-default')
= render 'registrar/shared/title', name: t(:domains)
.row
.col-md-12{style: 'margin-bottom: -15px;'}
= form_tag info_domains_path, class: 'form-horizontal', method: :get do
= form_tag info_registrar_domains_path, class: 'form-horizontal', method: :get do
.col-md-11
.form-group
= text_field_tag :domain_name, params[:domain_name], class: 'form-control', placeholder: t('domain_name'), autocomplete: 'off', autofocus: true
@ -31,17 +31,17 @@
%tbody
- @response['domains'].each do |x|
%tr
%td= link_to(x['name'], info_domains_path(domain_name: x['name']))
%td= link_to(x['name'], info_registrar_domains_path(domain_name: x['name']))
%td
= Time.parse(x['valid_from']).try(:to_date)
= Time.zone.parse(x['valid_from']).try(:to_date)
\-
= Time.parse(x['valid_to']).try(:to_date)
= Time.zone.parse(x['valid_to']).try(:to_date)
%td
= link_to(t(:edit), edit_domains_path(domain_name: x['name']),
= link_to(t(:edit), edit_registrar_domains_path(domain_name: x['name']),
class: 'btn btn-primary btn-xs')
= link_to(t(:renew), renew_domains_path(domain_name: x['name']),
= link_to(t(:renew), renew_registrar_domains_path(domain_name: x['name']),
class: 'btn btn-default btn-xs')
= link_to(t(:delete), delete_domains_path(domain_name: x['name']),
= link_to(t(:delete), delete_registrar_domains_path(domain_name: x['name']),
class: 'btn btn-default btn-xs')
= paginate @paginatable_array

View file

@ -0,0 +1,26 @@
- content_for :actions do
= link_to(t(:edit), edit_registrar_domains_path(domain_name: params[:domain_name]),
class: 'btn btn-primary')
= link_to(t(:renew), renew_registrar_domains_path(domain_name: params[:domain_name]),
class: 'btn btn-default')
= link_to(t(:delete), delete_registrar_domains_path(domain_name: params[:domain_name]),
class: 'btn btn-default')
= render 'registrar/shared/title', name: truncate(@data.css('name').text)
.row
.col-sm-12
- if @data.css('result').first['code'] == '1000'
.row
.col-md-12= render 'registrar/domains/partials/general'
.row
.col-md-12= render 'registrar/domains/partials/contacts'
.row
.col-md-12= render 'registrar/domains/partials/statuses'
.row
.col-md-12= render 'registrar/domains/partials/nameservers'
.row
.col-md-12= render 'registrar/domains/partials/dnskeys'
- else
.row
.col-sm-6
%h1= t(:not_found)

View file

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

View file

@ -1,4 +1,4 @@
= render 'depp/shared/title', name: t(:renew_domain)
= render 'registrar/shared/title', name: t(:renew_domain)
.row
.col-md-12

View file

@ -1,8 +1,8 @@
= render 'depp/shared/title', name: t(:renew_domain)
= render 'registrar/shared/title', name: t(:renew_domain)
.row
.col-md-12
= form_tag renew_domains_path, class: 'form-horizontal', method: :get do
= form_tag renew_registrar_domains_path, class: 'form-horizontal', method: :get do
.form-group
= label_tag :domain_name, t('name'), class: 'col-md-2 control-label'
.col-md-10

View file

@ -1,4 +1,4 @@
= render 'depp/shared/title', name: t(:transfer_domain)
= render 'registrar/shared/title', name: t(:transfer_domain)
.row
.col-md-12

View file

@ -1,8 +1,8 @@
= render 'depp/shared/title', name: t(:transfer_domain)
= render 'registrar/shared/title', name: t(:transfer_domain)
.row
.col-md-12
= form_tag transfer_domains_path, class: 'form-horizontal', method: :post, multipart: true do
= form_tag transfer_registrar_domains_path, class: 'form-horizontal', method: :post, multipart: true do
.form-group
= label_tag :domain_name, t('name'), class: 'col-md-2 control-label'
.col-md-10

View file

@ -4,7 +4,7 @@
%hr
.row
.col-md-12
= form_tag keyrelay_path, class: 'form-horizontal', method: :post, multipart: true do
= form_tag registrar_keyrelay_path, class: 'form-horizontal', method: :post, multipart: true do
.form-group
= label_tag :domain_name, t('domain_name'), class: 'col-md-2 control-label'
.col-md-10

View file

@ -15,7 +15,7 @@
- if @data.css('trnData trStatus').any? # this is a transfer request
- unless ['serverApproved', 'clientApproved'].include?(@data.css('trStatus').first.text)
= link_to(t('confirm'), 'javascript: void(0);', class: 'btn btn-primary btn-xs js-transfer-confirm')
= link_to(t('dequeue'), poll_path(id: msg_q['id']), method: :delete, class: 'btn btn-primary btn-xs')
= link_to(t('dequeue'), registrar_poll_path(id: msg_q['id']), method: :delete, class: 'btn btn-primary btn-xs')
.panel-body
%dl.dl-horizontal
%dt= t('message')
@ -56,7 +56,7 @@
%dt= t('public_key')
%dd= @data.css('pubKey').text
= form_tag confirm_keyrelay_poll_path, class: 'js-keyrelay-form' do
= form_tag registrar_confirm_keyrelay_poll_path, class: 'js-keyrelay-form' do
= hidden_field_tag 'domain[name]', @data.css('name').text
= hidden_field_tag 'domain[dnskeys_attributes][0][flags]', @data.css('flags').text
= hidden_field_tag 'domain[dnskeys_attributes][0][protocol]', @data.css('protocol').text
@ -65,7 +65,7 @@
- else
- if @data.css('trnData trStatus').any? # this is a transfer request
= form_tag confirm_transfer_poll_path, class: 'js-transfer-form' do
= form_tag registrar_confirm_transfer_poll_path, class: 'js-transfer-form' do
= hidden_field_tag 'domain[name]', @data.css('name').text
- @data.css('trnData').children.each do |x|

View file

@ -2,12 +2,12 @@
.container.subnav
%ul.nav.nav-tabs.navbar-right
%li{role: :presentation, class: active == :domains ? 'active' : ''}
= link_to t(:all), domains_path
= link_to t(:all), registrar_domains_path
%li{role: :presentation, class: active == :new ? 'active' : ''}
= link_to t(:new), new_domain_path
= link_to t(:new), new_registrar_domain_path
%li{role: :presentation, class: active == :check ? 'active' : ''}
= link_to t(:check), check_domains_path
= link_to t(:check), check_registrar_domains_path
%li{role: :presentation, class: active == :transfer ? 'active' : ''}
= link_to t(:transfer), transfer_domains_path
= link_to t(:transfer), transfer_registrar_domains_path
%li{role: :presentation, class: active == :keyrelay ? 'active' : ''}
= link_to t(:keyrelay), keyrelay_path
= link_to t(:keyrelay), registrar_keyrelay_path

View file

@ -1,6 +1,6 @@
.row
.col-md-8
= form_tag(xml_console_path) do
= form_tag(registrar_xml_console_path) do
.form-group
= text_area_tag(:payload, params[:payload], class: 'form-control', rows: 15, style: 'font-family:monospace; font-size: 11px;')