From 8e8bf882d83b9617fc330b570a7ca5fed87ff97f Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 6 Apr 2017 23:41:28 +0300 Subject: [PATCH] Extract navbar partial from registrar area layout --- app/views/layouts/registrar/base.haml | 29 +-------------------------- app/views/registrar/base/_navbar.haml | 28 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 app/views/registrar/base/_navbar.haml diff --git a/app/views/layouts/registrar/base.haml b/app/views/layouts/registrar/base.haml index df936bbee..a2add9f20 100644 --- a/app/views/layouts/registrar/base.haml +++ b/app/views/layouts/registrar/base.haml @@ -30,34 +30,7 @@ .text-center %small{style: 'color: #0074B3;'}= unstable_env - if current_user - .navbar-collapse.collapse - %ul.nav.navbar-nav.public-nav - - if can? :view, Depp::Domain - - active_class = %w(registrar/domains registrar/check registrar/renew registrar/tranfer registrar/keyrelays).include?(params[:controller]) ? 'active' :nil - %li{class: active_class}= link_to t(:domains), registrar_domains_path - - - if can? :view, Depp::Contact - - active_class = ['registrar/contacts'].include?(params[:controller]) ? 'active' :nil - %li{class: active_class}= link_to t(:contacts), registrar_contacts_path - - - if can? :show, Invoice - - active_class = ['registrar/invoices'].include?(params[:controller]) ? 'active' :nil - %li{class: active_class}= link_to t(:billing), registrar_invoices_path - - - if !Rails.env.production? && can?(:manage, :xml_console) - - active_class = ['registrar/xml_consoles'].include?(params[:controller]) ? 'active' :nil - %li{class: active_class}= link_to t(:xml_console), registrar_xml_console_path - - %ul.nav.navbar-nav.navbar-right - %li.dropdown - %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"} - = "#{current_user} (#{current_user.roles.first}) - #{current_user.registrar}" - %span.caret - %ul.dropdown-menu{role: "menu"} - - ApiUser.all_by_identity_code(current_user.identity_code).each do |x| - %li= link_to "#{x} (#{x.roles.first}) - #{x.registrar}", "/registrar/switch_user/#{x.id}" - - if user_signed_in? - %li= link_to t(:log_out_), '/registrar/logout' + = render 'navbar' .container = render 'shared/flash' diff --git a/app/views/registrar/base/_navbar.haml b/app/views/registrar/base/_navbar.haml new file mode 100644 index 000000000..608fb9cb4 --- /dev/null +++ b/app/views/registrar/base/_navbar.haml @@ -0,0 +1,28 @@ +.navbar-collapse.collapse + %ul.nav.navbar-nav.public-nav + - if can? :view, Depp::Domain + - active_class = %w(registrar/domains registrar/check registrar/renew registrar/tranfer registrar/keyrelays).include?(params[:controller]) ? 'active' :nil + %li{class: active_class}= link_to t(:domains), registrar_domains_path + + - if can? :view, Depp::Contact + - active_class = ['registrar/contacts'].include?(params[:controller]) ? 'active' :nil + %li{class: active_class}= link_to t(:contacts), registrar_contacts_path + + - if can? :show, Invoice + - active_class = ['registrar/invoices'].include?(params[:controller]) ? 'active' :nil + %li{class: active_class}= link_to t(:billing), registrar_invoices_path + + - if !Rails.env.production? && can?(:manage, :xml_console) + - active_class = ['registrar/xml_consoles'].include?(params[:controller]) ? 'active' :nil + %li{class: active_class}= link_to t(:xml_console), registrar_xml_console_path + + %ul.nav.navbar-nav.navbar-right + %li.dropdown + %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"} + = "#{current_user} (#{current_user.roles.first}) - #{current_user.registrar}" + %span.caret + %ul.dropdown-menu{role: "menu"} + - ApiUser.all_by_identity_code(current_user.identity_code).each do |x| + %li= link_to "#{x} (#{x.roles.first}) - #{x.registrar}", "/registrar/switch_user/#{x.id}" + - if user_signed_in? + %li= link_to t(:log_out_), '/registrar/logout'