This commit is contained in:
Priit Tark 2015-05-14 11:02:26 +03:00
parent 14675f5bb7
commit ab6f59c09e
8 changed files with 48 additions and 2 deletions

View file

@ -0,0 +1,11 @@
class Registrant::WhoisController < RegistrantController
def index
authorize! :view, Registrant::Whois
if params[:domain_name].present?
whois_url = "#{ENV['restful_whois_url']}/v1/#{params[:domain_name]}"
binding.pry
page = Nokogiri::HTML(open(whois_url))
@results = 'ee'
end
end
end

View file

@ -13,6 +13,7 @@ class Ability
when 'ApiUser'
epp
registrar
registrant # refactor
end
can :show, :dashboard
@ -63,6 +64,10 @@ class Ability
can :manage, :deposit
end
def registrant
can :manage, Registrant::Whois
end
def user
can :show, :dashboard
end

View file

@ -36,6 +36,9 @@
- active_class = %w(registrant/domains registrant/check registrant/renew registrant/tranfer registrant/keyrelays).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:domains), registrant_domains_path
- active_class = %w(registrant/whois).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:whois), registrant_whois_path
%ul.nav.navbar-nav.navbar-right
- if user_signed_in?
%li= link_to t(:log_out, user: current_user), '/registrant/logout'

View file

@ -0,0 +1,21 @@
= render 'shared/title', name: t(:whois)
- if ENV['restful_whois_url'].blank?
%p
Registrant configuration issue: missing restful_whois_url
- else
.row
.col-md-12{style: 'margin-bottom: -15px;'}
= form_tag registrant_whois_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
.col-md-1.text-right.text-center-xs
.form-group
%button.btn.btn-default
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%hr
- if @results
= @results