mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
commit
924df78fe5
31 changed files with 212 additions and 34 deletions
|
@ -1,3 +1,6 @@
|
|||
28.02.2017
|
||||
* Add missing registrar's website field in UI
|
||||
|
||||
24.01.2017
|
||||
* Disallow EPP domain:update/transfer/delete if a domain has "deleteCandidate" status
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ class Admin::RegistrarsController < AdminController
|
|||
@registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
|
||||
end
|
||||
|
||||
flash[:notice] = I18n.t('registrar_added')
|
||||
flash[:notice] = t('.created')
|
||||
redirect_to [:admin, @registrar]
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
flash.now[:alert] = I18n.t('failed_to_add_registrar')
|
||||
flash.now[:alert] = t('.not_created')
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
@ -35,10 +35,10 @@ class Admin::RegistrarsController < AdminController
|
|||
|
||||
def update
|
||||
if @registrar.update(registrar_params)
|
||||
flash[:notice] = I18n.t('registrar_updated')
|
||||
flash[:notice] = t('.updated')
|
||||
redirect_to [:admin, @registrar]
|
||||
else
|
||||
flash.now[:alert] = I18n.t('failed_to_update_registrar')
|
||||
flash.now[:alert] = t('.not_updated')
|
||||
render 'edit'
|
||||
end
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ class Admin::RegistrarsController < AdminController
|
|||
def registrar_params
|
||||
params.require(:registrar).permit(
|
||||
:name, :reg_no, :vat_no, :street, :city, :state, :zip, :billing_address,
|
||||
:country_code, :email, :phone, :billing_email, :code, :test_registrar
|
||||
:country_code, :email, :phone, :website, :billing_email, :code, :test_registrar
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class Registrar < ActiveRecord::Base
|
|||
has_many :priv_contacts, -> { privs }, class_name: 'Contact'
|
||||
has_many :white_ips, dependent: :destroy
|
||||
|
||||
delegate :balance, to: :cash_account
|
||||
delegate :balance, to: :cash_account, allow_nil: true
|
||||
|
||||
validates :name, :reg_no, :country_code, :email, :code, presence: true
|
||||
validates :name, :reg_no, :reference_no, :code, uniqueness: true
|
||||
|
@ -102,7 +102,7 @@ class Registrar < ActiveRecord::Base
|
|||
buyer_city: city,
|
||||
buyer_zip: zip,
|
||||
buyer_phone: phone,
|
||||
buyer_url: url,
|
||||
buyer_url: website,
|
||||
buyer_email: email,
|
||||
reference_no: reference_no,
|
||||
invoice_items_attributes: [
|
||||
|
|
|
@ -85,7 +85,7 @@ class WhoisRecord < ActiveRecord::Base
|
|||
|
||||
# update registar triggers when adding new attributes
|
||||
h[:registrar] = domain.registrar.name
|
||||
h[:registrar_url] = domain.registrar.url
|
||||
h[:registrar_website] = domain.registrar.website
|
||||
h[:registrar_phone] = domain.registrar.phone
|
||||
h[:registrar_address] = domain.registrar.address
|
||||
h[:registrar_changed] = domain.registrar.updated_at.try(:to_s, :iso8601)
|
||||
|
|
|
@ -16,8 +16,8 @@ class RegistrarPresenter
|
|||
registrar.phone
|
||||
end
|
||||
|
||||
def url
|
||||
registrar.url
|
||||
def website
|
||||
registrar.website
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -27,6 +27,11 @@
|
|||
= f.label :phone
|
||||
.col-md-7
|
||||
= f.text_field(:phone, class: 'form-control')
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
= f.label :website
|
||||
.col-md-7
|
||||
= f.url_field :website, class: 'form-control'
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
= f.label :email
|
||||
|
@ -75,7 +80,7 @@
|
|||
.col-md-8
|
||||
.panel.panel-default
|
||||
.panel-heading.clearfix
|
||||
.pull-left= t(:misc)
|
||||
.pull-left= t('.misc')
|
||||
.panel-body
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
|
@ -91,4 +96,4 @@
|
|||
%hr
|
||||
.row
|
||||
.col-md-8.text-right
|
||||
= button_tag(t(:save), class: 'btn btn-primary')
|
||||
= button_tag(t(".#{f.object.new_record? ? 'create' : 'update'}_btn"), class: 'btn btn-success')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- content_for :actions do
|
||||
= link_to(t(:new), new_admin_registrar_path, class: 'btn btn-primary')
|
||||
= link_to(t('.new_btn'), new_admin_registrar_path, class: 'btn btn-primary')
|
||||
= render 'shared/title', name: t(:registrars)
|
||||
|
||||
.row
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
%dt= t(:credit_balance)
|
||||
%dd= @registrar.balance
|
||||
|
||||
%dt= Registrar.human_attribute_name :website
|
||||
%dd= @registrar.website
|
||||
|
||||
.col-md-6
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
|
|
|
@ -40,7 +40,7 @@ changed: <%= contact['changed'].to_s.tr('T',' ').sub('+', ' +') %>
|
|||
<%- end -%>
|
||||
Registrar:
|
||||
name: <%= json['registrar'] %>
|
||||
url: <%= json['registrar_url'] %>
|
||||
url: <%= json['registrar_website'] %>
|
||||
phone: <%= json['registrar_phone'] %>
|
||||
changed: <%= json['registrar_changed'].to_s.tr('T',' ').sub('+', ' +') %>
|
||||
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<%= registrar.name %><br>
|
||||
Email: <%= registrar.email %><br>
|
||||
Phone: <%= registrar.phone %><br>
|
||||
Website: <%= registrar.url %>
|
||||
Website: <%= registrar.website %>
|
||||
</p>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= registrar.name %>
|
||||
Email: <%= registrar.email %>
|
||||
Phone: <%= registrar.phone %>
|
||||
Website: <%= registrar.url %>
|
||||
Website: <%= registrar.website %>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<%= registrar.name %><br>
|
||||
Email: <%= registrar.email %><br>
|
||||
Telefon: <%= registrar.phone %><br>
|
||||
Veebileht: <%= registrar.url %>
|
||||
Veebileht: <%= registrar.website %>
|
||||
</p>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= registrar.name %>
|
||||
Email: <%= registrar.email %>
|
||||
Telefon: <%= registrar.phone %>
|
||||
Veebileht: <%= registrar.url %>
|
||||
Veebileht: <%= registrar.website %>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<%= registrar.name %><br>
|
||||
Электронная почта: <%= registrar.email %><br>
|
||||
Телефон: <%= registrar.phone %><br>
|
||||
Веб-сайт: <%= registrar.url %>
|
||||
Веб-сайт: <%= registrar.website %>
|
||||
</p>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= registrar.name %>
|
||||
Электронная почта: <%= registrar.email %>
|
||||
Телефон: <%= registrar.phone %>
|
||||
Веб-сайт: <%= registrar.url %>
|
||||
Веб-сайт: <%= registrar.website %>
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
en:
|
||||
admin:
|
||||
registrars:
|
||||
index:
|
||||
new_btn: New registrar
|
||||
|
||||
show:
|
||||
new_api_use_btn: New API user
|
||||
active: Active
|
||||
api_users: API users
|
||||
|
||||
create:
|
||||
created: Registrar has been successfully created
|
||||
not_created: Unable to create registrar
|
||||
|
||||
update:
|
||||
updated: Registrar has been successfully updated
|
||||
not_updated: Unable to update registrar
|
||||
|
||||
form:
|
||||
misc: Miscellaneous
|
||||
create_btn: Create registrar
|
||||
update_btn: Update registrar
|
||||
|
|
|
@ -395,14 +395,10 @@ en:
|
|||
history: 'History'
|
||||
|
||||
new_registrar: 'New registrar'
|
||||
registrar_added: 'Registrar added!'
|
||||
failed_to_add_registrar: 'Failed to add registrar'
|
||||
registrar_details: 'Registrar details'
|
||||
vat_no: 'VAT no'
|
||||
edit_registrar: 'Edit registrar'
|
||||
back_to_registrar: 'Back to registrar'
|
||||
registrar_updated: 'Registrar updated'
|
||||
failed_to_update_registrar: 'Failed to update registrar'
|
||||
registrar_deleted: 'Registrar deleted'
|
||||
failed_to_delete_registrar: 'Failed to delete registrar'
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class RenameRegistrarUrlToWebsite < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :registrars, :url, :website
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20161227193500) do
|
||||
ActiveRecord::Schema.define(version: 20170221115548) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -1046,7 +1046,7 @@ ActiveRecord::Schema.define(version: 20161227193500) do
|
|||
t.string "street"
|
||||
t.string "zip"
|
||||
t.string "code"
|
||||
t.string "url"
|
||||
t.string "website"
|
||||
t.string "directo_handle"
|
||||
t.boolean "vat"
|
||||
t.integer "legacy_id"
|
||||
|
|
|
@ -2704,7 +2704,7 @@ CREATE TABLE registrars (
|
|||
street character varying,
|
||||
zip character varying,
|
||||
code character varying,
|
||||
url character varying,
|
||||
website character varying,
|
||||
directo_handle character varying,
|
||||
vat boolean,
|
||||
legacy_id integer,
|
||||
|
@ -5278,3 +5278,5 @@ INSERT INTO schema_migrations (version) VALUES ('20161004101419');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20161227193500');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20170221115548');
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ Fabricator(:eis, from: :registrar) do
|
|||
city 'Tallinn'
|
||||
street 'Paldiski mnt 80'
|
||||
zip '10617'
|
||||
url 'www.internet.ee'
|
||||
website 'www.internet.ee'
|
||||
code { sequence(:code) { |i| "EIS#{i}" } }
|
||||
accounts(count: 1) { Fabricate(:account, account_activities: []) }
|
||||
end
|
||||
|
|
20
spec/features/admin/registrars/create_spec.rb
Normal file
20
spec/features/admin/registrars/create_spec.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'New registrar' do
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'creates registrar' do
|
||||
visit admin_registrars_url
|
||||
click_link_or_button 'New registrar'
|
||||
|
||||
fill_in 'registrar[name]', with: 'test'
|
||||
fill_in 'registrar[reg_no]', with: '1234567'
|
||||
fill_in 'registrar[email]', with: 'test@test.com'
|
||||
fill_in 'registrar[code]', with: 'test'
|
||||
click_link_or_button 'Create registrar'
|
||||
|
||||
expect(page).to have_text('Registrar has been successfully created')
|
||||
end
|
||||
end
|
18
spec/features/admin/registrars/edit_spec.rb
Normal file
18
spec/features/admin/registrars/edit_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Edit registrar' do
|
||||
given!(:registrar) { create(:registrar) }
|
||||
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'updates registrar' do
|
||||
visit admin_registrar_url(registrar)
|
||||
click_link_or_button 'Edit'
|
||||
|
||||
click_link_or_button 'Update registrar'
|
||||
|
||||
expect(page).to have_text('Registrar has been successfully updated')
|
||||
end
|
||||
end
|
|
@ -607,7 +607,6 @@ end
|
|||
|
||||
RSpec.describe Domain, db: false do
|
||||
it { is_expected.to alias_attribute(:on_hold_time, :outzone_at) }
|
||||
it { is_expected.to alias_attribute(:force_delete_time, :force_delete_at) }
|
||||
it { is_expected.to alias_attribute(:outzone_time, :outzone_at) }
|
||||
|
||||
describe 'nameserver validation', db: true do
|
||||
|
|
|
@ -25,10 +25,10 @@ RSpec.describe RegistrarPresenter do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#url' do
|
||||
it 'returns url' do
|
||||
expect(registrar).to receive(:url).and_return('test url')
|
||||
expect(presenter.url).to eq('test url')
|
||||
describe '#website' do
|
||||
it 'returns website' do
|
||||
expect(registrar).to receive(:website).and_return('test')
|
||||
expect(presenter.website).to eq('test')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
24
spec/requests/admin/registrars/create_spec.rb
Normal file
24
spec/requests/admin/registrars/create_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin registrar create' do
|
||||
subject(:registrar) { Registrar.first }
|
||||
|
||||
before :example do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'creates new registrar' do
|
||||
expect { post admin_registrars_path, registrar: attributes_for(:registrar) }
|
||||
.to change { Registrar.count }.from(0).to(1)
|
||||
end
|
||||
|
||||
it 'saves website' do
|
||||
post admin_registrars_path, { registrar: attributes_for(:registrar, website: 'test') }
|
||||
expect(registrar.website).to eq('test')
|
||||
end
|
||||
|
||||
it 'redirects to :show' do
|
||||
post admin_registrars_path, { registrar: attributes_for(:registrar) }
|
||||
expect(response).to redirect_to admin_registrar_path(registrar)
|
||||
end
|
||||
end
|
24
spec/requests/admin/registrars/update_spec.rb
Normal file
24
spec/requests/admin/registrars/update_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin registrar update' do
|
||||
before :example do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'updates website' do
|
||||
registrar = create(:registrar, website: 'test')
|
||||
|
||||
patch admin_registrar_path(registrar), registrar: attributes_for(:registrar, website: 'new-website')
|
||||
registrar.reload
|
||||
|
||||
expect(registrar.website).to eq('new-website')
|
||||
end
|
||||
|
||||
it 'redirects to :show' do
|
||||
registrar = create(:registrar)
|
||||
|
||||
patch admin_registrar_path(registrar), { registrar: attributes_for(:registrar) }
|
||||
|
||||
expect(response).to redirect_to admin_registrar_path(registrar)
|
||||
end
|
||||
end
|
33
spec/routing/admin/registrars_routing_spec.rb
Normal file
33
spec/routing/admin/registrars_routing_spec.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::RegistrarsController do
|
||||
describe 'routing' do
|
||||
it 'routes to #index' do
|
||||
expect(get: '/admin/registrars').to route_to('admin/registrars#index')
|
||||
end
|
||||
|
||||
it 'routes to #new' do
|
||||
expect(get: '/admin/registrars/new').to route_to('admin/registrars#new')
|
||||
end
|
||||
|
||||
it 'routes to #show' do
|
||||
expect(get: '/admin/registrars/1').to route_to('admin/registrars#show', id: '1')
|
||||
end
|
||||
|
||||
it 'routes to #edit' do
|
||||
expect(get: '/admin/registrars/1/edit').to route_to('admin/registrars#edit', id: '1')
|
||||
end
|
||||
|
||||
it 'routes to #create' do
|
||||
expect(post: '/admin/registrars').to route_to('admin/registrars#create')
|
||||
end
|
||||
|
||||
it 'routes to #update' do
|
||||
expect(patch: '/admin/registrars/1').to route_to('admin/registrars#update', id: '1')
|
||||
end
|
||||
|
||||
it 'routes to #destroy' do
|
||||
expect(delete: '/admin/registrars/1').to route_to('admin/registrars#destroy', id: '1')
|
||||
end
|
||||
end
|
||||
end
|
15
spec/views/admin/registrars/_form.haml_spec.rb
Normal file
15
spec/views/admin/registrars/_form.haml_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin/registrars/_form' do
|
||||
let(:registrar) { build_stubbed(:registrar) }
|
||||
|
||||
before :example do
|
||||
assign(:registrar, registrar)
|
||||
stub_template 'shared/_full_errors' => ''
|
||||
end
|
||||
|
||||
it 'has website' do
|
||||
render
|
||||
expect(rendered).to have_css('[name="registrar[website]"]')
|
||||
end
|
||||
end
|
15
spec/views/admin/registrars/show.haml_spec.rb
Normal file
15
spec/views/admin/registrars/show.haml_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin/registrars/show' do
|
||||
let(:registrar) { build_stubbed(:registrar, website: 'test website') }
|
||||
|
||||
before :example do
|
||||
assign(:registrar, registrar)
|
||||
stub_template 'shared/_title' => ''
|
||||
end
|
||||
|
||||
it 'has website' do
|
||||
render
|
||||
expect(rendered).to have_text('test website')
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@ RSpec.shared_examples 'domain mailer registrar info' do
|
|||
name
|
||||
email
|
||||
phone
|
||||
url
|
||||
website
|
||||
)
|
||||
|
||||
attributes.each do |attr_name|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue