From c629d029e8f71a05422ffdd1585424f52e56f18a Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 15 Apr 2015 10:36:09 +0300 Subject: [PATCH 1/6] Added more example mobile numbers --- app/views/registrar/sessions/login_mid.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/registrar/sessions/login_mid.haml b/app/views/registrar/sessions/login_mid.haml index ccbb05179..628c5b8c7 100644 --- a/app/views/registrar/sessions/login_mid.haml +++ b/app/views/registrar/sessions/login_mid.haml @@ -11,7 +11,7 @@ - if ['development', 'alpha'].include?(Rails.env) %div.text-center - 60000007 / 00000766 + 00007, 60000007, 00000766 :coffee $('.js-login').attr('disabled', false) From 0b58142fd4daef8c823ad356bf89600a122f1a6b Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 15 Apr 2015 10:51:44 +0300 Subject: [PATCH 2/6] Registrar: Removed statuses tab --- app/views/registrar/domains/_form.haml | 40 ++++++------------- app/views/registrar/domains/edit.haml | 2 - .../registrar/domains/partials/_statuses.haml | 14 ------- 3 files changed, 13 insertions(+), 43 deletions(-) delete mode 100644 app/views/registrar/domains/partials/_statuses.haml diff --git a/app/views/registrar/domains/_form.haml b/app/views/registrar/domains/_form.haml index fcd944e62..c1da149e4 100644 --- a/app/views/registrar/domains/_form.haml +++ b/app/views/registrar/domains/_form.haml @@ -2,34 +2,20 @@ = form_tag(path, class: 'form-horizontal', multipart: true) do .row .col-md-12 - / Nav tabs - %ul.nav.nav-tabs{:role => "tablist", id: 'tabs'} - %li.active - %a{"data-toggle" => "tab", :href => "#general-tab", :role => "tab"}= t('general') - - if params['domain_name'] - %li - %a{"data-toggle" => "tab", :href => "#statuses-tab", :role => "tab"}= t('statuses') - / Tab panes - .tab-content - #general-tab.tab-pane.active - = render 'registrar/domains/form_partials/general' - = render 'registrar/domains/form_partials/contacts' - %hr - = render 'registrar/domains/form_partials/nameservers' - %hr - = render 'registrar/domains/form_partials/dnskeys' - - if params['domain_name'] - #statuses-tab.tab-pane - = render 'registrar/domains/form_partials/statuses' + #general-tab.tab-pane.active + = render 'registrar/domains/form_partials/general' + = render 'registrar/domains/form_partials/contacts' + = render 'registrar/domains/form_partials/nameservers' + = render 'registrar/domains/form_partials/dnskeys' - .panel.panel-default - .panel-heading.clearfix - .pull-left= t(:legal_document) - .panel-body - .form-group - = label_tag 'domain[legal_document]', t('legal_document'),class: 'col-md-3 control-label' - .col-md-9 - = file_field_tag 'domain[legal_document]' + .panel.panel-default + .panel-heading.clearfix + .pull-left= t(:legal_document) + .panel-body + .form-group + = label_tag 'domain[legal_document]', t('legal_document'),class: 'col-md-3 control-label' + .col-md-9 + = file_field_tag 'domain[legal_document]' .row .col-md-12.text-right diff --git a/app/views/registrar/domains/edit.haml b/app/views/registrar/domains/edit.haml index 71662a8dd..6a42ec473 100644 --- a/app/views/registrar/domains/edit.haml +++ b/app/views/registrar/domains/edit.haml @@ -1,4 +1,2 @@ = render 'registrar/shared/title', name: "#{t(:edit)}: #{params[:domain_name]}" - -%hr = render 'form' diff --git a/app/views/registrar/domains/partials/_statuses.haml b/app/views/registrar/domains/partials/_statuses.haml deleted file mode 100644 index 5cd71caec..000000000 --- a/app/views/registrar/domains/partials/_statuses.haml +++ /dev/null @@ -1,14 +0,0 @@ -#domain_statuses.panel.panel-default - .panel-heading.clearfix - %h3.panel-title= t(:statuses) - .table-responsive - %table.table.table-hover.table-bordered.table-condensed - %thead - %tr - %th{class: 'col-xs-6'}= t('status') - %th{class: 'col-xs-6'}= t('description') - %tbody - - @data.css('status').each do |x| - %tr - %td= x['s'] - %td= x.text From 47db36db1508181afdd86a9094355cbaeba0fe67 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 15 Apr 2015 11:59:45 +0300 Subject: [PATCH 3/6] Add EPP Errors to Contact --- app/models/contact.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/contact.rb b/app/models/contact.rb index 1df655f2e..5d0ba74b7 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -1,5 +1,6 @@ class Contact < ActiveRecord::Base include Versions # version/contact_version.rb + include EppErrors belongs_to :registrar has_many :domain_contacts From 279f0a7e589c0efaf3a1b7b097feb8c94eb4d684 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 15 Apr 2015 12:00:00 +0300 Subject: [PATCH 4/6] Remove domain statuses from form --- app/models/depp/domain.rb | 26 +++++----------- app/views/registrar/deposits/new.haml | 2 +- app/views/registrar/domains/_form.haml | 8 +++-- .../domains/form_partials/_contacts.haml | 8 ++--- .../domains/form_partials/_dnskeys.haml | 30 +++++++++---------- .../domains/form_partials/_general.haml | 17 +++++------ .../domains/form_partials/_nameservers.haml | 12 ++++---- .../domains/form_partials/_statuses.haml | 24 --------------- .../registrar/domains/partials/_statuses.haml | 14 +++++++++ config/locales/en.yml | 9 ++++++ 10 files changed, 70 insertions(+), 80 deletions(-) delete mode 100644 app/views/registrar/domains/form_partials/_statuses.haml create mode 100644 app/views/registrar/domains/partials/_statuses.haml diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb index 7034ebaee..dfeef981f 100644 --- a/app/models/depp/domain.rb +++ b/app/models/depp/domain.rb @@ -5,7 +5,7 @@ module Depp attr_accessor :name, :current_user, :epp_xml - DOMAIN_STATUSES = %w( + STATUSES = %w( clientDeleteProhibited clientHold clientRenewProhibited @@ -13,6 +13,8 @@ module Depp clientUpdateProhibited ) + PERIODS = [['1 year', '1y'], ['2 years', '2y'], ['3 years', '3y']] + def initialize(args = {}) self.current_user = args[:current_user] self.epp_xml = EppXml::Domain.new(cl_trid_prefix: current_user.tag) @@ -36,7 +38,7 @@ module Depp xml = epp_xml.create({ name: { value: domain_params[:name] }, registrant: { value: domain_params[:registrant] }, - period: { value: domain_params[:period], attrs: { unit: domain_params[:period_unit] } }, + period: { value: domain_params[:period].to_s[0], attrs: { unit: domain_params[:period].to_s[1] } }, ns: Domain.create_nameservers_hash(domain_params), _anonymus: Domain.create_contacts_hash(domain_params) }, { @@ -164,7 +166,7 @@ module Depp end data.css('status').each_with_index do |x, i| - next unless DOMAIN_STATUSES.include?(x['s']) + next unless STATUSES.include?(x['s']) ret[:statuses_attributes][i] = { code: x['s'], description: x.text @@ -190,12 +192,10 @@ module Depp def construct_edit_hash(domain_params, old_domain_params) contacts = create_contacts_hash(domain_params) - create_contacts_hash(old_domain_params) - statuses = create_statuses_hash(domain_params) - create_statuses_hash(old_domain_params) - add_anon = contacts + statuses + add_anon = contacts contacts = create_contacts_hash(old_domain_params) - create_contacts_hash(domain_params) - statuses = create_statuses_hash(old_domain_params) - create_statuses_hash(domain_params) - rem_anon = contacts + statuses + rem_anon = contacts if domain_params[:registrant] != old_domain_params[:registrant] chg = [{ registrant: { value: domain_params[:registrant] } }] @@ -283,18 +283,6 @@ module Depp pubKey: { value: key_data_params['public_key'] } } end - - def create_statuses_hash(domain_params) - ret = [] - domain_params[:statuses_attributes].each do |_k, v| - next if v['code'].blank? - ret << { - status: { value: v['description'], attrs: { s: v['code'] } } - } - end - - ret - end end end end diff --git a/app/views/registrar/deposits/new.haml b/app/views/registrar/deposits/new.haml index 695068ecc..d2af9f3c9 100644 --- a/app/views/registrar/deposits/new.haml +++ b/app/views/registrar/deposits/new.haml @@ -1,4 +1,4 @@ -%h1= t('add_deposit') +%h1= t(:add_deposit) %hr = form_for([:registrar, @deposit], method: :post) do |f| .row diff --git a/app/views/registrar/domains/_form.haml b/app/views/registrar/domains/_form.haml index c1da149e4..0bba02de2 100644 --- a/app/views/registrar/domains/_form.haml +++ b/app/views/registrar/domains/_form.haml @@ -1,7 +1,7 @@ - path = (params[:domain_name]) ? update_registrar_domains_path : registrar_domains_path = form_tag(path, class: 'form-horizontal', multipart: true) do .row - .col-md-12 + .col-md-8 #general-tab.tab-pane.active = render 'registrar/domains/form_partials/general' = render 'registrar/domains/form_partials/contacts' @@ -16,9 +16,13 @@ = label_tag 'domain[legal_document]', t('legal_document'),class: 'col-md-3 control-label' .col-md-9 = file_field_tag 'domain[legal_document]' + .col-md-4 + %p.domain-general-help= t(:domain_general_help).html_safe + %p.domain-admin-contact-help= t(:domain_admin_contact_help).html_safe + %p.domain-tech-contact-help= t(:domain_tech_contact_help).html_safe .row - .col-md-12.text-right + .col-md-8.text-right = button_tag(t('shared.save'), class: 'btn btn-primary') :javascript diff --git a/app/views/registrar/domains/form_partials/_contacts.haml b/app/views/registrar/domains/form_partials/_contacts.haml index 8fce6c4f5..20e7675b9 100644 --- a/app/views/registrar/domains/form_partials/_contacts.haml +++ b/app/views/registrar/domains/form_partials/_contacts.haml @@ -8,13 +8,13 @@ = link_to(t('delete'), '#', class: 'btn btn-danger btn-xs destroy') .panel-body .form-group - = label_tag "domain_contacts_attributes_#{k}_type", t('contact_type'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_contacts_attributes_#{k}_type", t('contact_type'), class: 'col-md-3 control-label' + .col-md-7 = select_tag "domain[contacts_attributes][#{k}][type]", options_for_select(['admin', 'tech'], v['type']), {class: 'form-control'} .form-group - = label_tag "domain_contacts_attributes_#{k}_code", t('contact_code'), class: 'col-md-2 control-label' - .col-md-10.has-feedback + = label_tag "domain_contacts_attributes_#{k}_code", t('contact_code'), class: 'col-md-3 control-label' + .col-md-7.has-feedback = text_field_tag("domain[contacts_attributes][#{k}][code]", v['code'], class: 'form-control', placeholder: t('contact_code'), autocomplete: 'off') :coffee $("#domain-contacts").nestedAttributes diff --git a/app/views/registrar/domains/form_partials/_dnskeys.haml b/app/views/registrar/domains/form_partials/_dnskeys.haml index 06f7152dd..1db448d11 100644 --- a/app/views/registrar/domains/form_partials/_dnskeys.haml +++ b/app/views/registrar/domains/form_partials/_dnskeys.haml @@ -9,43 +9,43 @@ .panel-body - if ENV['show_ds_data_fields'] == 'true' .form-group - = label_tag "domain_dnskeys_attributes_#{k}_ds_key_tag", t('ds_key_tag'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_dnskeys_attributes_#{k}_ds_key_tag", t('ds_key_tag'), class: 'col-md-3 control-label' + .col-md-7 = text_field_tag "domain[dnskeys_attributes][#{k}][ds_key_tag]", v['ds_key_tag'], {class: 'form-control'} .form-group - = label_tag "domain_dnskeys_attributes_#{k}_ds_alg", t('ds_algorithm'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_dnskeys_attributes_#{k}_ds_alg", t('ds_algorithm'), class: 'col-md-3 control-label' + .col-md-7 = select_tag "domain[dnskeys_attributes][#{k}][ds_alg]", options_for_select(Depp::Dnskey::ALGORITHMS, v['ds_alg']), {class: 'form-control'} .form-group = label_tag "domain_dnskeys_attributes_#{k}_ds_digest_type", t('ds_digest_type'), class: 'col-md-2 control-label' - .col-md-10 + .col-md-7 = select_tag "domain[dnskeys_attributes][#{k}][ds_digest_type]", options_for_select(Depp::Dnskey::DS_DIGEST_TYPES, v['ds_digest_type']), {class: 'form-control'} .form-group - = label_tag "domain_dnskeys_attributes_#{k}_ds_digest", t('ds_digest'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_dnskeys_attributes_#{k}_ds_digest", t('ds_digest'), class: 'col-md-3 control-label' + .col-md-7 = text_field_tag "domain[dnskeys_attributes][#{k}][ds_digest]", v['ds_digest'], {class: 'form-control'} .form-group - = label_tag "domain_dnskeys_attributes_#{k}_flags", t('flags'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_dnskeys_attributes_#{k}_flags", t('flags'), class: 'col-md-3 control-label' + .col-md-7 = select_tag "domain[dnskeys_attributes][#{k}][flags]", options_for_select(Depp::Dnskey::FLAGS, v['flags']), {class: 'form-control'} .form-group - = label_tag "domain_dnskeys_attributes_#{k}_protocol", t('protocol'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_dnskeys_attributes_#{k}_protocol", t('protocol'), class: 'col-md-3 control-label' + .col-md-7 = select_tag "domain[dnskeys_attributes][#{k}][protocol]", options_for_select(Depp::Dnskey::PROTOCOLS, v['protocol']), {class: 'form-control'} .form-group - = label_tag "domain_dnskeys_attributes_#{k}_alg", t('alg'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_dnskeys_attributes_#{k}_alg", t('alg'), class: 'col-md-3 control-label' + .col-md-7 = select_tag "domain[dnskeys_attributes][#{k}][alg]", options_for_select(Depp::Dnskey::ALGORITHMS, v['alg']), {class: 'form-control'} .form-group - = label_tag "domain_dnskeys_attributes_#{k}_public_key", t('public_key'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_dnskeys_attributes_#{k}_public_key", t('public_key'), class: 'col-md-3 control-label' + .col-md-7 = text_field_tag "domain[dnskeys_attributes][#{k}][public_key]", v['public_key'], class: 'form-control' :coffee $("#dnskeys").nestedAttributes diff --git a/app/views/registrar/domains/form_partials/_general.haml b/app/views/registrar/domains/form_partials/_general.haml index 45b2bf57c..bce8ef3b8 100644 --- a/app/views/registrar/domains/form_partials/_general.haml +++ b/app/views/registrar/domains/form_partials/_general.haml @@ -1,20 +1,19 @@ .general-tab.panel.panel-default .panel-body .form-group - = label_tag :domain_name, t('name'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag :domain_name, t('name'), class: 'col-md-3 control-label' + .col-md-7 - readonly = params[:domain_name] ? true : false = text_field_tag('domain[name]', @domain_params[:name], class: 'form-control', readonly: readonly) - unless params[:domain_name] .form-group - = label_tag :domain_period, t('period'), class: 'col-md-2 control-label' - .col-md-5 - = text_field_tag('domain[period]', @domain_params[:period], class: 'form-control') - .col-md-5 - = select_tag 'domain[period_unit]', options_for_select(['y', 'm', 'd'], @domain_params[:period_unit]), { class: 'form-control' } + = label_tag :domain_period, t('period'), class: 'col-md-3 control-label' + .col-md-7 + = select_tag 'domain[period]', + options_for_select(Depp::Domain::PERIODS, @domain_params[:period]), { class: 'form-control' } .form-group - = label_tag :domain_registrant, t('registrant'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag :domain_registrant, t('registrant'), class: 'col-md-3 control-label' + .col-md-7 = text_field_tag('domain[registrant]', @domain_params[:registrant], class: 'form-control', placeholder: t('contact_code'), autocomplete: 'off') diff --git a/app/views/registrar/domains/form_partials/_nameservers.haml b/app/views/registrar/domains/form_partials/_nameservers.haml index b37d73594..0fbbc519a 100644 --- a/app/views/registrar/domains/form_partials/_nameservers.haml +++ b/app/views/registrar/domains/form_partials/_nameservers.haml @@ -8,16 +8,16 @@ = link_to(t('delete'), '#', class: 'btn btn-danger btn-xs destroy') .panel-body .form-group - = label_tag "domain_nameservers_attributes_#{k}_hostname", t('hostname'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_nameservers_attributes_#{k}_hostname", t('hostname'), class: 'col-md-3 control-label' + .col-md-7 = text_field_tag "domain[nameservers_attributes][#{k}][hostname]", v['hostname'], class: 'form-control' .form-group - = label_tag "domain_nameservers_attributes_#{k}_ipv4", t('ipv4'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_nameservers_attributes_#{k}_ipv4", t('ipv4'), class: 'col-md-3 control-label' + .col-md-7 = text_field_tag "domain[nameservers_attributes][#{k}][ipv4]", v['ipv4'], class: 'form-control' .form-group - = label_tag "domain_nameservers_attributes_#{k}_ipv6", t('ipv6'), class: 'col-md-2 control-label' - .col-md-10 + = label_tag "domain_nameservers_attributes_#{k}_ipv6", t('ipv6'), class: 'col-md-3 control-label' + .col-md-7 = text_field_tag "domain[nameservers_attributes][#{k}][ipv6]", v['ipv6'], class: 'form-control' :coffee $("#nameservers").nestedAttributes diff --git a/app/views/registrar/domains/form_partials/_statuses.haml b/app/views/registrar/domains/form_partials/_statuses.haml deleted file mode 100644 index af7fe8e2d..000000000 --- a/app/views/registrar/domains/form_partials/_statuses.haml +++ /dev/null @@ -1,24 +0,0 @@ -#domain-statuses - - @domain_params['statuses_attributes'].each do |k, v| - %br - .panel.panel-default - .panel-heading.clearfix - .pull-left= t('status') - .pull-right - = link_to(t('add_another'), '#', class: 'btn btn-primary btn-xs add-domain-status') - = link_to(t('delete'), '#', class: 'btn btn-danger btn-xs destroy') - .panel-body - .form-group - = label_tag "domain_statuses_attributes_#{k}_code", t('code'),class: 'col-md-2 control-label' - .col-md-10 - = select_tag "domain[statuses_attributes][#{k}][code]", options_for_select(Depp::Domain::DOMAIN_STATUSES, v['code']), {class: 'form-control', prompt: ''} - .form-group - = label_tag "domain_statuses_attributes_#{k}_description", t('description'),class: 'col-md-2 control-label' - .col-md-10 - = text_field_tag "domain[statuses_attributes][#{k}][description]", v['description'], class: 'form-control', autocomplete: 'off' -:coffee - $("#domain-statuses").nestedAttributes - bindAddTo: $(".add-domain-status") - afterAdd: (item) -> - item.find('select').each (k, v) -> - $(v).val($(v).find('option:first-child').val()) diff --git a/app/views/registrar/domains/partials/_statuses.haml b/app/views/registrar/domains/partials/_statuses.haml new file mode 100644 index 000000000..5cd71caec --- /dev/null +++ b/app/views/registrar/domains/partials/_statuses.haml @@ -0,0 +1,14 @@ +#domain_statuses.panel.panel-default + .panel-heading.clearfix + %h3.panel-title= t(:statuses) + .table-responsive + %table.table.table-hover.table-bordered.table-condensed + %thead + %tr + %th{class: 'col-xs-6'}= t('status') + %th{class: 'col-xs-6'}= t('description') + %tbody + - @data.css('status').each do |x| + %tr + %td= x['s'] + %td= x.text diff --git a/config/locales/en.yml b/config/locales/en.yml index 520a80df9..b67093489 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -702,3 +702,12 @@ en: invoices_were_fully_binded: 'Invoices were fully binded' invoices_were_partially_binded: 'Invoices were partially binded' no_invoices_were_binded: 'No invoices were binded' + domain_general_help: + The Administrative Contact + is an Estonian citizen or a citizen of another country in the European Union, European Economic Area or the Swiss Confederation with a registered place of residence in Estonia and an Estonian personal identification code who has the right to represent the registering entity in accordance with the current legislation of the Republic of Estonia (member of the management board) or on the basis of the written authorisation issued by a member of the management board. The Administrative Contact has the right to sign and submit in the name of the registering entity any applications connected with the domain name and also to receive and forward any information concerning the domain name(s). The Administrative Contact is responsible for the correctness and authenticity of the data and documents submitted about itself and the registering entity. + domain_admin_contact_help: + The Technical Contact + is a person who has the right to modify only such domain name server data that is connected with it. If the domain registering entity is using a website hosting service, it is recommended to register as the Technical Contact a representative of the corresponding provider company. If the domain registering entity manages its own servers, it can register itself as the Technical Contact. + domain_tech_contact_help: + The domain name server + is a computer that saves and forwards via a general-access data communications network such data that is connected with the domain name and corresponding IP addresses. Your IT helpdesk or Internet service provider will have the necessary information about the domain name servers. From 01a43b86f679b107c367db02ddee2ac28d7cc5fc Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 15 Apr 2015 12:08:18 +0300 Subject: [PATCH 5/6] fixed registrar urls --- app/controllers/registrar/domains_controller.rb | 6 +++--- app/controllers/registrar/polls_controller.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/registrar/domains_controller.rb b/app/controllers/registrar/domains_controller.rb index b1eba35d9..df616cc16 100644 --- a/app/controllers/registrar/domains_controller.rb +++ b/app/controllers/registrar/domains_controller.rb @@ -24,7 +24,7 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller render 'info' else flash[:alert] = t('domain_not_found') - redirect_to registrar_domains_path and return + redirect_to registrar_domains_url and return end end @@ -49,7 +49,7 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller @data = @domain.create(@domain_params) if response_ok? - redirect_to info_registrar_domains_path(domain_name: @domain_params[:name]) + redirect_to info_registrar_domains_url(domain_name: @domain_params[:name]) else render 'new' end @@ -67,7 +67,7 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller @data = @domain.update(@domain_params) if response_ok? - redirect_to info_domains_path(domain_name: @domain_params[:name]) + redirect_to info_registrar_domains_url(domain_name: @domain_params[:name]) else params[:domain_name] = @domain_params[:name] render 'new' diff --git a/app/controllers/registrar/polls_controller.rb b/app/controllers/registrar/polls_controller.rb index db0a83258..9dd284512 100644 --- a/app/controllers/registrar/polls_controller.rb +++ b/app/controllers/registrar/polls_controller.rb @@ -24,7 +24,7 @@ class Registrar::PollsController < Registrar::DeppController # EPP controller @data = @domain.confirm_keyrelay(domain_params) if response_ok? - redirect_to info_domains_path(domain_name: domain_params[:name]) + redirect_to info_registrar_domains_url(domain_name: domain_params[:name]) else @results = @data.css('result') @data = depp_current_user.request(@ex.poll) From 921d8374f5f1a83c7dacf0f52189611a2a7c6239 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 15 Apr 2015 12:23:39 +0300 Subject: [PATCH 6/6] Contact index show ident in correct format --- app/helpers/application_helper.rb | 18 ++++++++++++++---- app/views/registrar/contacts/index.haml | 2 +- .../registrar/contacts/partials/_general.haml | 18 ++++++++---------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 98d3b0b58..5c1a9a401 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -10,11 +10,21 @@ module ApplicationHelper end def ident_for(contact) - case contact.ident_type - when 'birthday' - "#{contact.ident} [#{contact.ident_type}]" + if contact.kind_of? Hash + ident_country_code = contact[:ident_country_code] + ident_type = contact[:ident_type] + ident = contact[:ident] else - "#{contact.ident} [#{contact.ident_country_code} #{contact.ident_type}]" + ident_country_code = contact.ident_country_code + ident_type = contact.ident_type + ident = contact.ident + end + + case ident_type + when 'birthday' + "#{ident} [#{ident_type}]" + else + "#{ident} [#{ident_country_code} #{ident_type}]" end end diff --git a/app/views/registrar/contacts/index.haml b/app/views/registrar/contacts/index.haml index 33927ee89..39fd8dd10 100644 --- a/app/views/registrar/contacts/index.haml +++ b/app/views/registrar/contacts/index.haml @@ -16,7 +16,7 @@ %tr %td= link_to(c[:name], registrar_contact_path(id: c[:code])) %td= c[:code] - %td= c[:ident] + %td= ident_for(c) %td = 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') diff --git a/app/views/registrar/contacts/partials/_general.haml b/app/views/registrar/contacts/partials/_general.haml index 2524f34e9..3e3894278 100644 --- a/app/views/registrar/contacts/partials/_general.haml +++ b/app/views/registrar/contacts/partials/_general.haml @@ -3,21 +3,19 @@ %h3.panel-title= t(:general) .panel-body %dl.dl-horizontal - %dt= t(:ident) - %dd= ident_for(@contact) + %dt= t(:contact_code) + %dd= @contact.id + + %dt= t(:password) + %dd= @contact.password %br + %dt= t(:ident) + %dd= ident_for(@contact) + %dt= t(:email) %dd= @contact.email %dt= t(:phone) %dd= @contact.phone - - %br - - %dt= t(:contact_code) - %dd= @contact.id - - %dt= t(:password) - %dd= @contact.password