diff --git a/app/controllers/depp/application_controller.rb b/app/controllers/depp/application_controller.rb
deleted file mode 100644
index ff59a5342..000000000
--- a/app/controllers/depp/application_controller.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-module Depp
- # class ApplicationController < ::ApplicationController
- class ApplicationController < ActionController::Base
- include CurrentUserHelper
- include Depp::ApplicationHelper
-
- # Prevent CSRF attacks by raising an exception.
- # For APIs, you may want to use :null_session instead.
- protect_from_forgery with: :exception
-
- helper_method :depp_current_user
-
- rescue_from(Errno::ECONNRESET, Errno::ECONNREFUSED) do |_exception|
- redirect_to login_url, alert: t(:no_connection_to_registry)
- end
-
- before_action :authenticate_user
- def authenticate_user
- redirect_to main_app.login_url and return unless depp_current_user
- end
-
- def depp_current_user
- return nil unless current_user
- @depp_current_user ||= Depp::User.new(
- tag: current_user.username,
- password: current_user.password
- )
- end
-
- def response_ok?
- @data.css('result').each do |x|
- success_codes = %(1000, 1300, 1301)
- return false unless success_codes.include?(x['code'])
- end
- true
- end
- end
-end
diff --git a/app/controllers/depp/contacts_controller.rb b/app/controllers/depp/contacts_controller.rb
deleted file mode 100644
index b4444fde3..000000000
--- a/app/controllers/depp/contacts_controller.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-module Depp
- class ContactsController < ApplicationController
- before_action :init_epp_contact
-
- def index
- limit, offset = pagination_details
-
- res = depp_current_user.repp_request('contacts', { details: true, limit: limit, offset: offset })
- flash.now[:epp_results] = [{ 'code' => res.code, 'msg' => res.message }]
- @response = res.parsed_body.with_indifferent_access if res.code == '200'
- @contacts = @response ? @response[:contacts] : []
-
- @paginatable_array = Kaminari.paginate_array(
- [], total_count: @response[:total_number_of_records]
- ).page(params[:page]).per(limit)
- end
-
- def new
- @contact = Depp::Contact.new
- end
-
- def show
- @contact = Depp::Contact.find_by_id(params[:id])
- end
-
- def edit
- @contact = Depp::Contact.find_by_id(params[:id])
- end
-
- def create
- @contact = Depp::Contact.new(params[:contact])
-
- if @contact.save
- redirect_to contact_url(@contact.id)
- else
- render 'new'
- end
- end
-
- def update
- @contact = Depp::Contact.new(params[:contact])
-
- if @contact.update_attributes(params[:contact])
- redirect_to contact_url(@contact.id)
- else
- render 'edit'
- end
- end
-
- def delete
- @contact = Depp::Contact.find_by_id(params[:id])
- end
-
- def destroy
- @contact = Depp::Contact.new(params[:contact])
-
- if @contact.delete
- redirect_to contacts_url, notice: t(:destroyed)
- else
- render 'delete'
- end
- end
-
- def check
- @ids = params[:contacts]
- # if @ids
- # @contacts = []
- # @ids.split(',').each do |id|
- # @contacts << id.strip
- # end
- # end
- return unless @ids
-
- @data = @contact.check(@ids)
- @contacts = Depp::Contact.construct_check_hash_from_data(@data)
- end
-
- private
-
- def init_epp_contact
- Depp::Contact.user = depp_current_user
- end
- end
-end
diff --git a/app/controllers/depp/domains_controller.rb b/app/controllers/depp/domains_controller.rb
deleted file mode 100644
index 6116fc9ce..000000000
--- a/app/controllers/depp/domains_controller.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-module Depp
- class DomainsController < ApplicationController
- before_action :init_domain, except: :new
-
- def index
- limit, offset = pagination_details
-
- res = depp_current_user.repp_request('domains', { details: true, limit: limit, offset: offset })
- flash.now[:epp_results] = [{ 'code' => res.code, 'msg' => res.message }]
- @response = res.parsed_body.with_indifferent_access if res.code == '200'
- @contacts = @response ? @response[:contacts] : []
-
- @paginatable_array = Kaminari.paginate_array(
- [], total_count: @response[:total_number_of_records]
- ).page(params[:page]).per(limit)
- end
-
- def info
- @data = @domain.info(params[:domain_name]) if params[:domain_name]
- if response_ok?
- render 'info'
- else
- flash[:alert] = t('domain_not_found')
- redirect_to domains_path and return
- end
- end
-
- def check
- if params[:domain_name]
- @data = @domain.check(params[:domain_name])
- render 'check_index' and return unless response_ok?
- else
- render 'check_index'
- end
- end
-
- def new
- @domain_params = Depp::Domain.default_params
- end
-
- def create
- @domain_params = params[:domain]
- @data = @domain.create(@domain_params)
-
- if response_ok?
- redirect_to info_domains_path(domain_name: @domain_params[:name])
- else
- render 'new'
- end
- end
-
- def edit
- @data = @domain.info(params[:domain_name])
- @domain_params = Depp::Domain.construct_params_from_server_data(@data)
- end
-
- def update
- @domain_params = params[:domain]
- @data = @domain.update(@domain_params)
-
- if response_ok?
- redirect_to info_domains_path(domain_name: @domain_params[:name])
- else
- params[:domain_name] = @domain_params[:name]
- render 'new'
- end
- end
-
- def delete; end
-
- def destroy
- @data = @domain.delete(params[:domain])
- @results = @data.css('result')
- if response_ok?
- params[:domain_name] = nil
- render 'info_index'
- else
- params[:domain_name] = params[:domain][:name]
- render 'delete'
- end
- end
-
- def renew
- if params[:domain_name] && params[:cur_exp_date]
- @data = @domain.renew(params)
- render 'renew_index' and return unless response_ok?
- else
- render 'renew_index'
- end
- end
-
- def transfer
- if params[:domain_name]
- @data = @domain.transfer(params)
- render 'transfer_index' and return unless response_ok?
- else
- render 'transfer_index'
- end
- end
-
- private
-
- def init_domain
- @domain = Depp::Domain.new(current_user: depp_current_user)
- end
- end
-end
diff --git a/app/controllers/depp/keyrelays_controller.rb b/app/controllers/depp/keyrelays_controller.rb
deleted file mode 100644
index 0596e1444..000000000
--- a/app/controllers/depp/keyrelays_controller.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-module Depp
- class KeyrelaysController < ApplicationController
- def show; end
-
- def create
- keyrelay = Depp::Keyrelay.new(current_user: depp_current_user)
- @data = keyrelay.keyrelay(params)
-
- if response_ok?
- flash[:epp_results] = [{ 'code' => '1000', 'msg' => 'Command completed successfully' }]
- redirect_to keyrelay_path
- else
- render 'show'
- end
- end
- end
-end
diff --git a/app/controllers/depp/polls_controller.rb b/app/controllers/depp/polls_controller.rb
deleted file mode 100644
index 16d8918e5..000000000
--- a/app/controllers/depp/polls_controller.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-module Depp
- class PollsController < ApplicationController
- before_action :init_epp_xml
-
- def show
- @data = depp_current_user.request(@ex.poll)
- end
-
- def destroy
- @data = depp_current_user.request(@ex.poll(poll: {
- value: '', attrs: { op: 'ack', msgID: params[:id] }
- }))
-
- @results = @data.css('result')
-
- @data = depp_current_user.request(@ex.poll)
- render 'show'
- end
-
- def confirm_keyrelay
- domain_params = params[:domain]
- @data = @domain.confirm_keyrelay(domain_params)
-
- if response_ok?
- redirect_to info_domains_path(domain_name: domain_params[:name])
- else
- @results = @data.css('result')
- @data = depp_current_user.request(@ex.poll)
- render 'show'
- end
- end
-
- def confirm_transfer
- domain_params = params[:domain]
- @data = @domain.confirm_transfer(domain_params)
-
- @results = @data.css('result')
- @data = depp_current_user.request(@ex.poll)
-
- render 'show'
- end
-
- private
-
- def init_epp_xml
- @ex = EppXml::Session.new(cl_trid_prefix: depp_current_user.tag)
- @domain = Depp::Domain.new(current_user: depp_current_user)
- end
- end
-end
diff --git a/app/controllers/depp/xml_consoles_controller.rb b/app/controllers/depp/xml_consoles_controller.rb
deleted file mode 100644
index ae417695e..000000000
--- a/app/controllers/depp/xml_consoles_controller.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-module Depp
- class XmlConsolesController < ApplicationController
- def show; end
-
- def create
- begin
- @result = depp_current_user.server.request(params[:payload])
- rescue
- @result = 'CONNECTION ERROR - Is the EPP server running?'
- end
- render :show
- end
-
- def load_xml
- # binding.pry
- cl_trid = "#{depp_current_user.tag}-#{Time.now.to_i}"
- xml_dir_path = Depp::Engine.root + 'app/views/depp/xml_consoles/epp_requests'
- xml = File.read("#{xml_dir_path}/#{params[:obj]}/#{params[:epp_action]}.xml")
- xml.gsub!('ABC-12345', "#{cl_trid}")
- render text: xml
- end
- end
-end
diff --git a/app/controllers/registrar/contacts_controller.rb b/app/controllers/registrar/contacts_controller.rb
new file mode 100644
index 000000000..43c2bc4c9
--- /dev/null
+++ b/app/controllers/registrar/contacts_controller.rb
@@ -0,0 +1,76 @@
+class Registrar::ContactsController < Registrar::DeppController # EPP controller
+ before_action :init_epp_contact
+
+ def index
+ authorize! :view, Depp::Contact
+ limit, offset = pagination_details
+
+ res = depp_current_user.repp_request('contacts', { details: true, limit: limit, offset: offset })
+ flash.now[:epp_results] = [{ 'code' => res.code, 'msg' => res.message }]
+ @response = res.parsed_body.with_indifferent_access if res.code == '200'
+ @contacts = @response ? @response[:contacts] : []
+
+ @paginatable_array = Kaminari.paginate_array(
+ [], total_count: @response[:total_number_of_records]
+ ).page(params[:page]).per(limit)
+ end
+
+ def new
+ authorize! :create, Depp::Contact
+ @contact = Depp::Contact.new
+ end
+
+ def show
+ authorize! :view, Depp::Contact
+ @contact = Depp::Contact.find_by_id(params[:id])
+ end
+
+ def edit
+ authorize! :edit, Depp::Contact
+ @contact = Depp::Contact.find_by_id(params[:id])
+ end
+
+ def create
+ authorize! :create, Depp::Contact
+ @contact = Depp::Contact.new(params[:contact])
+
+ if @contact.save
+ redirect_to registrar_contact_url(@contact.id)
+ else
+ render 'new'
+ end
+ end
+
+ def update
+ authorize! :edit, Depp::Contact
+ @contact = Depp::Contact.new(params[:contact])
+
+ if @contact.update_attributes(params[:contact])
+ redirect_to registrar_contact_url(@contact.id)
+ else
+ render 'edit'
+ end
+ end
+
+ def delete
+ authorize! :delete, Depp::Contact
+ @contact = Depp::Contact.find_by_id(params[:id])
+ end
+
+ def destroy
+ authorize! :delete, Depp::Contact
+ @contact = Depp::Contact.new(params[:contact])
+
+ if @contact.delete
+ redirect_to registrar_contacts_url, notice: t(:destroyed)
+ else
+ render 'delete'
+ end
+ end
+
+ private
+
+ def init_epp_contact
+ Depp::Contact.user = depp_current_user
+ end
+end
diff --git a/app/controllers/registrar/depp_controller.rb b/app/controllers/registrar/depp_controller.rb
new file mode 100644
index 000000000..3d1fc2692
--- /dev/null
+++ b/app/controllers/registrar/depp_controller.rb
@@ -0,0 +1,35 @@
+class Registrar::DeppController < RegistrarController # EPP controller
+ include CurrentUserHelper
+ include Depp::ApplicationHelper
+
+ # Prevent CSRF attacks by raising an exception.
+ # For APIs, you may want to use :null_session instead.
+ protect_from_forgery with: :exception
+
+ helper_method :depp_current_user
+
+ rescue_from(Errno::ECONNRESET, Errno::ECONNREFUSED) do |_exception|
+ redirect_to registrar_login_url, alert: t(:no_connection_to_registry)
+ end
+
+ before_action :authenticate_user
+ def authenticate_user
+ redirect_to registrar_login_url and return unless depp_current_user
+ end
+
+ def depp_current_user
+ return nil unless current_user
+ @depp_current_user ||= Depp::User.new(
+ tag: current_user.username,
+ password: current_user.password
+ )
+ end
+
+ def response_ok?
+ @data.css('result').each do |x|
+ success_codes = %(1000, 1300, 1301)
+ return false unless success_codes.include?(x['code'])
+ end
+ true
+ end
+end
diff --git a/app/controllers/registrar/domains_controller.rb b/app/controllers/registrar/domains_controller.rb
new file mode 100644
index 000000000..148940c08
--- /dev/null
+++ b/app/controllers/registrar/domains_controller.rb
@@ -0,0 +1,117 @@
+class Registrar::DomainsController < Registrar::DeppController # EPP controller
+ before_action :init_domain, except: :new
+
+ def index
+ authorize! :view, Depp::Domain
+ limit, offset = pagination_details
+
+ res = depp_current_user.repp_request('domains', { details: true, limit: limit, offset: offset })
+ flash.now[:epp_results] = [{ 'code' => res.code, 'msg' => res.message }]
+ @response = res.parsed_body.with_indifferent_access if res.code == '200'
+ @contacts = @response ? @response[:contacts] : []
+
+ @paginatable_array = Kaminari.paginate_array(
+ [], total_count: @response[:total_number_of_records]
+ ).page(params[:page]).per(limit)
+ end
+
+ def info
+ authorize! :view, Depp::Domain
+ @data = @domain.info(params[:domain_name]) if params[:domain_name]
+ if response_ok?
+ render 'info'
+ else
+ flash[:alert] = t('domain_not_found')
+ redirect_to domains_path and return
+ end
+ end
+
+ def check
+ authorize! :view, Depp::Domain
+ if params[:domain_name]
+ @data = @domain.check(params[:domain_name])
+ render 'check_index' and return unless response_ok?
+ else
+ render 'check_index'
+ end
+ end
+
+ def new
+ authorize! :create, Depp::Domain
+ @domain_params = Depp::Domain.default_params
+ end
+
+ def create
+ authorize! :create, Depp::Domain
+ @domain_params = params[:domain]
+ @data = @domain.create(@domain_params)
+
+ if response_ok?
+ redirect_to info_domains_path(domain_name: @domain_params[:name])
+ else
+ render 'new'
+ end
+ end
+
+ def edit
+ authorize! :update, Depp::Domain
+ @data = @domain.info(params[:domain_name])
+ @domain_params = Depp::Domain.construct_params_from_server_data(@data)
+ end
+
+ def update
+ authorize! :update, Depp::Domain
+ @domain_params = params[:domain]
+ @data = @domain.update(@domain_params)
+
+ if response_ok?
+ redirect_to info_domains_path(domain_name: @domain_params[:name])
+ else
+ params[:domain_name] = @domain_params[:name]
+ render 'new'
+ end
+ end
+
+ def delete
+ authorize! :delete, Depp::Domain
+ end
+
+ def destroy
+ authorize! :delete, Depp::Domain
+ @data = @domain.delete(params[:domain])
+ @results = @data.css('result')
+ if response_ok?
+ params[:domain_name] = nil
+ render 'info_index'
+ else
+ params[:domain_name] = params[:domain][:name]
+ render 'delete'
+ end
+ end
+
+ def renew
+ authorize! :renew, Depp::Domain
+ if params[:domain_name] && params[:cur_exp_date]
+ @data = @domain.renew(params)
+ render 'renew_index' and return unless response_ok?
+ else
+ render 'renew_index'
+ end
+ end
+
+ def transfer
+ authorize! :transfer, Depp::Domain
+ if params[:domain_name]
+ @data = @domain.transfer(params)
+ render 'transfer_index' and return unless response_ok?
+ else
+ render 'transfer_index'
+ end
+ end
+
+ private
+
+ def init_domain
+ @domain = Depp::Domain.new(current_user: depp_current_user)
+ end
+end
diff --git a/app/controllers/registrar/keyrelays_controller.rb b/app/controllers/registrar/keyrelays_controller.rb
new file mode 100644
index 000000000..a6d6789c7
--- /dev/null
+++ b/app/controllers/registrar/keyrelays_controller.rb
@@ -0,0 +1,18 @@
+class Registrar::KeyrelaysController < Registrar::DeppController # EPP controller
+ def show
+ authorize! :view, Depp::Keyrelay
+ end
+
+ def create
+ authorize! :create, Depp::Keyrelay
+ keyrelay = Depp::Keyrelay.new(current_user: depp_current_user)
+ @data = keyrelay.keyrelay(params)
+
+ if response_ok?
+ flash[:epp_results] = [{ 'code' => '1000', 'msg' => 'Command completed successfully' }]
+ redirect_to keyrelay_path
+ else
+ render 'show'
+ end
+ end
+end
diff --git a/app/controllers/registrar/polls_controller.rb b/app/controllers/registrar/polls_controller.rb
new file mode 100644
index 000000000..37f5700f2
--- /dev/null
+++ b/app/controllers/registrar/polls_controller.rb
@@ -0,0 +1,52 @@
+class Registrar::PollsController < Registrar::DeppController # EPP controller
+ before_action :init_epp_xml
+
+ def show
+ authorize! :view, :registrar_dashboard
+ @data = depp_current_user.request(@ex.poll)
+ end
+
+ def destroy
+ authorize! :delete, :registrar_poll
+ @data = depp_current_user.request(@ex.poll(poll: {
+ value: '', attrs: { op: 'ack', msgID: params[:id] }
+ }))
+
+ @results = @data.css('result')
+
+ @data = depp_current_user.request(@ex.poll)
+ render 'show'
+ end
+
+ def confirm_keyrelay
+ authorize! :confirm, :keyrelay
+ domain_params = params[:domain]
+ @data = @domain.confirm_keyrelay(domain_params)
+
+ if response_ok?
+ redirect_to info_domains_path(domain_name: domain_params[:name])
+ else
+ @results = @data.css('result')
+ @data = depp_current_user.request(@ex.poll)
+ render 'show'
+ end
+ end
+
+ def confirm_transfer
+ authorize! :confirm, :transfer
+ domain_params = params[:domain]
+ @data = @domain.confirm_transfer(domain_params)
+
+ @results = @data.css('result')
+ @data = depp_current_user.request(@ex.poll)
+
+ render 'show'
+ end
+
+ private
+
+ def init_epp_xml
+ @ex = EppXml::Session.new(cl_trid_prefix: depp_current_user.tag)
+ @domain = Depp::Domain.new(current_user: depp_current_user)
+ end
+end
diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb
index f8a9f76ea..65ed23c4f 100644
--- a/app/controllers/registrar/sessions_controller.rb
+++ b/app/controllers/registrar/sessions_controller.rb
@@ -1,5 +1,5 @@
-class Registrar::SessionsController < SessionsController
- layout 'depp/application'
+class Registrar::SessionsController < ::SessionsController
+ layout 'registrar/application'
def create
@user = ApiUser.first if params[:user1]
diff --git a/app/controllers/registrar/xml_consoles_controller.rb b/app/controllers/registrar/xml_consoles_controller.rb
new file mode 100644
index 000000000..f51c4a86c
--- /dev/null
+++ b/app/controllers/registrar/xml_consoles_controller.rb
@@ -0,0 +1,24 @@
+class Registrar::XmlConsolesController < Registrar::DeppController # EPP controller
+ def show
+ authorize! :view, :registrar_xml_console
+ end
+
+ def create
+ authorize! :create, :registrar_xml_console
+ begin
+ @result = depp_current_user.server.request(params[:payload])
+ rescue
+ @result = 'CONNECTION ERROR - Is the EPP server running?'
+ end
+ render :show
+ end
+
+ def load_xml
+ # binding.pry
+ cl_trid = "#{depp_current_user.tag}-#{Time.now.to_i}"
+ xml_dir_path = Depp::Engine.root + 'app/views/depp/xml_consoles/epp_requests'
+ xml = File.read("#{xml_dir_path}/#{params[:obj]}/#{params[:epp_action]}.xml")
+ xml.gsub!('ABC-12345', "#{cl_trid}")
+ render text: xml
+ end
+end
diff --git a/app/controllers/registrar_controller.rb b/app/controllers/registrar_controller.rb
index 9def33a7e..895f5c318 100644
--- a/app/controllers/registrar_controller.rb
+++ b/app/controllers/registrar_controller.rb
@@ -1,4 +1,4 @@
class RegistrarController < ApplicationController
before_action :authenticate_user!
- layout 'depp/application'
+ layout 'registrar/application'
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 037173938..f2fe3f827 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -2,6 +2,7 @@ class Ability
include CanCan::Ability
def initialize(user)
+ alias_action :show, to: :view
alias_action :show, :create, :update, :destroy, to: :crud
@user = user || AdminUser.new
@@ -46,11 +47,20 @@ class Ability
def registrar
can :manage, Invoice
+ can :view, :registrar_dashboard
+ can :delete, :registrar_poll
+ can :manage, :registrar_xml_console
+ can :manage, Depp::Contact
+ can :manage, Depp::Domain
+ can :renew, Depp::Domain
+ can :transfer, Depp::Domain
+ can :manage, Depp::Keyrelay
+ can :confirm, :keyrelay
+ can :confirm, :transfer
end
def user
can :show, :dashboard
- can :manage, Invoice
end
def customer_service
diff --git a/app/views/depp/contacts/_form.haml b/app/views/depp/contacts/_form.haml
deleted file mode 100644
index d3c920b02..000000000
--- a/app/views/depp/contacts/_form.haml
+++ /dev/null
@@ -1,24 +0,0 @@
-= form_for(@contact, html: {class: 'form-horizontal js-contact-form'}) do |f|
- = render 'depp/shared/error_messages', f: f
- = f.hidden_field :id
- = f.hidden_field :password
- .row
- .col-md-12
- = render 'depp/contacts/form_partials/general', f: f
- .row
- .col-md-12
- = render 'depp/contacts/form_partials/address', f: f
- - if !@contact.persisted?
- .row
- .col-md-12
- = render 'depp/contacts/form_partials/code', f: f
- .row
- .col-md-12
- = render 'depp/contacts/form_partials/legal_document', f: f
-
- .row
- .col-md-12.text-right
- - if @contact.persisted?
- = button_tag(t(:save), class: 'btn btn-primary')
- - else
- = button_tag(t(:create), class: 'btn btn-primary')
diff --git a/app/views/depp/contacts/check.haml b/app/views/depp/contacts/check.haml
deleted file mode 100644
index 35517ad39..000000000
--- a/app/views/depp/contacts/check.haml
+++ /dev/null
@@ -1,33 +0,0 @@
-= render 'depp/shared/title', name: t(:contact_info)
-
-%hr
-.row
- .col-md-12
- = form_tag check_contacts_path, class: 'form-horizontal', method: :get do
- .col-md-11
- .form-group
- = text_field_tag :contacts, params[:contacts], class: 'form-control', autocomplete: 'off'
-
- .col-md-1.text-right.text-center-xs
- .form-group
- .col-md-offset-2.col-md-10
- %button.btn.btn-primary
-
- %span.glyphicon.glyphicon-search
-
-
-- if @contacts
- %hr
- .row
- .col-md-12
- .table-responsive
- %table.table.table-hover.table-bordered.table-condensed
- %thead
- %tr
- %th= t('id')
- %th= t('value')
- %tbody
- - @contacts.each do |contact|
- %tr
- %td= contact[:id]
- %td= contact[:reason]
diff --git a/app/views/depp/contacts/delete.haml b/app/views/depp/contacts/delete.haml
deleted file mode 100644
index 1918461fa..000000000
--- a/app/views/depp/contacts/delete.haml
+++ /dev/null
@@ -1,18 +0,0 @@
-- if @contact.persisted?
- = render 'depp/shared/title', name: "#{t(:delete)}: #{@contact.name}"
-
- = form_for(@contact, class: 'form-horizontal', multipart: true, method: :delete) do |f|
- = render 'depp/shared/error_messages', f: f
- = f.hidden_field :id
- = f.hidden_field :password
-
- .row
- .col-md-12
- = render 'depp/contacts/form_partials/legal_document', f: f
-
- %hr
- .row
- .col-md-12.text-right
- = button_tag t(:delete), class: 'btn btn-danger'
-- else
- %h2= "#{t(:delete)}: #{t(:not_found)}"
diff --git a/app/views/depp/contacts/edit.haml b/app/views/depp/contacts/edit.haml
deleted file mode 100644
index 067b6423b..000000000
--- a/app/views/depp/contacts/edit.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-= render 'depp/shared/title', name: "#{t(:edit)}: #{@contact.name}"
-
-= render 'form'
diff --git a/app/views/depp/contacts/new.haml b/app/views/depp/contacts/new.haml
deleted file mode 100644
index e4232f184..000000000
--- a/app/views/depp/contacts/new.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-= render 'depp/shared/title', name: t(:new_contact)
-
-= render 'form'
diff --git a/app/views/depp/contacts/show.haml b/app/views/depp/contacts/show.haml
deleted file mode 100644
index bb070126e..000000000
--- a/app/views/depp/contacts/show.haml
+++ /dev/null
@@ -1,16 +0,0 @@
-- if @contact.id.present?
- - content_for :actions do
- = link_to(t(:edit), edit_contact_path(@contact.id), class: 'btn btn-primary')
- = link_to(t(:delete), delete_contact_path(@contact.id), class: 'btn btn-default')
- = render 'depp/shared/title', name: truncate(@contact.name)
-
- .row
- .col-md-6= render 'depp/contacts/partials/general'
- .col-md-6= render 'depp/contacts/partials/address'
- .row
- .col-md-12= render 'depp/contacts/partials/statuses', statuses: @contact.statuses
-
-- else
- .row
- .col-sm-6
- %h1= t(:not_found)
diff --git a/app/views/depp/domains/check_index.haml b/app/views/depp/domains/check_index.haml
deleted file mode 100644
index e01a408b9..000000000
--- a/app/views/depp/domains/check_index.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-= render 'depp/shared/title', name: t(:check_domain)
-
-.row
- .col-md-12
- = render 'check_form'
diff --git a/app/views/depp/domains/edit.haml b/app/views/depp/domains/edit.haml
deleted file mode 100644
index a258438bf..000000000
--- a/app/views/depp/domains/edit.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-= render 'depp/shared/title', name: "#{t(:edit)}: #{params[:domain_name]}"
-
-%hr
-= render 'form'
diff --git a/app/views/depp/domains/info.haml b/app/views/depp/domains/info.haml
deleted file mode 100644
index 8aee91523..000000000
--- a/app/views/depp/domains/info.haml
+++ /dev/null
@@ -1,26 +0,0 @@
-- content_for :actions do
- = link_to(t(:edit), edit_domains_path(domain_name: params[:domain_name]),
- class: 'btn btn-primary')
- = link_to(t(:renew), renew_domains_path(domain_name: params[:domain_name]),
- class: 'btn btn-default')
- = link_to(t(:delete), delete_domains_path(domain_name: params[:domain_name]),
- class: 'btn btn-default')
-= render 'depp/shared/title', name: truncate(@data.css('name').text)
-
-.row
- .col-sm-12
- - if @data.css('result').first['code'] == '1000'
- .row
- .col-md-12= render 'depp/domains/partials/general'
- .row
- .col-md-12= render 'depp/domains/partials/contacts'
- .row
- .col-md-12= render 'depp/domains/partials/statuses'
- .row
- .col-md-12= render 'depp/domains/partials/nameservers'
- .row
- .col-md-12= render 'depp/domains/partials/dnskeys'
- - else
- .row
- .col-sm-6
- %h1= t(:not_found)
diff --git a/app/views/depp/domains/new.haml b/app/views/depp/domains/new.haml
deleted file mode 100644
index 72ab1493e..000000000
--- a/app/views/depp/domains/new.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-= render 'depp/shared/title', name: t(:new_domain)
-
-= render 'form'
diff --git a/app/views/layouts/depp/application.haml b/app/views/layouts/registrar/application.haml
similarity index 50%
rename from app/views/layouts/depp/application.haml
rename to app/views/layouts/registrar/application.haml
index b325a61d0..9c011bec4 100644
--- a/app/views/layouts/depp/application.haml
+++ b/app/views/layouts/registrar/application.haml
@@ -28,39 +28,42 @@
- if current_user
.navbar-collapse.collapse
%ul.nav.navbar-nav.public-nav
- - active_class = %w(depp/domains depp/check depp/renew depp/tranfer depp/keyrelays).include?(params[:controller]) ? 'active' :nil
- %li{class: active_class}= link_to t(:domains), depp.domains_path
-
- - active_class = ['depp/contacts'].include?(params[:controller]) ? 'active' :nil
- %li{class: active_class}= link_to t(:contacts), depp.contacts_path
+ - if can? :view, Depp::Domain
+ - active_class = %w(registrar/domains registrar/check registrar/renew registrar/tranfer registrar/keyrelays).include?(params[:controller]) ? 'active' :nil
+ %li{class: active_class}= link_to t(:domains), registrar_domains_path
+ - if can? :view, Depp::Contact
+ - active_class = ['registrar/contacts'].include?(params[:controller]) ? 'active' :nil
+ %li{class: active_class}= link_to t(:contacts), registrar_contacts_path
- if can? :show, Invoice
- active_class = ['registrar/invoices'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t('invoices'), main_app.registrar_invoices_path
- - active_class = ['depp/xml_consoles'].include?(params[:controller]) ? 'active' :nil
- %li{class: active_class}= link_to t(:xml_console), depp.xml_console_path
+ - if can? :view, :registrar_xml_console
+ - active_class = ['registrar/xml_consoles'].include?(params[:controller]) ? 'active' :nil
+ %li{class: active_class}= link_to t(:xml_console), registrar_xml_console_path
%ul.nav.navbar-nav.navbar-right
- %li= link_to t('log_out', user: current_user), '/registrar/logout'
- %li.dropdown
- = link_to 'Registrar '.html_safe, '#',
- class: 'dropdown-toggle', 'data-toggle': 'dropdown', role: 'button'
- %ul.dropdown-menu{'role': 'menu'}
- %li.dropdown-header= t(:switch_to) + ':'
- %li= link_to t(:registrant), '#'
- %li= link_to t(:registrar), '#'
+ - if user_signed_in?
+ %li= link_to t('log_out', user: current_user), '/registrar/logout'
+ -# %li.dropdown
+ -# = link_to 'Registrar '.html_safe, '#',
+ -# class: 'dropdown-toggle', 'data-toggle': 'dropdown', role: 'button'
+ -# %ul.dropdown-menu{'role': 'menu'}
+ -# %li.dropdown-header= t(:switch_to) + ':'
+ -# %li= link_to t(:registrant), '#'
+ -# %li= link_to t(:registrar), '#'
/ /.nav-collapse
.container
- - if params[:controller].start_with?('depp/')
- = render 'depp/shared/flash'
- = render 'depp/shared/epp_results'
- - else
- - display = (flash.empty?) ? 'none' : 'block'
- #flash{style: "display: #{display};"}
- - type = (flash[:notice]) ? 'bg-success' : 'bg-danger'
- .alert{class: type}= flash[:notice] || flash[:alert]
+ -# - if params[:controller].start_with?('depp/')
+ -# = render 'depp/shared/flash'
+ -# = render 'depp/shared/epp_results'
+ -# - else
+ - display = (flash.empty?) ? 'none' : 'block'
+ #flash{style: "display: #{display};"}
+ - type = (flash[:notice]) ? 'bg-success' : 'bg-danger'
+ .alert{class: type}= flash[:notice] || flash[:alert]
= yield
.footer.text-right
diff --git a/app/views/registrar/contacts/_form.haml b/app/views/registrar/contacts/_form.haml
new file mode 100644
index 000000000..129983b20
--- /dev/null
+++ b/app/views/registrar/contacts/_form.haml
@@ -0,0 +1,23 @@
+= render 'registrar/shared/error_messages', f: f
+= f.hidden_field :id
+= f.hidden_field :password
+.row
+ .col-md-12
+ = render 'registrar/contacts/form_partials/general', f: f
+.row
+ .col-md-12
+ = render 'registrar/contacts/form_partials/address', f: f
+- if !@contact.persisted?
+ .row
+ .col-md-12
+ = render 'registrar/contacts/form_partials/code', f: f
+.row
+ .col-md-12
+ = render 'registrar/contacts/form_partials/legal_document', f: f
+
+.row
+ .col-md-12.text-right
+ - if @contact.persisted?
+ = button_tag(t(:save), class: 'btn btn-primary')
+ - else
+ = button_tag(t(:create), class: 'btn btn-primary')
diff --git a/app/views/registrar/contacts/delete.haml b/app/views/registrar/contacts/delete.haml
new file mode 100644
index 000000000..475246d87
--- /dev/null
+++ b/app/views/registrar/contacts/delete.haml
@@ -0,0 +1,20 @@
+- if @contact.persisted?
+ = render 'registrar/shared/title', name: "#{t(:delete)}: #{@contact.name}"
+
+ = form_for(@contact, url: registrar_contact_path(@contact),
+ class: 'form-horizontal', multipart: true, method: :delete) do |f|
+
+ = render 'registrar/shared/error_messages', f: f
+ = f.hidden_field :id
+ = f.hidden_field :password
+
+ .row
+ .col-md-12
+ = render 'registrar/contacts/form_partials/legal_document', f: f
+
+ %hr
+ .row
+ .col-md-12.text-right
+ = button_tag t(:delete), class: 'btn btn-danger'
+- else
+ %h2= "#{t(:delete)}: #{t(:not_found)}"
diff --git a/app/views/registrar/contacts/edit.haml b/app/views/registrar/contacts/edit.haml
new file mode 100644
index 000000000..45d3cc639
--- /dev/null
+++ b/app/views/registrar/contacts/edit.haml
@@ -0,0 +1,5 @@
+= render 'registrar/shared/title', name: "#{t(:edit)}: #{@contact.name}"
+
+= form_for(@contact, url: registrar_contact_path(@contact),
+ html: {class: 'form-horizontal js-contact-form'}) do |f|
+ - render 'form', f: f
diff --git a/app/views/depp/contacts/form_partials/_address.haml b/app/views/registrar/contacts/form_partials/_address.haml
similarity index 100%
rename from app/views/depp/contacts/form_partials/_address.haml
rename to app/views/registrar/contacts/form_partials/_address.haml
diff --git a/app/views/depp/contacts/form_partials/_code.haml b/app/views/registrar/contacts/form_partials/_code.haml
similarity index 100%
rename from app/views/depp/contacts/form_partials/_code.haml
rename to app/views/registrar/contacts/form_partials/_code.haml
diff --git a/app/views/depp/contacts/form_partials/_disclose.haml b/app/views/registrar/contacts/form_partials/_disclose.haml
similarity index 100%
rename from app/views/depp/contacts/form_partials/_disclose.haml
rename to app/views/registrar/contacts/form_partials/_disclose.haml
diff --git a/app/views/depp/contacts/form_partials/_general.haml b/app/views/registrar/contacts/form_partials/_general.haml
similarity index 100%
rename from app/views/depp/contacts/form_partials/_general.haml
rename to app/views/registrar/contacts/form_partials/_general.haml
diff --git a/app/views/depp/contacts/form_partials/_legal_document.haml b/app/views/registrar/contacts/form_partials/_legal_document.haml
similarity index 100%
rename from app/views/depp/contacts/form_partials/_legal_document.haml
rename to app/views/registrar/contacts/form_partials/_legal_document.haml
diff --git a/app/views/depp/contacts/index.haml b/app/views/registrar/contacts/index.haml
similarity index 56%
rename from app/views/depp/contacts/index.haml
rename to app/views/registrar/contacts/index.haml
index bc0410b58..01498026d 100644
--- a/app/views/depp/contacts/index.haml
+++ b/app/views/registrar/contacts/index.haml
@@ -1,6 +1,6 @@
- content_for :actions do
- = link_to(t(:new), new_contact_path, class: 'btn btn-primary')
-= render 'depp/shared/title', name: t(:contacts)
+ = link_to(t(:new), new_registrar_contact_path, class: 'btn btn-primary')
+= render 'registrar/shared/title', name: t(:contacts)
- if @response
.panel.panel-default
@@ -15,11 +15,11 @@
%tbody
- @contacts.each do |c|
%tr
- %td= link_to(c[:name], contact_path(id: c[:code]))
+ %td= link_to(c[:name], registrar_contact_path(id: c[:code]))
%td= c[:code]
%td= c[:ident]
%td
- = link_to(t(:edit), edit_contact_path(c[:code]), class: 'btn btn-primary btn-xs')
- = link_to(t(:delete), delete_contact_path(c[:code]), class: 'btn btn-default btn-xs')
+ = 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')
= paginate @paginatable_array
diff --git a/app/views/depp/contacts/info_index.haml b/app/views/registrar/contacts/info_index.haml
similarity index 81%
rename from app/views/depp/contacts/info_index.haml
rename to app/views/registrar/contacts/info_index.haml
index a4f02ce1c..eb8e6b56f 100644
--- a/app/views/depp/contacts/info_index.haml
+++ b/app/views/registrar/contacts/info_index.haml
@@ -1,8 +1,8 @@
-= render 'depp/shared/title', name: t(:contacts_info)
+= render 'registrar/shared/title', name: t(:contacts_info)
.row
.col-md-12
- = form_tag contact_path, class: 'form-horizontal', method: :get do
+ = form_tag registrar_contact_path, class: 'form-horizontal', method: :get do
.form-group
= label_tag :contact_id, t('contact_id'), class: 'col-md-2 control-label'
.col-md-10
diff --git a/app/views/registrar/contacts/new.haml b/app/views/registrar/contacts/new.haml
new file mode 100644
index 000000000..c8d68083e
--- /dev/null
+++ b/app/views/registrar/contacts/new.haml
@@ -0,0 +1,5 @@
+= render 'registrar/shared/title', name: t(:new_contact)
+
+= form_for(@contact, url: registrar_contacts_path,
+ html: {class: 'form-horizontal js-contact-form'}) do |f|
+ - render 'form', f: f
diff --git a/app/views/depp/contacts/partials/_address.haml b/app/views/registrar/contacts/partials/_address.haml
similarity index 100%
rename from app/views/depp/contacts/partials/_address.haml
rename to app/views/registrar/contacts/partials/_address.haml
diff --git a/app/views/depp/contacts/partials/_disclose.haml b/app/views/registrar/contacts/partials/_disclose.haml
similarity index 100%
rename from app/views/depp/contacts/partials/_disclose.haml
rename to app/views/registrar/contacts/partials/_disclose.haml
diff --git a/app/views/depp/contacts/partials/_general.haml b/app/views/registrar/contacts/partials/_general.haml
similarity index 100%
rename from app/views/depp/contacts/partials/_general.haml
rename to app/views/registrar/contacts/partials/_general.haml
diff --git a/app/views/depp/contacts/partials/_statuses.haml b/app/views/registrar/contacts/partials/_statuses.haml
similarity index 100%
rename from app/views/depp/contacts/partials/_statuses.haml
rename to app/views/registrar/contacts/partials/_statuses.haml
diff --git a/app/views/registrar/contacts/show.haml b/app/views/registrar/contacts/show.haml
new file mode 100644
index 000000000..165545704
--- /dev/null
+++ b/app/views/registrar/contacts/show.haml
@@ -0,0 +1,16 @@
+- if @contact.id.present?
+ - content_for :actions do
+ = link_to(t(:edit), edit_registrar_contact_path(@contact.id), class: 'btn btn-primary')
+ = link_to(t(:delete), delete_registrar_contact_path(@contact.id), class: 'btn btn-default')
+ = render 'registrar/shared/title', name: truncate(@contact.name)
+
+ .row
+ .col-md-6= render 'registrar/contacts/partials/general'
+ .col-md-6= render 'registrar/contacts/partials/address'
+ .row
+ .col-md-12= render 'registrar/contacts/partials/statuses', statuses: @contact.statuses
+
+- else
+ .row
+ .col-sm-6
+ %h1= t(:not_found)
diff --git a/app/views/depp/domains/_check_form.haml b/app/views/registrar/domains/_check_form.haml
similarity index 79%
rename from app/views/depp/domains/_check_form.haml
rename to app/views/registrar/domains/_check_form.haml
index ca4295e1c..90242a7c0 100644
--- a/app/views/depp/domains/_check_form.haml
+++ b/app/views/registrar/domains/_check_form.haml
@@ -1,4 +1,4 @@
-= form_tag check_domains_path, class: 'form-horizontal', method: :get do
+= form_tag check_registrar_domains_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'
diff --git a/app/views/depp/domains/_form.haml b/app/views/registrar/domains/_form.haml
similarity index 73%
rename from app/views/depp/domains/_form.haml
rename to app/views/registrar/domains/_form.haml
index 37da7efce..fcd944e62 100644
--- a/app/views/depp/domains/_form.haml
+++ b/app/views/registrar/domains/_form.haml
@@ -1,4 +1,4 @@
-- path = (params[:domain_name]) ? update_domains_path : domains_path
+- path = (params[:domain_name]) ? update_registrar_domains_path : registrar_domains_path
= form_tag(path, class: 'form-horizontal', multipart: true) do
.row
.col-md-12
@@ -12,15 +12,15 @@
/ Tab panes
.tab-content
#general-tab.tab-pane.active
- = render 'depp/domains/form_partials/general'
- = render 'depp/domains/form_partials/contacts'
+ = render 'registrar/domains/form_partials/general'
+ = render 'registrar/domains/form_partials/contacts'
%hr
- = render 'depp/domains/form_partials/nameservers'
+ = render 'registrar/domains/form_partials/nameservers'
%hr
- = render 'depp/domains/form_partials/dnskeys'
+ = render 'registrar/domains/form_partials/dnskeys'
- if params['domain_name']
#statuses-tab.tab-pane
- = render 'depp/domains/form_partials/statuses'
+ = render 'registrar/domains/form_partials/statuses'
.panel.panel-default
.panel-heading.clearfix
diff --git a/app/views/depp/domains/check.haml b/app/views/registrar/domains/check.haml
similarity index 89%
rename from app/views/depp/domains/check.haml
rename to app/views/registrar/domains/check.haml
index 6a3136b27..d33c98131 100644
--- a/app/views/depp/domains/check.haml
+++ b/app/views/registrar/domains/check.haml
@@ -1,4 +1,4 @@
-= render 'depp/shared/title', name: t(:check_domain)
+= render 'registrar/shared/title', name: t(:check_domain)
.row
.col-md-12
diff --git a/app/views/registrar/domains/check_index.haml b/app/views/registrar/domains/check_index.haml
new file mode 100644
index 000000000..6ba416c6d
--- /dev/null
+++ b/app/views/registrar/domains/check_index.haml
@@ -0,0 +1,5 @@
+= render 'registrar/shared/title', name: t(:check_domain)
+
+.row
+ .col-md-12
+ = render 'check_form'
diff --git a/app/views/depp/domains/delete.haml b/app/views/registrar/domains/delete.haml
similarity index 70%
rename from app/views/depp/domains/delete.haml
rename to app/views/registrar/domains/delete.haml
index 3bf650930..8a2a04c32 100644
--- a/app/views/depp/domains/delete.haml
+++ b/app/views/registrar/domains/delete.haml
@@ -1,6 +1,6 @@
-= render 'depp/shared/title', name: "#{t(:delete)}: #{params[:domain_name]}"
+= render 'registrar/shared/title', name: "#{t(:delete)}: #{params[:domain_name]}"
-= form_tag(destroy_domains_path, class: 'form-horizontal', multipart: true, method: :delete) do
+= form_tag(destroy_registrar_domains_path, class: 'form-horizontal', multipart: true, method: :delete) do
.panel.panel-default
.panel-heading.clearfix
= t(:legal_document)
diff --git a/app/views/registrar/domains/edit.haml b/app/views/registrar/domains/edit.haml
new file mode 100644
index 000000000..71662a8dd
--- /dev/null
+++ b/app/views/registrar/domains/edit.haml
@@ -0,0 +1,4 @@
+= render 'registrar/shared/title', name: "#{t(:edit)}: #{params[:domain_name]}"
+
+%hr
+= render 'form'
diff --git a/app/views/depp/domains/form_partials/_contacts.haml b/app/views/registrar/domains/form_partials/_contacts.haml
similarity index 100%
rename from app/views/depp/domains/form_partials/_contacts.haml
rename to app/views/registrar/domains/form_partials/_contacts.haml
diff --git a/app/views/depp/domains/form_partials/_dnskeys.haml b/app/views/registrar/domains/form_partials/_dnskeys.haml
similarity index 100%
rename from app/views/depp/domains/form_partials/_dnskeys.haml
rename to app/views/registrar/domains/form_partials/_dnskeys.haml
diff --git a/app/views/depp/domains/form_partials/_general.haml b/app/views/registrar/domains/form_partials/_general.haml
similarity index 100%
rename from app/views/depp/domains/form_partials/_general.haml
rename to app/views/registrar/domains/form_partials/_general.haml
diff --git a/app/views/depp/domains/form_partials/_nameservers.haml b/app/views/registrar/domains/form_partials/_nameservers.haml
similarity index 100%
rename from app/views/depp/domains/form_partials/_nameservers.haml
rename to app/views/registrar/domains/form_partials/_nameservers.haml
diff --git a/app/views/depp/domains/form_partials/_statuses.haml b/app/views/registrar/domains/form_partials/_statuses.haml
similarity index 100%
rename from app/views/depp/domains/form_partials/_statuses.haml
rename to app/views/registrar/domains/form_partials/_statuses.haml
diff --git a/app/views/depp/domains/index.haml b/app/views/registrar/domains/index.haml
similarity index 55%
rename from app/views/depp/domains/index.haml
rename to app/views/registrar/domains/index.haml
index de4d2bb54..85648751e 100644
--- a/app/views/depp/domains/index.haml
+++ b/app/views/registrar/domains/index.haml
@@ -1,12 +1,12 @@
- content_for :actions do
- = link_to(t(:new), new_domain_path, class: 'btn btn-primary')
- = link_to(t(:transfer), transfer_domains_path, class: 'btn btn-default')
- = link_to(t(:keyrelay), keyrelay_path, class: 'btn btn-default')
-= render 'depp/shared/title', name: t(:domains)
+ = link_to(t(:new), new_registrar_domain_path, class: 'btn btn-primary')
+ = link_to(t(:transfer), transfer_registrar_domains_path, class: 'btn btn-default')
+ = link_to(t(:keyrelay), registrar_keyrelay_path, class: 'btn btn-default')
+= render 'registrar/shared/title', name: t(:domains)
.row
.col-md-12{style: 'margin-bottom: -15px;'}
- = form_tag info_domains_path, class: 'form-horizontal', method: :get do
+ = form_tag info_registrar_domains_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
@@ -31,17 +31,17 @@
%tbody
- @response['domains'].each do |x|
%tr
- %td= link_to(x['name'], info_domains_path(domain_name: x['name']))
+ %td= link_to(x['name'], info_registrar_domains_path(domain_name: x['name']))
%td
- = Time.parse(x['valid_from']).try(:to_date)
+ = Time.zone.parse(x['valid_from']).try(:to_date)
\-
- = Time.parse(x['valid_to']).try(:to_date)
+ = Time.zone.parse(x['valid_to']).try(:to_date)
%td
- = link_to(t(:edit), edit_domains_path(domain_name: x['name']),
+ = link_to(t(:edit), edit_registrar_domains_path(domain_name: x['name']),
class: 'btn btn-primary btn-xs')
- = link_to(t(:renew), renew_domains_path(domain_name: x['name']),
+ = link_to(t(:renew), renew_registrar_domains_path(domain_name: x['name']),
class: 'btn btn-default btn-xs')
- = link_to(t(:delete), delete_domains_path(domain_name: x['name']),
+ = link_to(t(:delete), delete_registrar_domains_path(domain_name: x['name']),
class: 'btn btn-default btn-xs')
= paginate @paginatable_array
diff --git a/app/views/registrar/domains/info.haml b/app/views/registrar/domains/info.haml
new file mode 100644
index 000000000..2f3f02d13
--- /dev/null
+++ b/app/views/registrar/domains/info.haml
@@ -0,0 +1,26 @@
+- content_for :actions do
+ = link_to(t(:edit), edit_registrar_domains_path(domain_name: params[:domain_name]),
+ class: 'btn btn-primary')
+ = link_to(t(:renew), renew_registrar_domains_path(domain_name: params[:domain_name]),
+ class: 'btn btn-default')
+ = link_to(t(:delete), delete_registrar_domains_path(domain_name: params[:domain_name]),
+ class: 'btn btn-default')
+= render 'registrar/shared/title', name: truncate(@data.css('name').text)
+
+.row
+ .col-sm-12
+ - if @data.css('result').first['code'] == '1000'
+ .row
+ .col-md-12= render 'registrar/domains/partials/general'
+ .row
+ .col-md-12= render 'registrar/domains/partials/contacts'
+ .row
+ .col-md-12= render 'registrar/domains/partials/statuses'
+ .row
+ .col-md-12= render 'registrar/domains/partials/nameservers'
+ .row
+ .col-md-12= render 'registrar/domains/partials/dnskeys'
+ - else
+ .row
+ .col-sm-6
+ %h1= t(:not_found)
diff --git a/app/views/registrar/domains/new.haml b/app/views/registrar/domains/new.haml
new file mode 100644
index 000000000..7a851d26c
--- /dev/null
+++ b/app/views/registrar/domains/new.haml
@@ -0,0 +1,3 @@
+= render 'registrar/shared/title', name: t(:new_domain)
+
+= render 'form'
diff --git a/app/views/depp/domains/partials/_contacts.haml b/app/views/registrar/domains/partials/_contacts.haml
similarity index 100%
rename from app/views/depp/domains/partials/_contacts.haml
rename to app/views/registrar/domains/partials/_contacts.haml
diff --git a/app/views/depp/domains/partials/_dnskeys.haml b/app/views/registrar/domains/partials/_dnskeys.haml
similarity index 100%
rename from app/views/depp/domains/partials/_dnskeys.haml
rename to app/views/registrar/domains/partials/_dnskeys.haml
diff --git a/app/views/depp/domains/partials/_general.haml b/app/views/registrar/domains/partials/_general.haml
similarity index 100%
rename from app/views/depp/domains/partials/_general.haml
rename to app/views/registrar/domains/partials/_general.haml
diff --git a/app/views/depp/domains/partials/_nameservers.haml b/app/views/registrar/domains/partials/_nameservers.haml
similarity index 100%
rename from app/views/depp/domains/partials/_nameservers.haml
rename to app/views/registrar/domains/partials/_nameservers.haml
diff --git a/app/views/depp/domains/partials/_statuses.haml b/app/views/registrar/domains/partials/_statuses.haml
similarity index 100%
rename from app/views/depp/domains/partials/_statuses.haml
rename to app/views/registrar/domains/partials/_statuses.haml
diff --git a/app/views/depp/domains/renew.haml b/app/views/registrar/domains/renew.haml
similarity index 83%
rename from app/views/depp/domains/renew.haml
rename to app/views/registrar/domains/renew.haml
index 981b95327..eded972c9 100644
--- a/app/views/depp/domains/renew.haml
+++ b/app/views/registrar/domains/renew.haml
@@ -1,4 +1,4 @@
-= render 'depp/shared/title', name: t(:renew_domain)
+= render 'registrar/shared/title', name: t(:renew_domain)
.row
.col-md-12
diff --git a/app/views/depp/domains/renew_index.haml b/app/views/registrar/domains/renew_index.haml
similarity index 86%
rename from app/views/depp/domains/renew_index.haml
rename to app/views/registrar/domains/renew_index.haml
index 18d7f7011..ef5a72b99 100644
--- a/app/views/depp/domains/renew_index.haml
+++ b/app/views/registrar/domains/renew_index.haml
@@ -1,8 +1,8 @@
-= render 'depp/shared/title', name: t(:renew_domain)
+= render 'registrar/shared/title', name: t(:renew_domain)
.row
.col-md-12
- = form_tag renew_domains_path, class: 'form-horizontal', method: :get do
+ = form_tag renew_registrar_domains_path, class: 'form-horizontal', method: :get do
.form-group
= label_tag :domain_name, t('name'), class: 'col-md-2 control-label'
.col-md-10
diff --git a/app/views/depp/domains/transfer.haml b/app/views/registrar/domains/transfer.haml
similarity index 85%
rename from app/views/depp/domains/transfer.haml
rename to app/views/registrar/domains/transfer.haml
index 46801d7c4..eb9b23799 100644
--- a/app/views/depp/domains/transfer.haml
+++ b/app/views/registrar/domains/transfer.haml
@@ -1,4 +1,4 @@
-= render 'depp/shared/title', name: t(:transfer_domain)
+= render 'registrar/shared/title', name: t(:transfer_domain)
.row
.col-md-12
diff --git a/app/views/depp/domains/transfer_index.haml b/app/views/registrar/domains/transfer_index.haml
similarity index 84%
rename from app/views/depp/domains/transfer_index.haml
rename to app/views/registrar/domains/transfer_index.haml
index 0a9c72d2c..694c060ed 100644
--- a/app/views/depp/domains/transfer_index.haml
+++ b/app/views/registrar/domains/transfer_index.haml
@@ -1,8 +1,8 @@
-= render 'depp/shared/title', name: t(:transfer_domain)
+= render 'registrar/shared/title', name: t(:transfer_domain)
.row
.col-md-12
- = form_tag transfer_domains_path, class: 'form-horizontal', method: :post, multipart: true do
+ = form_tag transfer_registrar_domains_path, class: 'form-horizontal', method: :post, multipart: true do
.form-group
= label_tag :domain_name, t('name'), class: 'col-md-2 control-label'
.col-md-10
diff --git a/app/views/depp/keyrelays/show.haml b/app/views/registrar/keyrelays/show.haml
similarity index 95%
rename from app/views/depp/keyrelays/show.haml
rename to app/views/registrar/keyrelays/show.haml
index 4020ded41..d78731722 100644
--- a/app/views/depp/keyrelays/show.haml
+++ b/app/views/registrar/keyrelays/show.haml
@@ -4,7 +4,7 @@
%hr
.row
.col-md-12
- = form_tag keyrelay_path, class: 'form-horizontal', method: :post, multipart: true do
+ = form_tag registrar_keyrelay_path, class: 'form-horizontal', method: :post, multipart: true do
.form-group
= label_tag :domain_name, t('domain_name'), class: 'col-md-2 control-label'
.col-md-10
diff --git a/app/views/depp/polls/show.haml b/app/views/registrar/polls/show.haml
similarity index 90%
rename from app/views/depp/polls/show.haml
rename to app/views/registrar/polls/show.haml
index 38e685c42..ef39517d8 100644
--- a/app/views/depp/polls/show.haml
+++ b/app/views/registrar/polls/show.haml
@@ -15,7 +15,7 @@
- if @data.css('trnData trStatus').any? # this is a transfer request
- unless ['serverApproved', 'clientApproved'].include?(@data.css('trStatus').first.text)
= link_to(t('confirm'), 'javascript: void(0);', class: 'btn btn-primary btn-xs js-transfer-confirm')
- = link_to(t('dequeue'), poll_path(id: msg_q['id']), method: :delete, class: 'btn btn-primary btn-xs')
+ = link_to(t('dequeue'), registrar_poll_path(id: msg_q['id']), method: :delete, class: 'btn btn-primary btn-xs')
.panel-body
%dl.dl-horizontal
%dt= t('message')
@@ -56,7 +56,7 @@
%dt= t('public_key')
%dd= @data.css('pubKey').text
- = form_tag confirm_keyrelay_poll_path, class: 'js-keyrelay-form' do
+ = form_tag registrar_confirm_keyrelay_poll_path, class: 'js-keyrelay-form' do
= hidden_field_tag 'domain[name]', @data.css('name').text
= hidden_field_tag 'domain[dnskeys_attributes][0][flags]', @data.css('flags').text
= hidden_field_tag 'domain[dnskeys_attributes][0][protocol]', @data.css('protocol').text
@@ -65,7 +65,7 @@
- else
- if @data.css('trnData trStatus').any? # this is a transfer request
- = form_tag confirm_transfer_poll_path, class: 'js-transfer-form' do
+ = form_tag registrar_confirm_transfer_poll_path, class: 'js-transfer-form' do
= hidden_field_tag 'domain[name]', @data.css('name').text
- @data.css('trnData').children.each do |x|
diff --git a/app/views/depp/shared/_epp_results.haml b/app/views/registrar/shared/_epp_results.haml
similarity index 100%
rename from app/views/depp/shared/_epp_results.haml
rename to app/views/registrar/shared/_epp_results.haml
diff --git a/app/views/depp/shared/_error_messages.haml b/app/views/registrar/shared/_error_messages.haml
similarity index 100%
rename from app/views/depp/shared/_error_messages.haml
rename to app/views/registrar/shared/_error_messages.haml
diff --git a/app/views/depp/shared/_errors.haml b/app/views/registrar/shared/_errors.haml
similarity index 100%
rename from app/views/depp/shared/_errors.haml
rename to app/views/registrar/shared/_errors.haml
diff --git a/app/views/depp/shared/_flash.haml b/app/views/registrar/shared/_flash.haml
similarity index 100%
rename from app/views/depp/shared/_flash.haml
rename to app/views/registrar/shared/_flash.haml
diff --git a/app/views/depp/shared/_flash_messages.haml b/app/views/registrar/shared/_flash_messages.haml
similarity index 100%
rename from app/views/depp/shared/_flash_messages.haml
rename to app/views/registrar/shared/_flash_messages.haml
diff --git a/app/views/depp/shared/_nav.haml b/app/views/registrar/shared/_nav.haml
similarity index 61%
rename from app/views/depp/shared/_nav.haml
rename to app/views/registrar/shared/_nav.haml
index ff17197f4..d85a17de3 100644
--- a/app/views/depp/shared/_nav.haml
+++ b/app/views/registrar/shared/_nav.haml
@@ -2,12 +2,12 @@
.container.subnav
%ul.nav.nav-tabs.navbar-right
%li{role: :presentation, class: active == :domains ? 'active' : ''}
- = link_to t(:all), domains_path
+ = link_to t(:all), registrar_domains_path
%li{role: :presentation, class: active == :new ? 'active' : ''}
- = link_to t(:new), new_domain_path
+ = link_to t(:new), new_registrar_domain_path
%li{role: :presentation, class: active == :check ? 'active' : ''}
- = link_to t(:check), check_domains_path
+ = link_to t(:check), check_registrar_domains_path
%li{role: :presentation, class: active == :transfer ? 'active' : ''}
- = link_to t(:transfer), transfer_domains_path
+ = link_to t(:transfer), transfer_registrar_domains_path
%li{role: :presentation, class: active == :keyrelay ? 'active' : ''}
- = link_to t(:keyrelay), keyrelay_path
+ = link_to t(:keyrelay), registrar_keyrelay_path
diff --git a/app/views/depp/shared/_title.haml b/app/views/registrar/shared/_title.haml
similarity index 100%
rename from app/views/depp/shared/_title.haml
rename to app/views/registrar/shared/_title.haml
diff --git a/app/views/depp/xml_consoles/epp_requests/contact/check.xml b/app/views/registrar/xml_consoles/epp_requests/contact/check.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/contact/check.xml
rename to app/views/registrar/xml_consoles/epp_requests/contact/check.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/contact/check_multiple.xml b/app/views/registrar/xml_consoles/epp_requests/contact/check_multiple.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/contact/check_multiple.xml
rename to app/views/registrar/xml_consoles/epp_requests/contact/check_multiple.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/contact/create.xml b/app/views/registrar/xml_consoles/epp_requests/contact/create.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/contact/create.xml
rename to app/views/registrar/xml_consoles/epp_requests/contact/create.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/contact/delete.xml b/app/views/registrar/xml_consoles/epp_requests/contact/delete.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/contact/delete.xml
rename to app/views/registrar/xml_consoles/epp_requests/contact/delete.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/contact/info.xml b/app/views/registrar/xml_consoles/epp_requests/contact/info.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/contact/info.xml
rename to app/views/registrar/xml_consoles/epp_requests/contact/info.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/contact/update_chg.xml b/app/views/registrar/xml_consoles/epp_requests/contact/update_chg.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/contact/update_chg.xml
rename to app/views/registrar/xml_consoles/epp_requests/contact/update_chg.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/domain/check.xml b/app/views/registrar/xml_consoles/epp_requests/domain/check.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/domain/check.xml
rename to app/views/registrar/xml_consoles/epp_requests/domain/check.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/domain/create.xml b/app/views/registrar/xml_consoles/epp_requests/domain/create.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/domain/create.xml
rename to app/views/registrar/xml_consoles/epp_requests/domain/create.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/domain/delete.xml b/app/views/registrar/xml_consoles/epp_requests/domain/delete.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/domain/delete.xml
rename to app/views/registrar/xml_consoles/epp_requests/domain/delete.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/domain/info.xml b/app/views/registrar/xml_consoles/epp_requests/domain/info.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/domain/info.xml
rename to app/views/registrar/xml_consoles/epp_requests/domain/info.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/domain/renew.xml b/app/views/registrar/xml_consoles/epp_requests/domain/renew.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/domain/renew.xml
rename to app/views/registrar/xml_consoles/epp_requests/domain/renew.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/domain/transfer.xml b/app/views/registrar/xml_consoles/epp_requests/domain/transfer.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/domain/transfer.xml
rename to app/views/registrar/xml_consoles/epp_requests/domain/transfer.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/domain/update.xml b/app/views/registrar/xml_consoles/epp_requests/domain/update.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/domain/update.xml
rename to app/views/registrar/xml_consoles/epp_requests/domain/update.xml
diff --git a/app/views/depp/xml_consoles/epp_requests/keyrelay/keyrelay.xml b/app/views/registrar/xml_consoles/epp_requests/keyrelay/keyrelay.xml
similarity index 100%
rename from app/views/depp/xml_consoles/epp_requests/keyrelay/keyrelay.xml
rename to app/views/registrar/xml_consoles/epp_requests/keyrelay/keyrelay.xml
diff --git a/app/views/depp/xml_consoles/show.haml b/app/views/registrar/xml_consoles/show.haml
similarity index 97%
rename from app/views/depp/xml_consoles/show.haml
rename to app/views/registrar/xml_consoles/show.haml
index c08d8c972..bcb39d88a 100644
--- a/app/views/depp/xml_consoles/show.haml
+++ b/app/views/registrar/xml_consoles/show.haml
@@ -1,6 +1,6 @@
.row
.col-md-8
- = form_tag(xml_console_path) do
+ = form_tag(registrar_xml_console_path) do
.form-group
= text_area_tag(:payload, params[:payload], class: 'form-control', rows: 15, style: 'font-family:monospace; font-size: 11px;')
diff --git a/config/application.rb b/config/application.rb
index d853968b3..cce334dcc 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -32,9 +32,7 @@ module Registry
# Autoload all model subdirs
config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')]
-
- # Autoload depp gem
- config.autoload_paths += %W(#{config.root}/vendor/gems/depp/lib)
+ config.autoload_paths << Rails.root.join('lib')
# Add the fonts path
config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 6415ada3d..0f3e913f4 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -1,6 +1,10 @@
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
+ config.warden do |manager|
+ manager.failure_app = DeviseCustomFailure
+ end
+
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
@@ -258,3 +262,4 @@ Devise.setup do |config|
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
end
+
diff --git a/config/routes.rb b/config/routes.rb
index 8ea55674a..75e6a57a6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -15,7 +15,11 @@ Rails.application.routes.draw do
get 'error/:command', to: 'errors#error'
end
+ mount Repp::API => '/'
+
namespace :registrar do
+ root 'polls#show'
+
resources :invoices
devise_scope :user do
@@ -29,12 +33,6 @@ Rails.application.routes.draw do
get 'logout' => '/devise/sessions#destroy'
end
- # authenticated :user do
- # root to: 'domains#index', as: :authenticated_root
- # end
-
- root to: redirect('/registrar/depp')
-
resources :domains do
collection do
post 'update', as: 'update'
@@ -72,11 +70,9 @@ Rails.application.routes.draw do
get 'load_xml'
end
end
-
- root 'polls#show'
end
- ## ADMIN ROUTES
+ # ## ADMIN ROUTES
namespace :admin do
resources :keyrelays
@@ -143,5 +139,5 @@ Rails.application.routes.draw do
get 'login' => 'admin/sessions#login'
end
- root to: redirect('login')
+ root to: redirect('admin/login')
end
diff --git a/depp b/depp
deleted file mode 120000
index 591ef99cd..000000000
--- a/depp
+++ /dev/null
@@ -1 +0,0 @@
-vendor/gems/depp
\ No newline at end of file
diff --git a/lib/devise_custom_failure.rb b/lib/devise_custom_failure.rb
new file mode 100644
index 000000000..3af67b01d
--- /dev/null
+++ b/lib/devise_custom_failure.rb
@@ -0,0 +1,16 @@
+class DeviseCustomFailure < Devise::FailureApp
+ def redirect_url
+ return registrar_login_url if request.original_fullpath.to_s.match(/^\/registrar/)
+ return admin_login_url if request.original_fullpath.to_s.match(/^\/admin/)
+ root_url
+ end
+
+ # You need to override respond to eliminate recall
+ def respond
+ if http_auth?
+ http_auth
+ else
+ redirect
+ end
+ end
+end
diff --git a/spec/features/registrar/root_spec.rb b/spec/features/registrar/root_spec.rb
new file mode 100644
index 000000000..2a33d57f6
--- /dev/null
+++ b/spec/features/registrar/root_spec.rb
@@ -0,0 +1,23 @@
+require 'rails_helper'
+
+feature 'Root', type: :feature do
+ before :all do
+ create_settings
+ Fabricate(:api_user)
+ end
+
+ fit 'should redirect to registrar login page' do
+ visit '/registrar/login'
+ current_path.should == '/registrar/login'
+ end
+
+ fit 'should redirect to registrar login page' do
+ visit '/registrar'
+ current_path.should == '/registrar/login'
+ end
+
+ fit 'should redirect to registrar login page' do
+ visit '/registrar/'
+ current_path.should == '/registrar/login'
+ end
+end