Skip to content

Commit

Permalink
fix topbar
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Jul 23, 2024
1 parent 2cf85f0 commit 1076beb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions app/helpers/auth_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ def language_selector
languages = languages.select { |e| I18n.available_locales.include? e.second }
options_for_select(languages, I18n.locale)
end

def active_locale
I18n.locale if I18n.locale != I18n.default_locale
end
end
3 changes: 1 addition & 2 deletions app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ def last_updated_at
end

def path
locale = I18n.locale == I18n.default_locale ? nil : I18n.locale
Rails.application.routes.url_helpers.person_path(self, locale: locale)
Rails.application.routes.url_helpers.person_path(self, locale: helpers.active_locale)
end

private
Expand Down
8 changes: 4 additions & 4 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@
%div.puzzle-header
%div.d-flex.h-100
%ul.navbar.h-100
%li.bg-skills-blue.h-100.d-flex.align-items-center{class: "#{'highlighted' if @first_path == people_path}"}
%li.bg-skills-blue.h-100.d-flex.align-items-center{class: "#{'highlighted' if @first_path == people_path(locale: nil)}"}
%a.nav-link.cursor-pointer.ps-2.pe-2{href: people_path}
= ti("navbar.profile")
%li.bg-skills-blue.h-100.d-flex.align-items-center{class: "#{'highlighted' if @first_path == people_skills_path}"}
%li.bg-skills-blue.h-100.d-flex.align-items-center{class: "#{'highlighted' if @first_path == people_skills_path(locale: nil)}"}
%a.nav-link.cursor-pointer.ps-2.pe-2{href: people_skills_path}
= ti("navbar.skill_search")
%li.bg-skills-blue.h-100.d-flex.align-items-center{class: "#{'highlighted' if @first_path == cv_search_index_path}"}
%li.bg-skills-blue.h-100.d-flex.align-items-center{class: "#{'highlighted' if @first_path == cv_search_index_path(locale: nil)}"}
%a.nav-link.cursor-pointer.ps-2.pe-2{href: cv_search_index_path}
= ti("navbar.cv_search")
%li.bg-skills-blue.h-100.d-flex.align-items-center{class: "#{'highlighted' if @first_path == skills_path}"}
%li.bg-skills-blue.h-100.d-flex.align-items-center{class: "#{'highlighted' if @first_path == skills_path(locale: nil)}"}
%a.nav-link.cursor-pointer.ps-2.pe-2{href: skills_path}
= ti("navbar.skillset")
%div.container-fluid
Expand Down

0 comments on commit 1076beb

Please sign in to comment.