-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use tabbar partial for main navbar and improve tabbar
- Loading branch information
1 parent
6ce72b3
commit 09eb388
Showing
9 changed files
with
44 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
module TabHelper | ||
LOCALE_REGEX = /(\/(?:#{I18n.available_locales.join('|')}))/ | ||
GLOBAL_NAVBAR_REGEX = /^#{LOCALE_REGEX}?(\/[^\/]+)(?:\/|$)/ | ||
PERSON_NAVBAR_REGEX = /^(.*)/ | ||
|
||
def person_tabs(person) | ||
[ | ||
{ title: 'CV', path: person_path(person) }, | ||
{ title: 'Skills', path: person_people_skills_path(person) } | ||
] | ||
end | ||
|
||
def global_tabs | ||
[ | ||
{ title: ti('navbar.profile'), path: people_path }, | ||
{ title: ti('navbar.skill_search'), path: people_skills_path }, | ||
{ title: ti('navbar.cv_search'), path: cv_search_index_path }, | ||
{ title: ti('navbar.skillset'), path: skills_path } | ||
] | ||
end | ||
|
||
def extract_path(regex) | ||
request.path.match(regex)&.captures&.join | ||
end | ||
|
||
def global_navbar_path | ||
extract_path(GLOBAL_NAVBAR_REGEX) | ||
end | ||
|
||
def person_navbar_path | ||
extract_path(PERSON_NAVBAR_REGEX) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
%ul.nav.nav-tabs.d-flex.flex-row.mt-2.justify-content-between.mb-3 | ||
%div.d-flex.flex-row{"data-controller": "profile-tab"} | ||
%div.d-flex.flex-row.justify-content-between{class: "#{bar_class}"} | ||
%div.d-flex.flex-row | ||
- tabs.each do |tab| | ||
= link_to tab[:path], class: "btn text-primary p-0", "data-action": "click->profile-tab#setCurrentTab" do | ||
%div.nav-link{ "data-profile-tab-target": "tab"} | ||
= link_to tab[:path], class: "btn text-primary p-0 d-flex align-items-center" do | ||
%div{class: "nav-link h-100 d-flex align-items-center #{'active' if active_path == tab[:path]}"} | ||
= tab[:title] | ||
%div | ||
= yield | ||
= yield if defined?(do_yield) && do_yield|| false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters