Merge branch '105842700-registrants_portal' into staging

* 105842700-registrants_portal:
  105842700-related_commit_for_113525877
This commit is contained in:
Stas 2016-02-17 17:54:07 +02:00
commit e60a6ae647
8 changed files with 40 additions and 4 deletions

View file

@ -19,6 +19,22 @@ class Registrant::DomainsController < RegistrantController
@domain = domains.find(params[:id]) @domain = domains.find(params[:id])
end end
def domain_verification_url
authorize! :view, :registrant_domains
dom = domains.find(params[:id])
if (dom.statuses.include?(DomainStatus::PENDING_UPDATE) || dom.statuses.include?(DomainStatus::PENDING_DELETE)) &&
dom.pending_json.present?
@domain = dom
confirm_path = "#{ENV['registrant_url']}/registrant/domain_update_confirms"
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
else
flash[:warning] = I18n.t('available_verification_url_not_found')
redirect_to registrant_domain_path(dom.id)
end
end
def download_list def download_list
authorize! :view, :registrant_domains authorize! :view, :registrant_domains
params[:q] ||= {} params[:q] ||= {}

View file

@ -2,6 +2,7 @@ class Registrant::RegistrantsController < RegistrantController
def show def show
@contact = Registrant.find(params[:id]) @contact = Registrant.find(params[:id])
@current_user = current_user
authorize! :read, @contact authorize! :read, @contact
@contact.valid? @contact.valid?
end end

View file

@ -460,7 +460,6 @@ class Contact < ActiveRecord::Base
domains.each{|d| d.roles = domain_c[d.id].uniq} domains.each{|d| d.roles = domain_c[d.id].uniq}
domains domains
end end
[]
end end
def set_linked def set_linked

View file

@ -0,0 +1,13 @@
- content_for :actions do
= render 'shared/title', name: @domain.name
.row
.col-md-12
.panel.panel-default
.panel-heading
%h3.panel-title= t(:personal_domain_verification_url)
.panel-body
.input-group.input-group-lg
%span#sizing-addon1.input-group-addon.glyphicon.glyphicon-link
%input.form-control{"aria-describedby" => "sizing-addon1", type: "text", value: @verification_url}

View file

@ -11,8 +11,8 @@
- @domain.statuses.each do |status| - @domain.statuses.each do |status|
%tr %tr
%td %td
- if @domain.pending_json.present? && [DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE].include?(status) - if [DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE].include?(status) && @domain.pending_json.present?
= link_to status, admin_domain_domain_versions_path(@domain.id) = link_to(status, domain_verification_url_registrant_domain_url(@domain.id))
- else - else
= status = status
%td= @domain.status_notes[status] %td= @domain.status_notes[status]

View file

@ -1,4 +1,4 @@
- domains = contact.all_registrant_domains(page: params[:domain_page], per: 20, params: params, current_user: current_user) - domains = contact.all_registrant_domains(page: params[:domain_page], per: 20, params: params, registrant: current_user)
#contacts.panel.panel-default #contacts.panel.panel-default
.panel-heading .panel-heading
.pull-left .pull-left

View file

@ -937,3 +937,5 @@ en:
edit_pw: 'Edit Pw' edit_pw: 'Edit Pw'
optional: 'Optional' optional: 'Optional'
contact_already_associated_with_the_domain: 'Object association prohibits operation, contact already associated with the domain' contact_already_associated_with_the_domain: 'Object association prohibits operation, contact already associated with the domain'
personal_domain_verification_url: 'Personal domain verification url'
available_verification_url_not_found: 'Available verification url not found, for domain.'

View file

@ -107,6 +107,11 @@ Rails.application.routes.draw do
collection do collection do
get :download_list get :download_list
end end
member do
get 'domain_verification_url'
end
end end
# resources :invoices do # resources :invoices do