mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
admin area: use default layout path, remove turbolinks, load js in async mode, extract menu partial
#341
This commit is contained in:
parent
7314a7e33e
commit
e365cc896a
7 changed files with 123 additions and 133 deletions
|
@ -1,6 +1,5 @@
|
||||||
#= require jquery
|
#= require jquery
|
||||||
#= require jquery_ujs
|
#= require jquery_ujs
|
||||||
#= require turbolinks
|
|
||||||
#= require bootstrap-sprockets
|
#= require bootstrap-sprockets
|
||||||
#= require typeahead.bundle.min
|
#= require typeahead.bundle.min
|
||||||
#= require admin/autocomplete
|
#= require admin/autocomplete
|
||||||
|
|
|
@ -1,30 +1,29 @@
|
||||||
$(document).on 'page:change', ->
|
$('.selectize').selectize({
|
||||||
$('.selectize').selectize({
|
|
||||||
allowEmptyOption: true
|
allowEmptyOption: true
|
||||||
})
|
})
|
||||||
$('.selectize_create').selectize({
|
$('.selectize_create').selectize({
|
||||||
allowEmptyOption: true, create: true
|
allowEmptyOption: true, create: true
|
||||||
})
|
})
|
||||||
|
|
||||||
$('.js-datepicker').datepicker({
|
$('.js-datepicker').datepicker({
|
||||||
showAnim: "",
|
showAnim: "",
|
||||||
autoclose: true,
|
autoclose: true,
|
||||||
dateFormat: "dd.mm.yy",
|
dateFormat: "dd.mm.yy",
|
||||||
changeMonth: true,
|
changeMonth: true,
|
||||||
changeYear: true
|
changeYear: true
|
||||||
})
|
})
|
||||||
|
|
||||||
# client side validate all forms
|
# client side validate all forms
|
||||||
$('form').each ->
|
$('form').each ->
|
||||||
$(this).validate()
|
$(this).validate()
|
||||||
|
|
||||||
$('[data-toggle="popover"]').popover()
|
$('[data-toggle="popover"]').popover()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# doublescroll
|
# doublescroll
|
||||||
$('[data-doublescroll]').doubleScroll({
|
$('[data-doublescroll]').doubleScroll({
|
||||||
onlyIfScroll: false,
|
onlyIfScroll: false,
|
||||||
scrollCss:
|
scrollCss:
|
||||||
'overflow-x': 'auto'
|
'overflow-x': 'auto'
|
||||||
|
@ -33,9 +32,9 @@ $(document).on 'page:change', ->
|
||||||
'overflow-x': 'auto'
|
'overflow-x': 'auto'
|
||||||
'overflow-y': 'hidden'
|
'overflow-y': 'hidden'
|
||||||
resetOnWindowResize: true
|
resetOnWindowResize: true
|
||||||
})
|
})
|
||||||
|
|
||||||
positionSlider = ->
|
positionSlider = ->
|
||||||
for scroll in document.querySelectorAll('[data-doublescroll]')
|
for scroll in document.querySelectorAll('[data-doublescroll]')
|
||||||
wrapper = scroll.previousSibling
|
wrapper = scroll.previousSibling
|
||||||
if $(scroll).offset().top < $(window).scrollTop()
|
if $(scroll).offset().top < $(window).scrollTop()
|
||||||
|
@ -46,8 +45,7 @@ $(document).on 'page:change', ->
|
||||||
wrapper.style.top = '0'
|
wrapper.style.top = '0'
|
||||||
return
|
return
|
||||||
|
|
||||||
positionSlider()
|
positionSlider()
|
||||||
$(window).scroll(positionSlider).resize positionSlider
|
$(window).scroll(positionSlider).resize positionSlider
|
||||||
#due .report-table width: auto top scrollbar appears after resize so we do fake resize action
|
#due .report-table width: auto top scrollbar appears after resize so we do fake resize action
|
||||||
$(window).resize()
|
$(window).resize()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
class Admin::SessionsController < Devise::SessionsController
|
class Admin::SessionsController < Devise::SessionsController
|
||||||
skip_authorization_check only: :create
|
skip_authorization_check only: :create
|
||||||
layout 'admin/application'
|
|
||||||
|
|
||||||
def login
|
def login
|
||||||
@admin_user = AdminUser.new
|
@admin_user = AdminUser.new
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
class AdminController < ApplicationController
|
class AdminController < ApplicationController
|
||||||
layout 'admin/application'
|
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
|
||||||
helper_method :head_title_sufix
|
helper_method :head_title_sufix
|
||||||
|
|
44
app/views/admin/_menu.haml
Normal file
44
app/views/admin/_menu.haml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
.navbar-collapse.collapse
|
||||||
|
%ul.nav.navbar-nav
|
||||||
|
- if can? :show, Domain
|
||||||
|
%li= link_to t(:domains), admin_domains_path
|
||||||
|
- if can? :show, Contact
|
||||||
|
%li= link_to t(:contacts), admin_contacts_path
|
||||||
|
- if can? :show, Registrar
|
||||||
|
%li= link_to t(:registrars), admin_registrars_path
|
||||||
|
- if can? :show, Keyrelay
|
||||||
|
%li= link_to t(:keyrelays), admin_keyrelays_path
|
||||||
|
- if can?(:access, :settings_menu)
|
||||||
|
%li.dropdown
|
||||||
|
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
|
||||||
|
= t(:settings)
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu{role: "menu"}
|
||||||
|
%li.dropdown-header= t(:users)
|
||||||
|
%li= link_to t(:api_users), admin_api_users_path
|
||||||
|
%li= link_to t(:admin_users), admin_admin_users_path
|
||||||
|
%li.divider
|
||||||
|
%li.dropdown-header= t(:billing)
|
||||||
|
- if can? :view, Pricelist
|
||||||
|
%li= link_to t(:pricelists), admin_pricelists_path
|
||||||
|
%li= link_to t(:bank_statements), admin_bank_statements_path
|
||||||
|
%li= link_to t(:invoices), admin_invoices_path
|
||||||
|
%li= link_to t(:account_activities), admin_account_activities_path(created_after: 'today')
|
||||||
|
%li.divider
|
||||||
|
%li.dropdown-header= t(:archive)
|
||||||
|
%li= link_to t(:domains_history), admin_domain_versions_path
|
||||||
|
%li= link_to t(:contacts_history), admin_contact_versions_path
|
||||||
|
%li.divider
|
||||||
|
%li.dropdown-header= t(:system)
|
||||||
|
%li= link_to t(:settings), admin_settings_path
|
||||||
|
%li= link_to t(:zonefile), admin_zonefile_settings_path
|
||||||
|
%li= link_to t(:blocked_domains), admin_blocked_domains_path
|
||||||
|
%li= link_to t(:reserved_domains), admin_reserved_domains_path
|
||||||
|
%li= link_to t(:mail_templates), admin_mail_templates_path
|
||||||
|
%li= link_to t(:epp_logs), admin_epp_logs_path(created_after: 'today')
|
||||||
|
%li= link_to t(:repp_logs), admin_repp_logs_path(created_after: 'today')
|
||||||
|
%li= link_to t(:que), '/admin/que'
|
||||||
|
|
||||||
|
- if signed_in?
|
||||||
|
%ul.nav.navbar-nav.navbar-right
|
||||||
|
%li= link_to t(:log_out, user: current_user), '/admin/logout'
|
36
app/views/layouts/admin.haml
Normal file
36
app/views/layouts/admin.haml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
!!! 5
|
||||||
|
%html{lang: I18n.locale.to_s}
|
||||||
|
%head
|
||||||
|
%meta{charset: "utf-8"}/
|
||||||
|
%meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
|
||||||
|
- if content_for? :head_title
|
||||||
|
= yield :head_title
|
||||||
|
- else
|
||||||
|
%title= t(:admin_head_title)
|
||||||
|
= csrf_meta_tags
|
||||||
|
= stylesheet_link_tag 'admin-manifest', media: 'all'
|
||||||
|
= favicon_link_tag 'favicon.ico'
|
||||||
|
%body{:style => env_style}
|
||||||
|
.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 admin_dashboard_path, class: 'navbar-brand' do
|
||||||
|
= ENV['app_name']
|
||||||
|
- if unstable_env.present?
|
||||||
|
.text-center
|
||||||
|
%small{style: 'color: #0074B3;'}= unstable_env
|
||||||
|
|
||||||
|
= render 'menu'
|
||||||
|
.container
|
||||||
|
= render 'shared/flash'
|
||||||
|
= yield
|
||||||
|
|
||||||
|
.footer.text-right
|
||||||
|
Version
|
||||||
|
= CURRENT_COMMIT_HASH
|
||||||
|
= javascript_include_tag 'admin-manifest', async: true
|
|
@ -1,85 +0,0 @@
|
||||||
!!! 5
|
|
||||||
%html{lang: I18n.locale.to_s}
|
|
||||||
%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"}/
|
|
||||||
- if content_for? :head_title
|
|
||||||
= yield :head_title
|
|
||||||
- else
|
|
||||||
%title= t(:admin_head_title)
|
|
||||||
= csrf_meta_tags
|
|
||||||
= stylesheet_link_tag 'admin-manifest', media: 'all', 'data-turbolinks-track' => true
|
|
||||||
= javascript_include_tag 'admin-manifest', 'data-turbolinks-track' => true
|
|
||||||
= favicon_link_tag 'favicon.ico'
|
|
||||||
%body{:style => env_style}
|
|
||||||
/ 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 admin_dashboard_path, class: 'navbar-brand' do
|
|
||||||
= ENV['app_name']
|
|
||||||
- if unstable_env.present?
|
|
||||||
.text-center
|
|
||||||
%small{style: 'color: #0074B3;'}= unstable_env
|
|
||||||
|
|
||||||
.navbar-collapse.collapse
|
|
||||||
%ul.nav.navbar-nav
|
|
||||||
- if can? :show, Domain
|
|
||||||
%li= link_to t(:domains), admin_domains_path
|
|
||||||
- if can? :show, Contact
|
|
||||||
%li= link_to t(:contacts), admin_contacts_path
|
|
||||||
- if can? :show, Registrar
|
|
||||||
%li= link_to t(:registrars), admin_registrars_path
|
|
||||||
- if can? :show, Keyrelay
|
|
||||||
%li= link_to t(:keyrelays), admin_keyrelays_path
|
|
||||||
- if can?(:access, :settings_menu)
|
|
||||||
%li.dropdown
|
|
||||||
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
|
|
||||||
= t(:settings)
|
|
||||||
%span.caret
|
|
||||||
%ul.dropdown-menu{role: "menu"}
|
|
||||||
%li.dropdown-header= t(:users)
|
|
||||||
%li= link_to t(:api_users), admin_api_users_path
|
|
||||||
%li= link_to t(:admin_users), admin_admin_users_path
|
|
||||||
%li.divider
|
|
||||||
%li.dropdown-header= t(:billing)
|
|
||||||
- if can? :view, Pricelist
|
|
||||||
%li= link_to t(:pricelists), admin_pricelists_path
|
|
||||||
%li= link_to t(:bank_statements), admin_bank_statements_path
|
|
||||||
%li= link_to t(:invoices), admin_invoices_path
|
|
||||||
%li= link_to t(:account_activities), admin_account_activities_path(created_after: 'today')
|
|
||||||
%li.divider
|
|
||||||
%li.dropdown-header= t(:archive)
|
|
||||||
%li= link_to t(:domains_history), admin_domain_versions_path
|
|
||||||
%li= link_to t(:contacts_history), admin_contact_versions_path
|
|
||||||
%li.divider
|
|
||||||
%li.dropdown-header= t(:system)
|
|
||||||
%li= link_to t(:settings), admin_settings_path
|
|
||||||
%li= link_to t(:zonefile), admin_zonefile_settings_path
|
|
||||||
%li= link_to t(:blocked_domains), admin_blocked_domains_path
|
|
||||||
%li= link_to t(:reserved_domains), admin_reserved_domains_path
|
|
||||||
%li= link_to t(:mail_templates), admin_mail_templates_path
|
|
||||||
-# %li= link_to t(:domains_history), admin_domain_versions_path
|
|
||||||
%li= link_to t(:epp_logs), admin_epp_logs_path(created_after: 'today')
|
|
||||||
%li= link_to t(:repp_logs), admin_repp_logs_path(created_after: 'today')
|
|
||||||
%li= link_to t(:que), '/admin/que'
|
|
||||||
|
|
||||||
- if signed_in?
|
|
||||||
%ul.nav.navbar-nav.navbar-right
|
|
||||||
%li= link_to t(:log_out, user: current_user), '/admin/logout'
|
|
||||||
|
|
||||||
.container
|
|
||||||
= render 'shared/flash'
|
|
||||||
= yield
|
|
||||||
|
|
||||||
.footer.text-right
|
|
||||||
Version
|
|
||||||
= CURRENT_COMMIT_HASH
|
|
Loading…
Add table
Add a link
Reference in a new issue