Remove /client

This commit is contained in:
Martin Lensment 2014-11-10 11:44:34 +02:00
parent cf11f1aaf8
commit 5754bbe297
42 changed files with 6 additions and 1155 deletions

View file

@ -9,13 +9,8 @@ class ApplicationController < ActionController::Base
params[resource] &&= send(method) if respond_to?(method, true)
end
def after_sign_in_path_for(resource)
def after_sign_in_path_for(_resource)
return session[:user_return_to].to_s if session[:user_return_to]
if resource.admin? && can?(:create, :admin_session)
admin_root_path
else
client_root_path
end
admin_root_path
end
end

View file

@ -1,19 +0,0 @@
class Client::ContactVersionsController < ClientController
before_action :set_version, only: [:show]
def index
@versions = ContactVersion.registrar_events(current_registrar.id)
@versions.flatten!
end
def show
@event = params[:event]
@contact = @version.reify(has_one: true) unless @event == 'create'
end
private
def set_version
@version = ContactVersion.find(params[:id])
end
end

View file

@ -1,71 +0,0 @@
class Client::ContactsController < ClientController
before_action :set_contact, only: [:show, :destroy, :edit, :update]
def index
@q = Contact.current_registrars(current_registrar.id).search(params[:q])
@contacts = @q.result.page(params[:page])
end
def new
@contact = Contact.new
@contact.build_address
end
def show
# rubocop: disable Style/GuardClause
if @contact.registrar != current_registrar
flash[:alert] = I18n.t('shared.authentication_error')
redirect_to client_contacts_path
end
# rubocop: enable Style/GuardClause
end
def create
@contact = Contact.new(contact_params)
@contact.generate_code
@contact.registrar = current_registrar
if @contact.save
flash[:notice] = I18n.t('shared.contact_added')
redirect_to [:client, @contact]
else
flash[:alert] = I18n.t('shared.failed_to_create_contact')
render 'new'
end
end
def destroy
if @contact.destroy_and_clean
flash[:notice] = I18n.t('shared.contact_deleted')
redirect_to client_contacts_path
else
flash[:alert] = I18n.t('shared.failed_to_delete_contact')
redirect_to [:client, @contact]
end
end
def update
if @contact.update_attributes(contact_params)
flash[:notice] = I18n.t('shared.contact_updated')
redirect_to [:client, @contact]
else
flash[:alert] = I18n.t('shared.failed_to_update_contact')
redirect_to [:client, @contact]
end
end
# TODO: Add Registrar to Contacts and search only contacts that belong to this domain
def search
render json: Contact.search_by_query(params[:q])
end
private
def set_contact
@contact = Contact.find(params[:id])
end
def contact_params
params.require(:contact).permit(:email, :phone, :fax, :ident_type, :ident, :auth_info, :name, :org_name,
address_attributes: [:city, :street, :zip, :street2, :street3, :country_id])
end
end

View file

@ -1,92 +0,0 @@
class Client::DomainTransfersController < ClientController
before_action :set_domain_transfer, only: [:show, :approve]
before_action :set_domain, only: [:create]
def index
@q = current_registrar.domain_transfers.search(params[:q])
@q.sorts = 'created_at desc' if @q.sorts.empty?
@domain_transfers = @q.result.page(params[:page])
end
def new
@domain_transfer = DomainTransfer.new
end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def create
@domain_transfer = @domain.pending_transfer
if @domain_transfer
if can? :read, @domain_transfer
flash[:notice] = I18n.t('shared.domain_transfer_requested') if @domain.registrar != current_registrar
redirect_to [:client, @domain_transfer] and return
else
flash.now[:alert] = I18n.t('shared.other_registrar_has_already_requested_to_transfer_this_domain')
render 'new' and return
end
end
@domain_transfer = @domain.domain_transfers.create(domain_transfer_params)
@domain_transfer.approve_as_server if Setting.transfer_wait_time == 0
if @domain_transfer.approved?
flash[:notice] = I18n.t('shared.domain_transfer_approved')
redirect_to [:client, @domain_transfer]
else
flash[:notice] = I18n.t('shared.domain_transfer_requested')
redirect_to [:client, @domain_transfer]
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def approve
if can? :approve_as_client, @domain_transfer
@domain_transfer.approve_as_client
flash[:notice] = I18n.t('shared.domain_transfer_approved')
else
flash[:alert] = I18n.t('shared.failed_to_approve_domain_transfer')
end
redirect_to [:client, @domain_transfer]
end
private
def set_domain_transfer
@domain_transfer = DomainTransfer.find(params[:id])
end
def domain_transfer_params
{
status: DomainTransfer::PENDING,
transfer_requested_at: Time.zone.now,
transfer_to: current_registrar,
transfer_from: @domain.registrar
}
end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def set_domain
@domain_transfer = DomainTransfer.new
@domain = Domain.find_by(name: params[:domain_name])
if @domain
if @domain.auth_info != params[:domain_pw]
flash.now[:alert] = I18n.t('shared.password_invalid')
render 'new' and return
end
if @domain.registrar == current_registrar && !@domain.pending_transfer
flash.now[:alert] = I18n.t('shared.domain_already_belongs_to_the_querying_registrar')
render 'new' and return
end
else
flash.now[:alert] = I18n.t('shared.domain_was_not_found')
render 'new'
end
end
# rubocop: enbale Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
end

View file

@ -1,19 +0,0 @@
class Client::DomainVersionsController < ClientController
helper WhodunnitHelper
before_action :set_domain, only: [:show]
def index
@versions = DomainVersion.registrar_events(current_registrar.id)
@versions.flatten!
end
def show
@versions = @domain.versions.reverse
end
private
def set_domain
@domain = Domain.find(params[:id])
end
end

View file

@ -1,105 +0,0 @@
class Client::DomainsController < ClientController
load_and_authorize_resource
before_action :set_domain, only: [:show, :edit, :update, :destroy]
before_action :verify_deletion, only: [:destroy]
def index
@q = current_registrar.domains.includes(:owner_contact).search(params[:q])
@domains = @q.result.page(params[:page])
end
def new
owner_contact = Contact.find(params[:owner_contact_id]) if params[:owner_contact_id]
@domain = Domain.new(owner_contact: owner_contact, registrar: current_registrar)
params[:domain_owner_contact] = owner_contact
build_associations
end
def create
add_prefix_to_statuses
@domain = Domain.new(domain_params)
@domain.registrar = current_registrar
if @domain.save
flash[:notice] = I18n.t('shared.domain_added')
redirect_to [:client, @domain]
else
build_associations
flash.now[:alert] = I18n.t('shared.failed_to_add_domain')
render 'new'
end
end
def show
@domain.all_dependencies_valid?
end
def edit
build_associations
end
def update
add_prefix_to_statuses
if @domain.update(domain_params)
flash[:notice] = I18n.t('shared.domain_updated')
redirect_to [:client, @domain]
else
build_associations
flash.now[:alert] = I18n.t('shared.failed_to_update_domain')
render 'edit'
end
end
def destroy
if @domain.destroy
flash[:notice] = I18n.t('shared.domain_deleted')
redirect_to client_domains_path
else
flash[:alert] = I18n.t('shared.failed_to_delete_domain')
redirect_to [:client, @domain]
end
end
private
def domain_params
params.require(:domain).permit(
:name,
:period,
:period_unit,
:owner_contact_id,
:owner_contact_typeahead,
nameservers_attributes: [:id, :hostname, :ipv4, :ipv6, :_destroy],
domain_contacts_attributes: [:id, :contact_type, :contact_id, :value_typeahead, :_destroy],
domain_statuses_attributes: [:id, :value, :description, :_destroy],
dnskeys_attributes: [:id, :flags, :alg, :protocol, :public_key, :_destroy]
)
end
def add_prefix_to_statuses
domain_params[:domain_statuses_attributes].each do |_k, hash|
hash[:value] = hash[:value].prepend('client') if hash[:value].present?
end
end
def set_domain
@domain = Domain.find(params[:id])
end
def build_associations
@domain.nameservers.build if @domain.nameservers.empty?
@domain.dnskeys.build if @domain.dnskeys.empty?
@domain.domain_contacts.build if @domain.domain_contacts.empty?
@client_statuses = @domain.domain_statuses.select(&:client_status?)
@client_statuses << @domain.domain_statuses.build if @client_statuses.empty?
end
def verify_deletion
return if @domain.can_be_deleted?
flash[:alert] = I18n.t('shared.domain_status_prohibits_deleting')
redirect_to [:client, @domain]
end
end

View file

@ -4,8 +4,6 @@ class SessionsController < Devise::SessionsController
# this is just testing config
# if Rails.env.development? || Rails.env.test?
@user = User.find_by(username: 'gitlab') if params[:gitlab]
@user = User.find_by(username: 'zone') if params[:zone]
@user = User.find_by(username: 'elkdata') if params[:elkdata]
session[:current_user_registrar_id] = Registrar.first.id if @user.admin?

View file

@ -1,5 +1,2 @@
module ApplicationHelper
def coffee_script_tag(&block)
content_tag(:script, CoffeeScript.compile(capture(&block)).html_safe, type: 'text/javascript')
end
end

View file

@ -1,35 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.contacts')
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.create_new_contact'), new_client_contact_path, class: 'btn btn-primary')
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}
= t('shared.event')
%th{class: 'col-xs-2'}
= t('shared.whodunnit')
%th{class: 'col-xs-2'}
= t('shared.created_at')
%th{class: 'col-xs-1'}
= t('shared.contact')
%th{class: 'col-xs-1'}
= t('shared.details')
=# sort_link(@q, 'email', t('shared.email'))
%tbody
- @versions.each do |x|
%tr
%td= x.event
%td= whodunnit_with_protocol(x.whodunnit)
%td= l(x.created_at, format: :short)
%td= link_to(t('shared.contact'), client_contact_path(x.item_id))
%td= link_to(t('shared.details'), client_contact_version_path(x, event: x.event))
.row
.col-md-12
=# paginate @contacts

View file

@ -1,24 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.contacts')
%hr
.row
.col-sm-6
.panel.panel-default
.panel-heading
%h3.panel-title= t('shared.version')
.panel-body
%dl.dl-horizontal
%dt= t('shared.whodunnit')
%dd= @version.whodunnit
%dt= t('shared.event')
%dd= @version.event
%dt= t('shared.created_at')
%dd= l(@version.created_at, format: :short)
- if @event != 'create' && @contact.address
- # TODO fix address not being available with reify
= render 'admin/contacts/partials/address'
.col-sm-6= render 'admin/contacts/partials/general' unless @event == 'create'

View file

@ -1,52 +0,0 @@
= form_for([:client, @contact]) do |f|
- if @contact.errors.any?
- @contact.errors.each do |attr, err|
= err
%br
- if @contact.errors.any?
%hr
.row
.col-md-6.text-left
%h3
Contact
.form-group
= f.label :name
= f.text_field(:name, class: 'form-control')
= f.label :email
= f.text_field(:email, class: 'form-control')
= f.label :phone
= f.text_field(:phone, class: 'form-control')
= f.label :fax
= f.text_field(:fax, class: 'form-control')
= f.label :org_name
= f.text_field(:org_name, class: 'form-control')
= f.label :ident_type
= f.select :ident_type, options_for_select(Contact::IDENT_TYPES, @contact.ident_type), {}, {class: 'form-control'}
= f.label :ident
= f.text_field(:ident, class: 'form-control')
= f.label :auth_info
= f.text_field(:auth_info, class: 'form-control')
.col-md-6.text-left
%h3
Address
.form-group
= f.fields_for :address do |ia|
= ia.label :country_id, t(:country)
= ia.collection_select :country_id, Country.all, :id, :name,{}, { class: 'form-control' }
= ia.label :city
= ia.text_field(:city, class: 'form-control')
= ia.label :street
= ia.text_field(:street, class: 'form-control')
= ia.label :street2
= ia.text_field(:street2, class: 'form-control')
= ia.label :street3
= ia.text_field(:street2, class: 'form-control')
%hr
.row
.col-md-12.text-right
= button_tag(t('shared.save'), class: 'btn btn-primary')

View file

@ -1,9 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs
= "#{t('shared.edit_contact')}"
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.back_to_contact'), [:client, @contact], class: 'btn btn-default')
%hr
= render 'form'

View file

@ -1,44 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.contacts')
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.create_new_contact'), new_client_contact_path, class: 'btn btn-primary')
%hr
.row
.col-md-12
= search_form_for [:client, @q], html: { class: 'form-horizontal' } do |f|
.col-md-11
.form-group
= f.search_field :name_cont, class: 'form-control'
.col-md-1.text-right.text-center-xs
.form-group
%button.btn.btn-primary
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}
= sort_link(@q, 'name', t('shared.name'))
%th{class: 'col-xs-2'}
= sort_link(@q, 'code', t('shared.code'))
%th{class: 'col-xs-2'}
= sort_link(@q, 'ident', t('shared.identity_code'))
%th{class: 'col-xs-2'}
= sort_link(@q, 'email', t('shared.email'))
%tbody
- @contacts.each do |x|
%tr
%td= link_to(x, [:client, x])
%td= x.code
%td= x.ident
%td= x.email
.row
.col-md-12
= paginate @contacts

View file

@ -1,3 +0,0 @@
%h2= t('shared.new_contact')
%hr
= render 'form'

View file

@ -1,19 +0,0 @@
#contacts.panel.panel-default
.panel-heading.clearfix
.pull-left
= t('shared.domains')
.pull-right
= link_to(t('shared.create_new_domain'), new_client_domain_path(owner_contact_id: @contact), class: 'btn btn-primary btn-xs')
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t('shared.domain_name')
%th{class: 'col-xs-4'}= t('shared.registrar')
%th{class: 'col-xs-4'}= t('shared.valid_to')
%tbody
- @contact.domains_owned.each do |x|
%tr
%td= link_to(x.name, [:admin, x])
%td= link_to(x.registrar, [:admin, x.registrar])
%td= l(x.valid_to, format: :short)

View file

@ -1,19 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs
= "#{t('shared.contact_details')}"
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.edit'), edit_client_contact_path(@contact), class: 'btn btn-primary')
= link_to(t('shared.delete'), client_contact_path(@contact), method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-danger')
%hr
.row
.col-md-6= render 'admin/contacts/partials/general'
.col-md-6= render 'admin/contacts/partials/address'
.row
.col-md-12= render 'client/contacts/partials/domains'
- if @contact.versions.present?
= render 'client/shared/versions', versions: @contact.versions

View file

@ -1,39 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.domain_transfers')
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.request_domain_transfer'), new_client_domain_transfer_path, class: 'btn btn-primary')
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}
= sort_link(@q, 'domain_name')
%th{class: 'col-xs-2'}
= sort_link(@q, 'status')
%th{class: 'col-xs-2'}
= sort_link(@q, 'transfer_from', t('shared.transfer_from'))
%th{class: 'col-xs-2'}
= sort_link(@q, 'transfer_to', t('shared.transfer_to'))
%th{class: 'col-xs-2'}=t('shared.actions')
%tbody
- @domain_transfers.each do |x|
%tr
- if current_registrar == x.domain.registrar
%td= link_to(x.domain, client_domain_path(x.domain))
- else
%td= x.domain
%td= x.status
%td= x.transfer_from
%td= x.transfer_to
%td
= link_to(t('shared.details'), [:client, x], class: 'btn btn-xs btn-primary')
.row
.col-md-12
= paginate @domain_transfers

View file

@ -1,25 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.transfer_domain')
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.domain_transfers'), client_domain_transfers_path, class: 'btn btn-default')
%hr
= form_for([:client, @domain_transfer]) do |f|
= render 'shared/errors', object: @domain_transfer
- if @domain_transfer.errors.any?
%hr
.row
.col-md-6
.form-group
= label_tag :domain_name
= text_field_tag(:domain_name, params[:domain_name], class: 'form-control')
.row
.col-md-6
.form-group
= label_tag :domain_pw, t('shared.domain_pw')
= text_field_tag(:domain_pw, params[:domain_pw], class: 'form-control')
.row
.col-md-12.text-right
= button_tag(t('shared.request_domain_transfer'), class: 'btn btn-primary', name: 'request')

View file

@ -1,39 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs
= "#{t('shared.domain_transfer')}"
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.domain_transfers'), client_domain_transfers_path, class: 'btn btn-default')
- if can? :approve_as_client, @domain_transfer
= link_to(t('shared.approve'), approve_client_domain_transfer_path, method: :post, class: 'btn btn-success')
%hr
.row
.col-md-12
%dl.dl-horizontal
%dt= t('shared.domain')
- if current_registrar == @domain_transfer.domain.registrar
%dd= link_to(@domain_transfer.domain, client_domain_path(@domain_transfer.domain))
- else
%dd= @domain_transfer.domain
%dt= t('shared.status')
%dd= @domain_transfer.status
%dt= t('shared.transfer_requested_at')
%dd= l(@domain_transfer.transfer_requested_at)
%dt= t('shared.transfer_from')
%dd= @domain_transfer.transfer_from
%dt= t('shared.transfer_to')
%dd= @domain_transfer.transfer_to
%dt= t('shared.accept_time')
- if @domain_transfer.transferred_at
%dd= l(@domain_transfer.transferred_at)
- else
%dd= l(@domain_transfer.wait_until)
%dt= t('shared.domain_valid_to')
%dd= l(@domain_transfer.domain.valid_to)

View file

@ -1,36 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.domains')
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.create_new_contact'), new_client_domain_path, class: 'btn btn-primary')
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}
= t('shared.event')
%th{class: 'col-xs-2'}
= t('shared.whodunnit')
%th{class: 'col-xs-2'}
= t('shared.created_at')
-#%th{class: 'col-xs-1'}
= t('shared.item_id')
=# sort_link(@q, 'email', t('shared.email'))
%th{class: 'col-xs-1'}
= t('shared.details')
%tbody
- @versions.each do |x|
%tr
%td= x.event
%td= whodunnit_with_protocol(x.whodunnit)
%td= l(x.created_at, format: :short)
-#%td= link_to(t('shared.domain'), client_domain_path(x.item_id))
%td= link_to(t('shared.details'), client_domain_version_path(x, event: x.event))
.row
.col-md-12
=# paginate @contacts

View file

@ -1,64 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.domains')
%hr
.row
.col-md-12
.table-responsive
%table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-1'}= 'domain'
%th{class: 'col-xs-2'}= 'owner'
%th{class: 'col-xs-2'}= 'admins'
%th{class: 'col-xs-2'}= 'techs'
%th{class: 'col-xs-2'}= 'ns'
%th{class: 'col-xs-1'}= 'datetime'
%tbody
- @versions.each do |version|
- children = YAML.load(version.snapshot)
- next unless children.is_a?(Hash)
- children = HashWithIndifferentAccess.new(children)
%tr
%td
- if children[:domain]
= children[:domain][:name]
= children[:domain][:status]
%td
- if children[:owner_contact]
%p{:style => "font-size:x-small;"}
= children[:owner_contact][:name] + ","
= children[:owner_contact][:phone] + ","
= children[:owner_contact][:email] + ","
= children[:owner_contact][:code]
%td
- if children[:admin_contacts]
- children[:admin_contacts].each do |ac|
%p{:style => "font-size:x-small;"}
= ac[:name] + ","
= ac[:phone] + ","
= ac[:email] + ","
= ac[:code]
%td
- if children[:tech_contacts]
- children[:tech_contacts].each do |tc|
%p{:style => "font-size:x-small;"}
= tc[:name] + ","
= tc[:phone] + ","
= tc[:email] + ","
= tc[:code]
%td
- if children[:nameservers]
- children[:nameservers].each do |ns|
%p{:style => "font-size:x-small;"}
= ns[:hostname] + ","
= ns[:ipv4] || ns[:ipv6]
%td
%p{ :style => 'font-size:x-small;' }
= l(version.created_at, format: :short)
= whodunnit_with_protocol(version.whodunnit)
=# version.whodunnit
=# version.event

View file

@ -1,36 +0,0 @@
= form_for([:client, @domain], html: { class: 'form-horizontal' }) do |f|
= render 'shared/errors', object: @domain
- unless @domain.parent_valid?
%hr
.row
.col-md-12
/ Nav tabs
%ul.nav.nav-tabs{:role => "tablist", id: 'tabs'}
- li_class = @domain.general_tab_valid? ? nil : 'error-tab'
%li.active{class: li_class}
%a{"data-toggle" => "tab", :href => "#general-tab", :role => "tab"}= t('shared.general')
- li_class = @domain.statuses_tab_valid? ? nil : 'error-tab'
%li{class: li_class}
%a{"data-toggle" => "tab", :href => "#statuses-tab", :role => "tab"}= t('shared.statuses')
/ Tab panes
.tab-content{style:'margin-top: 20px;'}
#general-tab.tab-pane.active
= render 'client/domains/form_partials/general', f: f
%hr
= render 'client/domains/form_partials/contacts', f: f
%hr
= render 'client/domains/form_partials/nameservers', f: f
/ %hr
/ = render 'client/domains/form_partials/dnskeys', f: f
#statuses-tab.tab-pane
= render 'client/domains/form_partials/statuses', f: f
.row
.col-md-12.text-right
= button_tag(t('shared.save'), class: 'btn btn-primary')
:javascript
$(function () {
$('#tabs a:first').tab('show')
})
Autocomplete.bindClientContactSearch();

View file

@ -1,9 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs
= "#{t('shared.edit_domain')}"
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.back_to_domain'), [:client, @domain], class: 'btn btn-default')
%hr
= render 'form'

View file

@ -1,34 +0,0 @@
#domain-contacts
= f.fields_for :domain_contacts do |contact_fields|
.panel.panel-default
.panel-heading.clearfix
.pull-left= t('shared.contact')
.pull-right
= link_to(t('shared.add_another'), '#', class: 'btn btn-primary btn-xs add-domain-contact')
= link_to(t('shared.delete'), '#', class: 'btn btn-danger btn-xs destroy')
.panel-body
.errors
= render 'shared/errors', object: contact_fields.object
- if contact_fields.object.errors.any?
%hr
.form-group
= contact_fields.label :contact_type, class: 'col-md-2 control-label'
.col-md-10
= contact_fields.select :contact_type, options_for_select(DomainContact::TYPES, contact_fields.object.contact_type), {}, {class: 'form-control'}
.form-group
= contact_fields.label :value_typeahead, t('shared.contact'), class: 'col-md-2 control-label'
.col-md-10.has-feedback.js-typeahead-container
= contact_fields.text_field(:value_typeahead, class: 'form-control js-contact-typeahead', placeholder: t('shared.contact_code'), autocomplete: 'off')
%span.glyphicon.glyphicon-ok.form-control-feedback.js-typeahead-ok.hidden
%span.glyphicon.glyphicon-remove.form-control-feedback.js-typeahead-remove
= contact_fields.hidden_field(:contact_id, class: 'js-contact-id')
:javascript
$("#domain-contacts").nestedAttributes({
bindAddTo: $(".add-domain-contact"),
afterAdd: function(item) {
item.find('.errors').html('');
item.find('.js-contact-id').val('')
Autocomplete.bindClientContactSearch();
}
});

View file

@ -1,39 +0,0 @@
#dnskeys
= f.fields_for :dnskeys do |key_fields|
.panel.panel-default
.panel-heading.clearfix
.pull-left= t('shared.dnskey')
.pull-right
= link_to(t('shared.add_another'), '#', class: 'btn btn-primary btn-xs add-dnskey')
= link_to(t('shared.delete'), '#', class: 'btn btn-danger btn-xs destroy')
.panel-body
.errors
= render 'shared/errors', object: key_fields.object
- if key_fields.object.errors.any?
%hr
.form-group
= key_fields.label :flags, class: 'col-md-2 control-label'
.col-md-10
= key_fields.select :flags, options_for_select(Dnskey::FLAGS, key_fields.object.flags), {}, {class: 'form-control'}
.form-group
= key_fields.label :protocol, class: 'col-md-2 control-label'
.col-md-10
= key_fields.select :protocol, options_for_select(Dnskey::PROTOCOLS, key_fields.object.protocol), {}, {class: 'form-control'}
.form-group
= key_fields.label :alg, class: 'col-md-2 control-label'
.col-md-10
= key_fields.select :alg, options_for_select(Dnskey::ALGORITHMS, key_fields.object.alg), {}, {class: 'form-control'}
.form-group
= key_fields.label :public_key, class: 'col-md-2 control-label'
.col-md-10
= key_fields.text_field :public_key, class: 'form-control'
:javascript
$("#dnskeys").nestedAttributes({
bindAddTo: $(".add-dnskey"),
afterAdd: function(item) {
item.find('.errors').html('');
}
});

View file

@ -1,19 +0,0 @@
.form-group
= f.label :name, class: 'col-md-2 control-label'
.col-md-10
= f.text_field(:name, class: 'form-control')
.form-group
= f.label :period, class: 'col-md-2 control-label'
.col-md-5
= f.text_field(:period, class: 'form-control')
.col-md-5
= f.select :period_unit, options_for_select(['y', 'm', 'd'], @domain.period_unit), {}, { class: 'form-control' }
.form-group
= f.label :owner_contact_typeahead, t('shared.owner'), class: 'col-md-2 control-label'
.col-md-10.has-feedback.js-typeahead-container
= f.text_field(:owner_contact_typeahead, class: 'form-control js-contact-typeahead', placeholder: t('shared.contact_code'), autocomplete: 'off')
%span.glyphicon.glyphicon-ok.form-control-feedback.js-typeahead-ok.hidden
%span.glyphicon.glyphicon-remove.form-control-feedback.js-typeahead-remove
= f.hidden_field(:owner_contact_id, class: 'js-contact-id')

View file

@ -1,32 +0,0 @@
#nameservers
= f.fields_for :nameservers do |ns_fields|
.panel.panel-default
.panel-heading.clearfix
.pull-left= t('shared.nameserver')
.pull-right
= link_to(t('shared.add_another'), '#', class: 'btn btn-primary btn-xs add-nameserver')
= link_to(t('shared.delete'), '#', class: 'btn btn-danger btn-xs destroy')
.panel-body
.errors
= render 'shared/errors', object: ns_fields.object
- if ns_fields.object.errors.any?
%hr
.form-group
= ns_fields.label :hostname, class: 'col-md-2 control-label'
.col-md-10
= ns_fields.text_field :hostname, class: 'form-control'
.form-group
= ns_fields.label :ipv4, class: 'col-md-2 control-label'
.col-md-10
= ns_fields.text_field :ipv4, class: 'form-control'
.form-group
= ns_fields.label :ipv6, class: 'col-md-2 control-label'
.col-md-10
= ns_fields.text_field :ipv6, class: 'form-control'
:javascript
$("#nameservers").nestedAttributes({
bindAddTo: $(".add-nameserver"),
afterAdd: function(item) {
item.find('.errors').html('');
}
});

View file

@ -1,29 +0,0 @@
#domain-statuses
= f.fields_for :domain_statuses, @client_statuses do |status_fields|
.panel.panel-default
.panel-heading.clearfix
.pull-left= t('shared.status')
.pull-right
= link_to(t('shared.add_another'), '#', class: 'btn btn-primary btn-xs add-domain-status')
= link_to(t('shared.delete'), '#', class: 'btn btn-danger btn-xs destroy')
.panel-body
.errors
= render 'shared/errors', object: status_fields.object
- if status_fields.object.errors.any?
%hr
.form-group
= status_fields.label :value, class: 'col-md-2 control-label'
.col-md-10
= status_fields.select :value, options_for_select(DomainStatus.statuses_for_client, status_fields.object.value.try(:sub, 'client', '')), {include_blank: true}, {class: 'form-control'}
.form-group
= status_fields.label :description, class: 'col-md-2 control-label'
.col-md-10
= status_fields.text_field :description, class: 'form-control', autocomplete: 'off'
:javascript
$("#domain-statuses").nestedAttributes({
bindAddTo: $(".add-domain-status"),
afterAdd: function(item) {
item.find('.errors').html('');
}
});

View file

@ -1,44 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.domains')
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.create_new_domain'), new_client_domain_path, class: 'btn btn-primary')
%hr
.row
.col-md-12
= search_form_for [:client, @q], html: { class: 'form-horizontal' } do |f|
.col-md-11
.form-group
= f.search_field :name_cont, class: 'form-control'
.col-md-1.text-right.text-center-xs
.form-group
%button.btn.btn-primary
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}
= sort_link(@q, 'name')
%th{class: 'col-xs-2'}
= sort_link(@q, 'owner_contact_name', t('shared.owner'))
%th{class: 'col-xs-2'}
= sort_link(@q, 'valid_to', t('shared.valid_to'))
%th{class: 'col-xs-1'}
%tbody
- @domains.each do |x|
%tr
%td= link_to(x, client_domain_path(x))
%td= link_to(x.owner_contact, [:client, x.owner_contact])
%td= l(x.valid_to, format: :short)
%td= link_to t('shared.history'), client_domain_version_path(x.id), class: 'btn btn-primary'
.row
.col-md-12
= paginate @domains

View file

@ -1,3 +0,0 @@
%h2= t('shared.new_domain')
%hr
= render 'form'

View file

@ -1,22 +0,0 @@
- panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default'
.panel{class: panel_class}
.panel-heading.clearfix
= t('shared.admin_contacts')
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t('shared.name')
%th{class: 'col-xs-4'}= t('shared.code')
%th{class: 'col-xs-4'}= t('shared.email')
%tbody
- @domain.domain_contacts.admin.each do |x|
%tr
%td= link_to(x.contact, '#')
%td= x.contact.code
%td= x.contact.email
- if @domain.errors.messages[:admin_contacts]
%tfoot
- @domain.errors.messages[:admin_contacts].each do |x|
%tr
%td{colspan: 4}= x

View file

@ -1,19 +0,0 @@
.panel.panel-default
.panel-heading
%h3.panel-title= t('shared.general')
.panel-body
%dl.dl-horizontal
%dt= t('shared.name')
%dd= @domain.name
%dt= t('shared.registered_at')
%dd= l(@domain.registered_at)
%dt= t('shared.password')
%dd= @domain.auth_info
%dt= t('shared.valid_from')
%dd= l(@domain.valid_from)
%dt= t('shared.valid_to')
%dd= l(@domain.valid_to)

View file

@ -1,19 +0,0 @@
.panel.panel-default
.panel-heading
%h3.panel-title= t('shared.owner')
.panel-body
%dl.dl-horizontal
%dt= t('shared.name')
%dd= link_to(@domain.owner_contact, '#')
%dt= t('shared.code')
%dd= @domain.owner_contact_code
%dt= t('shared.identity_code')
%dd= @domain.owner_contact_ident
%dt= t('shared.email')
%dd= @domain.owner_contact_email
%dt= t('shared.phone')
%dd= @domain.owner_contact_phone

View file

@ -1,22 +0,0 @@
- panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default'
#tech_contacts.panel{class: panel_class}
.panel-heading.clearfix
= t('shared.tech_contacts')
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}= t('shared.name')
%th{class: 'col-xs-4'}= t('shared.code')
%th{class: 'col-xs-4'}= t('shared.email')
%tbody
- @domain.domain_contacts.tech.each do |x|
%tr
%td= link_to(x.contact, '#')
%td= x.contact.code
%td= x.contact.email
- if @domain.errors.messages[:tech_contacts]
%tfoot
- @domain.errors.messages[:tech_contacts].each do |x|
%tr
%td{colspan: 4}= x

View file

@ -1,27 +0,0 @@
.row
.col-sm-6
%h2.text-center-xs
= "#{t('shared.domain_details')}"
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.edit'), edit_client_domain_path(@domain), class: 'btn btn-primary')
= link_to(t('shared.delete'), client_domain_path(@domain), method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-danger')
%hr
.row
.col-md-6= render 'client/domains/partials/general'
.col-md-6= render 'client/domains/partials/owner'
.row
.col-md-12= render 'client/domains/partials/tech_contacts'
.row
.col-md-12= render 'client/domains/partials/admin_contacts'
.row
.col-md-12= render 'admin/domains/partials/statuses'
.row
.col-md-12= render 'admin/domains/partials/nameservers'
.row
.col-md-12= render 'admin/domains/partials/dnskeys'
- if @domain.versions.present?
= render 'client/shared/versions', versions: @domain.versions

View file

@ -1,24 +0,0 @@
.row
.col-md-12
#nameservers.panel{ class: 'panel-default' }
.panel-heading.clearfix
= t('shared.history')
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th
=t('shared.whodunnit')
%th
=t('shared.event')
%th
=t('shared.created_at')
%tbody
-versions.each do |version|
%tr
%td= whodunnit_with_protocol(version.whodunnit)
%td= version.event
%td= version.created_at

View file

@ -22,10 +22,5 @@
%hr
/ TODO: Refactor this when ID card login is done
- if can? :create, :admin_session
= button_to 'ID card (gitlab)', 'sessions',
= button_to 'ID card (gitlab)', 'sessions',
class: 'btn btn-lg btn-primary btn-block', name: 'gitlab'
- if can? :create, :session
= button_to 'ID card (zone)', 'sessions',
class: 'btn btn-lg btn-primary btn-block', name: 'zone'
= button_to 'ID card (elkdata)', 'sessions',
class: 'btn btn-lg btn-primary btn-block', name: 'elkdata'

View file

@ -33,27 +33,6 @@ Rails.application.routes.draw do
end
## CLIENT ROUTES
namespace(:client) do
resources :domains
resources :domain_transfers do
member do
post 'approve'
end
end
resources :contacts do
collection do
get 'search'
end
end
resources :contact_versions
resources :domain_versions
root 'domains#index'
end
devise_for :users
devise_scope :user do

View file

@ -273,7 +273,7 @@ describe 'EPP Domain', epp: true do
hostName: { value: 'ns2.example.ee' }
}
}
],
]
})
response = epp_request(xml, :xml)
@ -360,7 +360,7 @@ describe 'EPP Domain', epp: true do
},
{
hostObj: { value: 'ns2.example.ee' }
},
}
]
})

View file

@ -15,7 +15,6 @@ feature 'Sessions', type: :feature do
scenario 'Admin logs in' do
visit root_path
expect(page).to have_button('ID card (gitlab)')
expect(page).to have_button('ID card (zone)')
click_on 'ID card (gitlab)'
expect(page).to have_text('Welcome!')
@ -26,22 +25,4 @@ feature 'Sessions', type: :feature do
expect(page).to have_link('Elkdata', count: 2)
expect(page).to have_link('Zone Media OÜ', count: 2)
end
scenario 'Client logs in' do
visit root_path
click_on 'ID card (zone)'
expect(page).to have_text('Welcome!')
uri = URI.parse(current_url)
expect(uri.path).to eq(client_root_path)
zone.domains.pluck(:name).each do |name|
expect(page).to have_link(name)
end
elkdata.domains.pluck(:name).each do |name|
expect(page).to_not have_link(name)
end
end
end

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Setting management', type: :feature do
let(:zone) { Fabricate(:registrar) }
let(:zone_user) { Fabricate(:user, registrar: zone, username: 'zone', admin: true, identity_code: '37810013087') }
let(:zone_user) { Fabricate(:user, registrar: zone, username: 'gitlab', admin: true, identity_code: '37810013087') }
background { create_settings }

View file

@ -2,8 +2,6 @@ module Feature
def sign_in(user)
visit '/logout'
click_on 'ID card (gitlab)' if user.username == 'gitlab'
click_on 'ID card (zone)' if user.username == 'zone'
click_on 'ID card (elkdata)' if user.username == 'elkdata'
end
end