Refactored contact with ability

This commit is contained in:
Priit Tark 2015-02-17 01:38:36 +02:00
parent 62f8061e10
commit 96d1c60dd8
33 changed files with 763 additions and 1045 deletions

View file

@ -22,20 +22,20 @@
%thead
%tr
%th{class: 'col-xs-2'}
= sort_link(@q, 'name', t('name'))
= sort_link(@q, 'name', t(:name))
%th{class: 'col-xs-2'}
= sort_link(@q, 'code', t('code'))
= sort_link(@q, 'ident', t(:identity))
%th{class: 'col-xs-2'}
= sort_link(@q, 'ident', t('identity_code'))
= sort_link(@q, 'email', t(:email))
%th{class: 'col-xs-2'}
= sort_link(@q, 'email', t('email'))
= sort_link(@q, 'code', t(:code))
%tbody
- @contacts.each do |x|
%tr
%td= link_to(x, admin_contact_path(x))
%td= x.code
%td= x.ident
%td= x.email
%td= x.code
.row
.col-md-12
= paginate @contacts

View file

@ -4,25 +4,17 @@
.panel-body
- unless @contact.address.nil?
%dl.dl-horizontal
%dt= t('country')
%dd= @contact.address.country
%dt= t('street')
%dd= @contact.street
%dt= t('city')
%dd= @contact.address.city
%dt= t('street')
%dd= @contact.address.street
- if @contact.address.street2
%dt= t('street')
%dd= @contact.address.street2
- if @contact.address.street3
%dt= t('street')
%dd= @contact.address.street3
%dd= @contact.city
%dt= t('zip')
%dd= @contact.address.zip
%dd= @contact.zip
%dt= t('state')
%dd= @contact.state
%dt= t('country')
%dd= @contact.country

View file

@ -3,30 +3,28 @@
%h3.panel-title= t('general')
.panel-body
%dl.dl-horizontal
%dt= t('name')
%dd= @contact.name
%dt= t(:ident)
%dd= @contact.ident + ' [' + @contact.ident_type + ']'
%dt= t('org_name')
%dd= @contact.org_name
%br
%dt= t('code')
%dd= @contact.code
%dt= t('ident')
%dd= @contact.ident
%dt= t('ident_type')
%dd= @contact.ident_type
%dt= t('email')
%dt= t(:email)
%dd= @contact.email
%dt= t('phone')
%dt= t(:phone)
%dd= @contact.phone
%dt= t(:org_name)
%dd= @contact.org_name
- if @contact.fax
%dt= t('fax')
%dt= t(:fax)
%dd= @contact.fax
%br
%dt= t(:code)
%dd= @contact.code
%dt= t('password')
%dd= @contact.auth_info

View file

@ -1,7 +1,7 @@
.row
.col-sm-12
%h2.text-center-xs
= "#{t('contact_details')}"
= @contact.name
%hr
.row
.col-md-6= render 'admin/contacts/partials/general'

View file

@ -1,13 +1,13 @@
address = @contact.address
xml.tag!('contact:postalInfo', type: 'int') do
xml.tag!('contact:name', @contact.name) if @disclosure.try(:[], :name) || @owner
xml.tag!('contact:org', @contact.org_name) if @disclosure.try(:[], :org_name) || @owner
if @disclosure.try(:addr) || @owner
xml.tag!('contact:name', @contact.name) #if @disclosure.try(:[], :name) || @owner
xml.tag!('contact:org', @contact.org_name) #if @disclosure.try(:[], :org_name) || @owner
# if @disclosure.try(:addr) || @owner
xml.tag!('contact:addr') do
xml.tag!('contact:street', address.street) if address
xml.tag!('contact:cc', address.country_code) unless address.country_code.nil?
xml.tag!('contact:city', address.city) if address
xml.tag!('contact:street', @contact.street)
xml.tag!('contact:city', @contact.city)
xml.tag!('contact:pc', @contact.zip)
xml.tag!('contact:sp', @contact.state)
xml.tag!('contact:cc', @contact.country_code)
end
end
# end
end

View file

@ -6,11 +6,10 @@ xml.epp_head do
xml.resData do
xml.tag!('contact:chkData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
#xml.tag!('contact:id', @contact.code)
@contacts.each do |contact|
@results.each do |result|
xml.tag!('contact:cd') do
xml.tag! "contact:id", contact[:code], avail: contact[:avail]
xml.tag!('contact:reason', contact[:reason]) unless contact[:avail] == 1
xml.tag! "contact:id", result[:code], avail: result[:avail]
xml.tag!('contact:reason', result[:reason]) unless result[:avail] == 1
end
end
end

View file

@ -8,9 +8,9 @@ xml.epp_head do
xml.tag!('contact:chkData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
xml.tag!('contact:id', @contact.code)
xml << render('/epp/contacts/postal_info')
xml.tag!('contact:voice', @contact.phone) if @disclosure.try(:phone) || @owner
xml.tag!('contact:fax', @contact.fax) if @disclosure.try(:fax) || @owner
xml.tag!('contact:email', @contact.email) if @disclosure.try(:email) || @owner
xml.tag!('contact:voice', @contact.phone) #if @disclosure.try(:phone) || @owner
xml.tag!('contact:fax', @contact.fax) #if @disclosure.try(:fax) || @owner
xml.tag!('contact:email', @contact.email) #if @disclosure.try(:email) || @owner
xml.tag!('contact:clID', @contact.registrar.try(:name))
xml.tag!('contact:crID', @contact.creator.try(:registrar))
xml.tag!('contact:crDate', @contact.created_at)
@ -19,17 +19,16 @@ xml.epp_head do
xml.tag!('contact:upDate', @contact.updated_at)
end
xml.tag!('contact:ident', @contact.ident, type: @contact.ident_type)
xml.tag!('contact:trDate', '123') if false
if @owner
# xml.tag!('contact:trDate', '123') if false
if can? :view_password, @contact
xml.tag!('contact:authInfo') do
xml.tag!('contact:pw', @contact.auth_info) # Doc says we have to return this but is it necessary?
xml.tag!('contact:pw', @contact.auth_info)
end
end
# statuses
@contact.statuses.each do |cs|
xml.tag!('contact:status', s: cs.value)
@contact.statuses.each do |status|
xml.tag!('contact:status', s: status.value)
end
xml << render('/epp/contacts/disclosure_policy')
# xml << render('/epp/contacts/disclosure_policy')
end
end