debian-mirror-gitlab/app/views/layouts/header/_new_dropdown.html.haml
2021-09-04 02:52:04 +05:30

27 lines
1.5 KiB
Text

- view_model = new_dropdown_view_model(project: @project, group: @group)
- menu_sections = view_model.fetch(:menu_sections)
- title = view_model.fetch(:title)
- show_headers = menu_sections.length > 1
- top_class = local_assigns.fetch(:class, nil)
- return if menu_sections.empty?
%li.header-new.dropdown{ class: top_class, data: { track_label: "new_dropdown", track_event: "click_dropdown", track_experiment: "new_repo" } }
= link_to new_project_path, class: "header-new-dropdown-toggle has-tooltip", id: "js-onboarding-new-project-link", title: title, ref: 'tooltip', aria: { label: title }, data: { toggle: 'dropdown', placement: 'bottom', container: 'body', display: 'static', qa_selector: 'new_menu_toggle' } do
= sprite_icon('plus-square')
= sprite_icon('chevron-down', css_class: 'caret-down')
.dropdown-menu.dropdown-menu-right.dropdown-extended-height
%ul
- menu_sections.each_with_index do |section, index|
- if index > 0
%li.divider
- if show_headers
%li.dropdown-bold-header
= section.fetch(:title)
- section.fetch(:menu_items).each do |menu_item|
%li<
= link_to menu_item.fetch(:href), class: menu_item.fetch(:css_class), data: menu_item.fetch(:data) do
= menu_item.fetch(:title)
- if menu_item.fetch(:emoji)
-# We need to insert a space between the title and emoji
= " #{emoji_icon(menu_item.fetch(:emoji), 'aria-hidden': true, class: "gl-font-base gl-vertical-align-baseline")}".html_safe