Commit 9b586af3 authored by Denys Mishunov's avatar Denys Mishunov

Merge branch '230748-tabs-haml-migrate-app-views-shared-issuable-_nav-html-haml' into 'master'

Migrate issues and epics Bootstrap tabs to GlTabs

See merge request gitlab-org/gitlab!71175
parents 308f2a98 07c2a861
...@@ -198,7 +198,7 @@ module IssuablesHelper ...@@ -198,7 +198,7 @@ module IssuablesHelper
if count != -1 if count != -1
html << " " << content_tag(:span, html << " " << content_tag(:span,
format_count(issuable_type, count, Gitlab::IssuablesCountForState::THRESHOLD), format_count(issuable_type, count, Gitlab::IssuablesCountForState::THRESHOLD),
class: 'badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm' class: 'badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex'
) )
end end
......
...@@ -2,22 +2,16 @@ ...@@ -2,22 +2,16 @@
- page_context_word = type.to_s.humanize(capitalize: false) - page_context_word = type.to_s.humanize(capitalize: false)
- display_count = local_assigns.fetch(:display_count, true) - display_count = local_assigns.fetch(:display_count, true)
%ul.nav-links.issues-state-filters.mobile-separator.nav.nav-tabs = gl_tabs_nav({ class: 'issues-state-filters gl-border-b-0 gl-flex-grow-1' }) do
%li{ class: active_when(params[:state] == 'opened') }> = gl_tab_link_to page_filter_path(state: 'opened'), { item_active: params[:state] == 'opened', id: 'state-opened', title: _("Filter by %{page_context_word} that are currently open.") % { page_context_word: page_context_word }, data: { state: 'opened' } } do
= link_to page_filter_path(state: 'opened'), id: 'state-opened', title: _("Filter by %{page_context_word} that are currently open.") % { page_context_word: page_context_word }, data: { state: 'opened' } do #{issuables_state_counter_text(type, :opened, display_count)}
#{issuables_state_counter_text(type, :opened, display_count)}
- if type == :merge_requests - if type == :merge_requests
%li{ class: active_when(params[:state] == 'merged') }> = gl_tab_link_to page_filter_path(state: 'merged'), item_active: params[:state] == 'merged', id: 'state-merged', title: _('Filter by merge requests that are currently merged.'), data: { state: 'merged' } do
= link_to page_filter_path(state: 'merged'), id: 'state-merged', title: _('Filter by merge requests that are currently merged.'), data: { state: 'merged' } do #{issuables_state_counter_text(type, :merged, display_count)}
#{issuables_state_counter_text(type, :merged, display_count)} = gl_tab_link_to page_filter_path(state: 'closed'), item_active: params[:state] == 'closed', id: 'state-closed', title: _('Filter by merge requests that are currently closed and unmerged.'), data: { state: 'closed' } do
#{issuables_state_counter_text(type, :closed, display_count)}
%li{ class: active_when(params[:state] == 'closed') }>
= link_to page_filter_path(state: 'closed'), id: 'state-closed', title: _('Filter by merge requests that are currently closed and unmerged.'), data: { state: 'closed' } do
#{issuables_state_counter_text(type, :closed, display_count)}
- else - else
%li{ class: active_when(params[:state] == 'closed') }> = gl_tab_link_to page_filter_path(state: 'closed'), item_active: params[:state] == 'closed', id: 'state-closed', title: _('Filter by issues that are currently closed.'), data: { state: 'closed', qa_selector: 'closed_issues_link' } do
= link_to page_filter_path(state: 'closed'), id: 'state-closed', title: _('Filter by issues that are currently closed.'), data: { state: 'closed', qa_selector: 'closed_issues_link' } do #{issuables_state_counter_text(type, :closed, display_count)}
#{issuables_state_counter_text(type, :closed, display_count)}
= render 'shared/issuable/nav_links/all', page_context_word: page_context_word, counter: issuables_state_counter_text(type, :all, display_count) = render 'shared/issuable/nav_links/all', page_context_word: page_context_word, counter: issuables_state_counter_text(type, :all, display_count)
- page_context_word = local_assigns.fetch(:page_context_word) - page_context_word = local_assigns.fetch(:page_context_word)
- counter = local_assigns.fetch(:counter) - counter = local_assigns.fetch(:counter)
%li{ class: active_when(params[:state] == 'all') }> = gl_tab_link_to page_filter_path(state: 'all'), item_active: params[:state] == 'all', id: 'state-all', title: _("Show all %{issuable_type}.") % { issuable_type: page_context_word }, data: { state: 'all' } do
= link_to page_filter_path(state: 'all'), id: 'state-all', title: "Show all #{page_context_word}.", data: { state: 'all' } do #{counter}
#{counter}
...@@ -2,13 +2,10 @@ ...@@ -2,13 +2,10 @@
- page_context_word = type.to_s.humanize(capitalize: false) - page_context_word = type.to_s.humanize(capitalize: false)
- display_count = local_assigns.fetch(:display_count, true) - display_count = local_assigns.fetch(:display_count, true)
%ul.nav-links.mobile-separator.epics-state-filters = gl_tabs_nav({ class: 'epics-state-filters gl-border-b-0 gl-flex-grow-1' }) do
%li{ class: active_when(params[:state] == 'opened') }> = gl_tab_link_to page_filter_path(state: 'opened'), item_active: params[:state] == 'opened', id: 'state-opened', title: (_("Filter by %{issuable_type} that are currently open.") % { issuable_type: page_context_word }), data: { state: 'opened' } do
= link_to page_filter_path(state: 'opened'), id: 'state-opened', title: (_("Filter by %{issuable_type} that are currently open.") % { issuable_type: page_context_word }), data: { state: 'opened' } do #{issuables_state_counter_text(type, :opened, display_count)}
#{issuables_state_counter_text(type, :opened, display_count)} = gl_tab_link_to page_filter_path(state: 'closed'), item_active: params[:state] == 'closed', id: 'state-closed', title: (_("Filter by %{issuable_type} that are currently closed.") % { issuable_type: page_context_word }), data: { state: 'closed' } do
#{issuables_state_counter_text(type, :closed, display_count)}
%li{ class: active_when(params[:state] == 'closed') }>
= link_to page_filter_path(state: 'closed'), id: 'state-closed', title: (_("Filter by %{issuable_type} that are currently closed.") % { issuable_type: page_context_word }), data: { state: 'closed' } do
#{issuables_state_counter_text(type, :closed, display_count)}
= render 'shared/issuable/nav_links/all', page_context_word: page_context_word, counter: issuables_state_counter_text(type, :all, display_count) = render 'shared/issuable/nav_links/all', page_context_word: page_context_word, counter: issuables_state_counter_text(type, :all, display_count)
...@@ -31258,6 +31258,9 @@ msgstr "" ...@@ -31258,6 +31258,9 @@ msgstr ""
msgid "Show Pipeline IID" msgid "Show Pipeline IID"
msgstr "" msgstr ""
msgid "Show all %{issuable_type}."
msgstr ""
msgid "Show all activity" msgid "Show all activity"
msgstr "" msgstr ""
......
...@@ -55,7 +55,7 @@ RSpec.describe 'Navigation bar counter', :use_clean_rails_memory_store_caching d ...@@ -55,7 +55,7 @@ RSpec.describe 'Navigation bar counter', :use_clean_rails_memory_store_caching d
end end
def expect_counters(issuable_type, count) def expect_counters(issuable_type, count)
dashboard_count = find('.nav-links li.active') dashboard_count = find('.gl-tabs-nav li a.active')
nav_count = find(".dashboard-shortcuts-#{issuable_type}") nav_count = find(".dashboard-shortcuts-#{issuable_type}")
header_count = find(".header-content .#{issuable_type.tr('_', '-')}-count") header_count = find(".header-content .#{issuable_type.tr('_', '-')}-count")
......
...@@ -133,13 +133,13 @@ RSpec.describe IssuablesHelper do ...@@ -133,13 +133,13 @@ RSpec.describe IssuablesHelper do
it 'returns navigation with badges' do it 'returns navigation with badges' do
expect(helper.issuables_state_counter_text(:issues, :opened, true)) expect(helper.issuables_state_counter_text(:issues, :opened, true))
.to eq('<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm">42</span>') .to eq('<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex">42</span>')
expect(helper.issuables_state_counter_text(:issues, :closed, true)) expect(helper.issuables_state_counter_text(:issues, :closed, true))
.to eq('<span>Closed</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm">42</span>') .to eq('<span>Closed</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex">42</span>')
expect(helper.issuables_state_counter_text(:merge_requests, :merged, true)) expect(helper.issuables_state_counter_text(:merge_requests, :merged, true))
.to eq('<span>Merged</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm">42</span>') .to eq('<span>Merged</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex">42</span>')
expect(helper.issuables_state_counter_text(:merge_requests, :all, true)) expect(helper.issuables_state_counter_text(:merge_requests, :all, true))
.to eq('<span>All</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm">42</span>') .to eq('<span>All</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex">42</span>')
end end
end end
...@@ -176,7 +176,7 @@ RSpec.describe IssuablesHelper do ...@@ -176,7 +176,7 @@ RSpec.describe IssuablesHelper do
it 'returns complete count' do it 'returns complete count' do
expect(helper.issuables_state_counter_text(:issues, :opened, true)) expect(helper.issuables_state_counter_text(:issues, :opened, true))
.to eq('<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm">1,100</span>') .to eq('<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex">1,100</span>')
end end
end end
...@@ -187,7 +187,7 @@ RSpec.describe IssuablesHelper do ...@@ -187,7 +187,7 @@ RSpec.describe IssuablesHelper do
it 'returns truncated count' do it 'returns truncated count' do
expect(helper.issuables_state_counter_text(:issues, :opened, true)) expect(helper.issuables_state_counter_text(:issues, :opened, true))
.to eq('<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm">1.1k</span>') .to eq('<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm gl-display-none gl-sm-display-inline-flex">1.1k</span>')
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment