Add reserved pw field for registrar domain form #2565

This commit is contained in:
Martin Lensment 2015-07-10 11:16:53 +03:00
parent 048ab8a475
commit 5f1df12b48
3 changed files with 19 additions and 9 deletions

View file

@ -132,7 +132,7 @@ module Depp
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def construct_params_from_server_data(data)
def construct_params_from_server_data(data)
ret = default_params
ret[:name] = data.css('name').text
ret[:registrant] = data.css('registrant').text
@ -182,16 +182,18 @@ module Depp
# rubocop:enable Metrics/AbcSize
def construct_custom_params_hash(domain_params)
custom_params = {}
custom_params = { _anonymus: [] }
if domain_params[:legal_document].present?
type = domain_params[:legal_document].original_filename.split('.').last.downcase
custom_params = {
_anonymus: [
legalDocument: { value: Base64.encode64(domain_params[:legal_document].read), attrs: { type: type } }
]
custom_params[:_anonymus] << {
legalDocument: { value: Base64.encode64(domain_params[:legal_document].read), attrs: { type: type } }
}
end
if domain_params[:reserved_pw].present?
custom_params[:_anonymus] << { reserved: { pw: { value: domain_params[:reserved_pw] } } }
end
custom_params
end

View file

@ -5,7 +5,7 @@
= label_tag :domain_name, t(:name), class: 'required'
.col-md-7
- readonly = params[:domain_name] ? true : false
= text_field_tag('domain[name]', @domain_params[:name],
= text_field_tag('domain[name]', @domain_params[:name],
class: 'form-control', readonly: readonly, required: true)
- unless params[:domain_name]
@ -13,13 +13,20 @@
.col-md-3.control-label
= label_tag :domain_period, t(:period), class: 'required'
.col-md-7
= select_tag 'domain[period]',
= select_tag 'domain[period]',
options_for_select(Depp::Domain::PERIODS, @domain_params[:period]), { class: 'form-control' }
.form-group
.col-md-3.control-label
= label_tag :domain_registrant, t(:registrant), class: 'required'
.col-md-7
= select_tag "domain[registrant]",
= select_tag "domain[registrant]",
options_for_select(@contacts_autocomplete_map, selected: @domain_params[:registrant]),
include_blank: true, class: 'js-combobox', required: true
- unless params[:domain_name]
.form-group
.col-md-3.control-label
= label_tag :domain_reserved_pw, t(:reserved_pw)
.col-md-7
= text_field_tag('domain[reserved_pw]', @domain_params[:reserved_pw], class: 'form-control')

View file

@ -865,3 +865,4 @@ en:
export_csv: 'Export CSV'
reserved_domains: 'Reserved domains'
invalid_yaml: 'Invalid YAML'
reserved_pw: 'Reserved pw'