diff --git a/Procfile b/Procfile index b31a2ae973..13df39cd13 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -release: bundle exec rake db:migrate +release: bundle exec rake db:migrate && bundle exec rake cache:clear web: rails s diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 44fefd5db1..317928efbf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -18,10 +18,12 @@ def title end end - def show_canonical_meta? - return true if params[:code_language].present? - return true if Rails.env.production? && request.base_url != 'https://developer.nexmo.com' - false + def active_sidenav_item + if params[:tutorial_name] + "/#{params[:product]}/tutorials/#{params[:tutorial_name]}" + else + request.path.chomp("/#{params[:code_language]}") + end end def canonical_path diff --git a/app/javascript/navigation/index.js b/app/javascript/navigation/index.js index 2b2eb5b868..8ad7b86f02 100644 --- a/app/javascript/navigation/index.js +++ b/app/javascript/navigation/index.js @@ -433,7 +433,13 @@ function toggleMobileNavBtn() { } } +function setActiveNavItem() { + const activeItem = $('nav.sidenav').data('active'); + $(`.Vlt-sidemenu__link[href="${activeItem}"]`).addClass('Vlt-sidemenu__link_active') +} + export default () => { + setActiveNavItem(); Volta.menu.init(); toggleMobileNavBtn(); } diff --git a/app/presenters/sidenav_subitem.rb b/app/presenters/sidenav_subitem.rb index 36a5bd644c..cfc5077b07 100644 --- a/app/presenters/sidenav_subitem.rb +++ b/app/presenters/sidenav_subitem.rb @@ -45,20 +45,4 @@ def controller :use_case end end - - def active? - if navigation == :tutorials - active_path.starts_with?(url) - else - url == active_path - end - end - - def active_path - @active_path ||= request_path.chomp("/#{code_language}") - end - - def link_css_class - active? ? 'Vlt-sidemenu__link_active' : '' - end end diff --git a/app/views/layouts/documentation.html.erb b/app/views/layouts/documentation.html.erb index 24fd937f98..f0c11ab02b 100644 --- a/app/views/layouts/documentation.html.erb +++ b/app/views/layouts/documentation.html.erb @@ -6,8 +6,10 @@ <%= render partial: 'layouts/partials/header' %>
-
diff --git a/app/views/layouts/partials/_sidenav_subitem.html.erb b/app/views/layouts/partials/_sidenav_subitem.html.erb index 3554788b91..583d756d56 100644 --- a/app/views/layouts/partials/_sidenav_subitem.html.erb +++ b/app/views/layouts/partials/_sidenav_subitem.html.erb @@ -1,6 +1,6 @@