add badge with role in user dropdown in header
This commit is contained in:
parent
d094f8da4e
commit
dfc09648d8
2 changed files with 9 additions and 4 deletions
|
@ -1,6 +1,12 @@
|
|||
module ReleaseNotesHelper
|
||||
def announce_category_badge(category)
|
||||
color_class = case category.to_sym
|
||||
color_class = color_by_role(category)
|
||||
|
||||
content_tag(:span, ReleaseNote.human_attribute_name("categories.#{category}"), class: "fr-badge #{color_class}")
|
||||
end
|
||||
|
||||
def color_by_role(role)
|
||||
case role.to_sym
|
||||
when :administrateur
|
||||
'fr-badge--blue-cumulus'
|
||||
when :instructeur
|
||||
|
@ -12,8 +18,6 @@ module ReleaseNotesHelper
|
|||
when :api
|
||||
'fr-badge--pink-macaron'
|
||||
end
|
||||
|
||||
content_tag(:span, ReleaseNote.human_attribute_name("categories.#{category}"), class: "fr-badge #{color_class}")
|
||||
end
|
||||
|
||||
def infer_default_announce_categories
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
%nav.fr-translate.fr-nav{ role: "navigation", "aria-label"=> t('menu_aria_label', scope: [:layouts]) }
|
||||
.fr-nav__item
|
||||
%button.account-btn.fr-translate__btn.fr-btn{ "aria-controls" => "account", "aria-expanded" => "false", :title => t('my_account', scope: [:layouts]) }
|
||||
|
||||
%div{ class: "fr-badge fr-badge--sm fr-mr-1w #{color_by_role(nav_bar_profile)}"}
|
||||
= t("layouts.#{nav_bar_profile}")
|
||||
= " #{current_email}"
|
||||
#account.fr-collapse.fr-menu
|
||||
%ul.fr-menu__list.max-content
|
||||
|
|
Loading…
Reference in a new issue