mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Add client controller
This commit is contained in:
parent
eedbc211b5
commit
03b143eef2
7 changed files with 105 additions and 27 deletions
7
app/controllers/client/domains_controller.rb
Normal file
7
app/controllers/client/domains_controller.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class Client::DomainsController < ClientController
|
||||||
|
def index
|
||||||
|
@q = current_user.registrar.domains.search(params[:q])
|
||||||
|
@domains = @q.result.page(params[:page])
|
||||||
|
render 'admin/domains/index'
|
||||||
|
end
|
||||||
|
end
|
5
app/controllers/client_controller.rb
Normal file
5
app/controllers/client_controller.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class ClientController < ApplicationController
|
||||||
|
def current_user
|
||||||
|
EppUser.last
|
||||||
|
end
|
||||||
|
end
|
|
@ -5,30 +5,4 @@
|
||||||
%h2.text-right.text-center-xs
|
%h2.text-right.text-center-xs
|
||||||
= link_to(t('shared.add'), new_admin_domain_path, class: 'btn btn-primary')
|
= link_to(t('shared.add'), new_admin_domain_path, class: 'btn btn-primary')
|
||||||
%hr
|
%hr
|
||||||
.row
|
= render 'shared/domains/index'
|
||||||
.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, 'registrar_name', t('shared.registrar'))
|
|
||||||
%th{class: 'col-xs-2'}
|
|
||||||
= sort_link(@q, 'owner_contact_international_address_name', t('shared.owner'))
|
|
||||||
%th{class: 'col-xs-1'}
|
|
||||||
= sort_link(@q, 'valid_to', t('shared.valid_to'))
|
|
||||||
%th{class: 'col-xs-1'}
|
|
||||||
= t('shared.action')
|
|
||||||
%tbody
|
|
||||||
- @domains.each do |x|
|
|
||||||
%tr
|
|
||||||
%td= link_to(x, admin_domain_path(x))
|
|
||||||
%td= link_to(x.registrar, root_path) if x.registrar
|
|
||||||
%td= link_to(x.owner_contact, [:admin, x.owner_contact])
|
|
||||||
%td= l(x.valid_to, format: :short)
|
|
||||||
%td= link_to(t('shared.edit'), edit_admin_domain_path(x), class: 'btn btn-primary btn-xs')
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
= paginate @domains
|
|
||||||
|
|
8
app/views/client/domains/index.haml
Normal file
8
app/views/client/domains/index.haml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
.row
|
||||||
|
.col-sm-6
|
||||||
|
%h2.text-center-xs= t('shared.domains')
|
||||||
|
.col-sm-6
|
||||||
|
%h2.text-right.text-center-xs
|
||||||
|
= link_to(t('shared.add'), new_client_domain_path, class: 'btn btn-primary')
|
||||||
|
%hr
|
||||||
|
= render 'shared/domains/index'
|
53
app/views/layouts/client.haml
Normal file
53
app/views/layouts/client.haml
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
%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: "EPP-Client", 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 EPP Client
|
||||||
|
%body
|
||||||
|
/ Static navbar
|
||||||
|
.navbar.navbar-inverse.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 'EPP Client', root_path, class: 'navbar-brand'
|
||||||
|
.navbar-collapse.collapse
|
||||||
|
%ul.nav.navbar-nav
|
||||||
|
%li.dropdown.active
|
||||||
|
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
|
||||||
|
= t('shared.domains')
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu{role: "menu"}
|
||||||
|
%li
|
||||||
|
= link_to t('shared.check'), client_domains_path
|
||||||
|
%li
|
||||||
|
= link_to t('shared.register'), '#'
|
||||||
|
|
||||||
|
%li.dropdown
|
||||||
|
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
|
||||||
|
= t('shared.contacts')
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu{role: "menu"}
|
||||||
|
%li
|
||||||
|
= link_to t('shared.check'), '#'
|
||||||
|
%li
|
||||||
|
= link_to t('shared.register'), '#'
|
||||||
|
%ul.nav.navbar-nav.navbar-right
|
||||||
|
%li= link_to t('shared.log_out'), '/logout'
|
||||||
|
/ /.nav-collapse
|
||||||
|
.container
|
||||||
|
- display = (flash.empty?) ? 'none' : 'block'
|
||||||
|
#flash{style: "display: #{display};"}
|
||||||
|
- type = (flash[:notice]) ? 'bg-success' : 'bg-danger'
|
||||||
|
.alert{class: type}= flash[:notice] || flash[:alert]
|
||||||
|
= yield
|
27
app/views/shared/domains/_index.haml
Normal file
27
app/views/shared/domains/_index.haml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
.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, 'registrar_name', t('shared.registrar'))
|
||||||
|
%th{class: 'col-xs-2'}
|
||||||
|
= sort_link(@q, 'owner_contact_international_address_name', t('shared.owner'))
|
||||||
|
%th{class: 'col-xs-1'}
|
||||||
|
= sort_link(@q, 'valid_to', t('shared.valid_to'))
|
||||||
|
%th{class: 'col-xs-1'}
|
||||||
|
= t('shared.action')
|
||||||
|
%tbody
|
||||||
|
- @domains.each do |x|
|
||||||
|
%tr
|
||||||
|
%td= link_to(x, admin_domain_path(x))
|
||||||
|
%td= link_to(x.registrar, root_path) if x.registrar
|
||||||
|
%td= link_to(x.owner_contact, [:admin, x.owner_contact])
|
||||||
|
%td= l(x.valid_to, format: :short)
|
||||||
|
%td= link_to(t('shared.edit'), edit_admin_domain_path(x), class: 'btn btn-primary btn-xs')
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= paginate @domains
|
|
@ -21,6 +21,10 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
namespace(:client) do
|
||||||
|
resources :domains
|
||||||
|
end
|
||||||
|
|
||||||
# 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".
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue