mirror of
https://github.com/internetee/registry.git
synced 2025-07-05 10:43:32 +02:00
User interface for the registry along with basic settings
This commit is contained in:
parent
d5d1d0040b
commit
ceb688902f
26 changed files with 278 additions and 32 deletions
2
Gemfile
2
Gemfile
|
@ -40,6 +40,8 @@ gem 'simpleidn', '~> 0.0.5'
|
||||||
#for EE-id validation
|
#for EE-id validation
|
||||||
gem 'isikukood'
|
gem 'isikukood'
|
||||||
|
|
||||||
|
gem 'bootstrap-sass', '~> 3.2.0.1'
|
||||||
|
|
||||||
group :assets do
|
group :assets do
|
||||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||||
gem 'therubyracer', platforms: :ruby
|
gem 'therubyracer', platforms: :ruby
|
||||||
|
|
|
@ -28,6 +28,8 @@ GEM
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
arel (5.0.1.20140414130214)
|
arel (5.0.1.20140414130214)
|
||||||
|
bootstrap-sass (3.2.0.1)
|
||||||
|
sass (~> 3.2)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
byebug (2.7.0)
|
byebug (2.7.0)
|
||||||
columnize (~> 0.3)
|
columnize (~> 0.3)
|
||||||
|
@ -180,6 +182,7 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
bootstrap-sass (~> 3.2.0.1)
|
||||||
coffee-rails (~> 4.0.0)
|
coffee-rails (~> 4.0.0)
|
||||||
database_cleaner (~> 1.3.0)
|
database_cleaner (~> 1.3.0)
|
||||||
epp (~> 1.4.0)
|
epp (~> 1.4.0)
|
||||||
|
|
|
@ -13,4 +13,5 @@
|
||||||
//= require jquery
|
//= require jquery
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
//= require turbolinks
|
//= require turbolinks
|
||||||
|
//= require bootstrap-sprockets
|
||||||
//= require_tree .
|
//= require_tree .
|
||||||
|
|
3
app/assets/stylesheets/app.css.scss
Normal file
3
app/assets/stylesheets/app.css.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.navbar-static-top {
|
||||||
|
margin-bottom: 19px;
|
||||||
|
}
|
|
@ -1,15 +0,0 @@
|
||||||
/*
|
|
||||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
||||||
* listed below.
|
|
||||||
*
|
|
||||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
||||||
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
||||||
*
|
|
||||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
||||||
* compiled file so the styles you add here take precedence over styles defined in any styles
|
|
||||||
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
|
||||||
* file per style scope.
|
|
||||||
*
|
|
||||||
*= require_tree .
|
|
||||||
*= require_self
|
|
||||||
*/
|
|
2
app/assets/stylesheets/application.css.scss
Normal file
2
app/assets/stylesheets/application.css.scss
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
@import "bootstrap-sprockets";
|
||||||
|
@import "bootstrap";
|
26
app/controllers/setting_groups_controller.rb
Normal file
26
app/controllers/setting_groups_controller.rb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
class SettingGroupsController < ApplicationController
|
||||||
|
before_action :set_setting_group, only: [:show, :update]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@setting_groups = SettingGroup.all
|
||||||
|
end
|
||||||
|
|
||||||
|
def show; end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if @setting_group.update(setting_group_params)
|
||||||
|
redirect_to @setting_group
|
||||||
|
else
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def set_setting_group
|
||||||
|
@setting_group = SettingGroup.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def setting_group_params
|
||||||
|
params.require(:setting_group).permit(settings_attributes: [ :value, :id ])
|
||||||
|
end
|
||||||
|
end
|
3
app/controllers/settings_controller.rb
Normal file
3
app/controllers/settings_controller.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class SettingsController < ApplicationController
|
||||||
|
|
||||||
|
end
|
|
@ -6,7 +6,7 @@ module Epp::DomainsHelper
|
||||||
handle_errors(@domain) and return unless @domain.attach_objects(@ph, parsed_frame)
|
handle_errors(@domain) and return unless @domain.attach_objects(@ph, parsed_frame)
|
||||||
handle_errors(@domain) and return unless @domain.save
|
handle_errors(@domain) and return unless @domain.save
|
||||||
|
|
||||||
render '/epp/domains/create'
|
render '/epp/domains/success'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -34,6 +34,14 @@ module Epp::DomainsHelper
|
||||||
render '/epp/domains/info'
|
render '/epp/domains/info'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_domain
|
||||||
|
@domain = find_domain
|
||||||
|
|
||||||
|
handle_errors(@domain) and return unless @domain
|
||||||
|
|
||||||
|
render '/epp/domains/success'
|
||||||
|
end
|
||||||
|
|
||||||
### HELPER METHODS ###
|
### HELPER METHODS ###
|
||||||
private
|
private
|
||||||
|
|
||||||
|
@ -72,6 +80,11 @@ module Epp::DomainsHelper
|
||||||
xml_attrs_present?(@ph, [['name']])
|
xml_attrs_present?(@ph, [['name']])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
## UPDATE
|
||||||
|
def validate_domain_update_request
|
||||||
|
@ph = params_hash['epp']['command']['update']['update']
|
||||||
|
xml_attrs_present?(@ph, [['name']])
|
||||||
|
end
|
||||||
|
|
||||||
## SHARED
|
## SHARED
|
||||||
def find_domain
|
def find_domain
|
||||||
|
|
3
app/models/setting.rb
Normal file
3
app/models/setting.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class Setting < ActiveRecord::Base
|
||||||
|
belongs_to :setting_group
|
||||||
|
end
|
5
app/models/setting_group.rb
Normal file
5
app/models/setting_group.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class SettingGroup < ActiveRecord::Base
|
||||||
|
has_many :settings
|
||||||
|
|
||||||
|
accepts_nested_attributes_for :settings
|
||||||
|
end
|
|
@ -1,14 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Internetee</title>
|
|
||||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
|
||||||
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
|
||||||
<%= csrf_meta_tags %>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<%= yield %>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
54
app/views/layouts/application.html.haml
Normal file
54
app/views/layouts/application.html.haml
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
%html{lang: "en"}
|
||||||
|
%head
|
||||||
|
%meta{charset: "utf-8"}/
|
||||||
|
%meta{content: "IE=edge", "http-equiv" => "X-UA-Compatible"}/
|
||||||
|
%meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
|
||||||
|
%meta{content: "Full stack top-level domain (TLD) management.", name: "description"}/
|
||||||
|
%meta{content: "Gitlab LTD", name: "author"}/
|
||||||
|
= csrf_meta_tags
|
||||||
|
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
||||||
|
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
||||||
|
%link{href: "../../favicon.ico", rel: "icon"}/
|
||||||
|
%title Eesti Interneti SA
|
||||||
|
%body
|
||||||
|
/ Static navbar
|
||||||
|
.navbar.navbar-default.navbar-static-top{role: "navigation"}
|
||||||
|
.container
|
||||||
|
.navbar-header
|
||||||
|
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"}
|
||||||
|
%span.sr-only Toggle navigation
|
||||||
|
%span.icon-bar
|
||||||
|
%span.icon-bar
|
||||||
|
%span.icon-bar
|
||||||
|
= link_to APP_CONFIG['app_name'], root_path, class: 'navbar-brand'
|
||||||
|
.navbar-collapse.collapse
|
||||||
|
%ul.nav.navbar-nav
|
||||||
|
%li
|
||||||
|
= link_to t('shared.dashboard'), root_path
|
||||||
|
%li
|
||||||
|
= link_to t('shared.registrars'), root_path
|
||||||
|
%li
|
||||||
|
= link_to t('shared.domains'), root_path
|
||||||
|
%li.dropdown
|
||||||
|
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
|
||||||
|
= t('shared.settings')
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu{role: "menu"}
|
||||||
|
%li.dropdown-header= t('shared.system')
|
||||||
|
%li
|
||||||
|
= link_to t('shared.setting_groups'), setting_groups_path
|
||||||
|
%li
|
||||||
|
= link_to t('shared.users'), '#'
|
||||||
|
%li
|
||||||
|
= link_to t('shared.epp_users'), '#'
|
||||||
|
%li.divider
|
||||||
|
%li.dropdown-header= 'Something else'
|
||||||
|
%li
|
||||||
|
%a{href: "#"} Link
|
||||||
|
%ul.nav.navbar-nav.navbar-right
|
||||||
|
%li= link_to t('shared.log_out'), '/logout'
|
||||||
|
/ /.nav-collapse
|
||||||
|
.container
|
||||||
|
= yield
|
||||||
|
|
||||||
|
|
14
app/views/setting_groups/index.haml
Normal file
14
app/views/setting_groups/index.haml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
%h2= t('shared.setting_groups')
|
||||||
|
%hr
|
||||||
|
- @setting_groups.each do |x|
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%table.table.table-striped.table-bordered
|
||||||
|
%tr
|
||||||
|
%th{class: 'col-xs-9'}
|
||||||
|
= t('.setting_group')
|
||||||
|
%th{class: 'col-xs-2'}
|
||||||
|
= t('shared.action')
|
||||||
|
%tr
|
||||||
|
%td= t("setting_groups.codes.#{x.code}")
|
||||||
|
%td= link_to(t('.edit_settings'), setting_group_path(x), class: 'btn btn-primary btn-xs')
|
19
app/views/setting_groups/show.haml
Normal file
19
app/views/setting_groups/show.haml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
%h2= t("setting_groups.codes.#{@setting_group.code}")
|
||||||
|
%hr
|
||||||
|
= form_for(@setting_group) do |f|
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%table.table.table-striped.table-bordered
|
||||||
|
%tr
|
||||||
|
%th{class: 'col-xs-9'}
|
||||||
|
= t('.setting')
|
||||||
|
%th{class: 'col-xs-2'}
|
||||||
|
= t('shared.value')
|
||||||
|
- @setting_group.settings.each do |setting|
|
||||||
|
= f.fields_for :settings, setting do |sf|
|
||||||
|
%tr
|
||||||
|
%td= t("settings.codes.#{sf.object.code}")
|
||||||
|
%td= sf.text_field(:value, autocomplete: 'off')
|
||||||
|
.row
|
||||||
|
.col-md-12.text-right
|
||||||
|
%button.btn.btn-primary=t('shared.save')
|
14
config/application.yml
Normal file
14
config/application.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
defaults: &defaults
|
||||||
|
app_name: .EE Registry
|
||||||
|
|
||||||
|
development:
|
||||||
|
<<: *defaults
|
||||||
|
|
||||||
|
test:
|
||||||
|
<<: *defaults
|
||||||
|
|
||||||
|
staging:
|
||||||
|
<<: *defaults
|
||||||
|
|
||||||
|
production:
|
||||||
|
<<: *defaults
|
1
config/initializers/app_config.rb
Normal file
1
config/initializers/app_config.rb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
APP_CONFIG = YAML.load_file("#{Rails.root}/config/application.yml")[Rails.env]
|
|
@ -83,3 +83,33 @@ en:
|
||||||
epp_exp_dates_do_not_match: 'Given and current expire dates do not match'
|
epp_exp_dates_do_not_match: 'Given and current expire dates do not match'
|
||||||
epp_registrant_not_found: 'Registrant not found'
|
epp_registrant_not_found: 'Registrant not found'
|
||||||
required_parameter_missing: 'Required parameter missing: %{key}'
|
required_parameter_missing: 'Required parameter missing: %{key}'
|
||||||
|
|
||||||
|
setting_groups:
|
||||||
|
codes:
|
||||||
|
domain_statuses: 'Domain statuses'
|
||||||
|
|
||||||
|
index:
|
||||||
|
setting_group: 'Setting group'
|
||||||
|
edit_settings: 'Edit settings'
|
||||||
|
show:
|
||||||
|
setting: 'Setting'
|
||||||
|
|
||||||
|
settings:
|
||||||
|
codes:
|
||||||
|
ns_min_count: 'Nameserver minimum count'
|
||||||
|
ns_max_count: 'Nameserver maximum count'
|
||||||
|
|
||||||
|
shared:
|
||||||
|
code: 'Code'
|
||||||
|
value: 'Value'
|
||||||
|
setting_groups: 'Setting groups'
|
||||||
|
action: 'Action'
|
||||||
|
edit: 'Edit'
|
||||||
|
save: 'Save'
|
||||||
|
dashboard: 'Dashboard'
|
||||||
|
log_out: 'Log out'
|
||||||
|
system: 'System'
|
||||||
|
settings: 'Settings'
|
||||||
|
domains: 'Domains'
|
||||||
|
epp_users: 'EPP Users'
|
||||||
|
registrars: 'Registrars'
|
||||||
|
|
|
@ -5,11 +5,14 @@ Rails.application.routes.draw do
|
||||||
get 'error/:command', to: 'errors#error', defaults: { format: :xml }
|
get 'error/:command', to: 'errors#error', defaults: { format: :xml }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :setting_groups
|
||||||
|
resources :settings
|
||||||
|
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
# See how all your routes lay out with "rake routes".
|
# See how all your routes lay out with "rake routes".
|
||||||
|
|
||||||
# You can have the root of your site routed with "root"
|
# You can have the root of your site routed with "root"
|
||||||
# root 'welcome#index'
|
root 'setting_groups#index'
|
||||||
|
|
||||||
# Example of regular route:
|
# Example of regular route:
|
||||||
# get 'products/:id' => 'catalog#view'
|
# get 'products/:id' => 'catalog#view'
|
||||||
|
|
7
db/migrate/20140815082619_create_setting_groups.rb
Normal file
7
db/migrate/20140815082619_create_setting_groups.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class CreateSettingGroups < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :setting_groups do |t|
|
||||||
|
t.string :code
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
9
db/migrate/20140815082916_create_settings.rb
Normal file
9
db/migrate/20140815082916_create_settings.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
class CreateSettings < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :settings do |t|
|
||||||
|
t.integer :setting_group_id
|
||||||
|
t.string :code
|
||||||
|
t.string :value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
11
db/migrate/20140815110028_populate_settings.rb
Normal file
11
db/migrate/20140815110028_populate_settings.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
class PopulateSettings < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
SettingGroup.create(
|
||||||
|
code: 'domain_validation',
|
||||||
|
settings: [
|
||||||
|
Setting.create(code: 'ns_min_count', value: 1),
|
||||||
|
Setting.create(code: 'ns_max_count', value: 13),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
12
db/schema.rb
12
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20140813135408) do
|
ActiveRecord::Schema.define(version: 20140815110028) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -163,6 +163,16 @@ ActiveRecord::Schema.define(version: 20140813135408) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "setting_groups", force: true do |t|
|
||||||
|
t.string "code"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "settings", force: true do |t|
|
||||||
|
t.integer "setting_group_id"
|
||||||
|
t.string "code"
|
||||||
|
t.string "value"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "users", force: true do |t|
|
create_table "users", force: true do |t|
|
||||||
t.string "username"
|
t.string "username"
|
||||||
t.string "password"
|
t.string "password"
|
||||||
|
|
|
@ -240,6 +240,15 @@ describe 'EPP Domain', epp: true do
|
||||||
expect(response[:results][0][:result_code]).to eq('2303')
|
expect(response[:results][0][:result_code]).to eq('2303')
|
||||||
expect(response[:results][0][:msg]).to eq('Domain not found')
|
expect(response[:results][0][:msg]).to eq('Domain not found')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'updates domain', pending: true do
|
||||||
|
response = epp_request('domains/update.xml')
|
||||||
|
expect(response[:results][0][:result_code]).to eq('1000')
|
||||||
|
|
||||||
|
d = Domain.first
|
||||||
|
new_ns = d.nameservers.find_by(hostname: 'ns2.example.com')
|
||||||
|
expect(new_ns).to be_truthy
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'checks a domain' do
|
it 'checks a domain' do
|
||||||
|
|
33
spec/epp/requests/domains/update.xml
Normal file
33
spec/epp/requests/domains/update.xml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update
|
||||||
|
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:name>example.ee</domain:name>
|
||||||
|
<domain:add>
|
||||||
|
<domain:ns>
|
||||||
|
<domain:hostObj>ns2.example.com</domain:hostObj>
|
||||||
|
</domain:ns>
|
||||||
|
<domain:contact type="tech">mak21</domain:contact>
|
||||||
|
<domain:status s="clientHold"
|
||||||
|
lang="en">Payment overdue.</domain:status>
|
||||||
|
</domain:add>
|
||||||
|
<domain:rem>
|
||||||
|
<domain:ns>
|
||||||
|
<domain:hostObj>ns1.example.com</domain:hostObj>
|
||||||
|
</domain:ns>
|
||||||
|
<domain:contact type="tech">sh8013</domain:contact>
|
||||||
|
<domain:status s="clientUpdateProhibited"/>
|
||||||
|
</domain:rem>
|
||||||
|
<domain:chg>
|
||||||
|
<domain:registrant>sh8013</domain:registrant>
|
||||||
|
<domain:authInfo>
|
||||||
|
<domain:pw>2BARfoo</domain:pw>
|
||||||
|
</domain:authInfo>
|
||||||
|
</domain:chg>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue