Commit ac67ce85 authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray

Merge branch 'scrollable-secondary-tabs' into 'master'

Fixed inner page tabs not being scrollable

Closes #18853

See merge request !10204
parents 5906a256 28b8b92e
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
}); });
}; };
$(function() { $(document).on('init.scrolling-tabs', () => {
var $scrollingTabs = $('.scrolling-tabs'); const $scrollingTabs = $('.scrolling-tabs').not('.is-initialized');
$scrollingTabs.addClass('is-initialized');
hideEndFade($scrollingTabs); hideEndFade($scrollingTabs);
$(window).off('resize.nav').on('resize.nav', function() { $(window).off('resize.nav').on('resize.nav', function() {
......
...@@ -370,4 +370,6 @@ $(function () { ...@@ -370,4 +370,6 @@ $(function () {
new Aside(); new Aside();
gl.utils.initTimeagoTimeout(); gl.utils.initTimeagoTimeout();
$(document).trigger('init.scrolling-tabs');
}); });
...@@ -16,8 +16,12 @@ export default { ...@@ -16,8 +16,12 @@ export default {
}, },
}, },
mounted() {
$(document).trigger('init.scrolling-tabs');
},
template: ` template: `
<ul class="nav-links"> <ul class="nav-links scrolling-tabs">
<li <li
class="js-pipelines-tab-all" class="js-pipelines-tab-all"
:class="{ 'active': scope === 'all'}"> :class="{ 'active': scope === 'all'}">
......
...@@ -182,8 +182,14 @@ export default { ...@@ -182,8 +182,14 @@ export default {
<div :class="cssClass"> <div :class="cssClass">
<div <div
class="top-area" class="top-area scrolling-tabs-container inner-page-scroll-tabs"
v-if="!isLoading && !shouldRenderEmptyState"> v-if="!isLoading && !shouldRenderEmptyState">
<div class="fade-left">
<i class="fa fa-angle-left" aria-hidden="true"></i>
</div>
<div class="fade-right">
<i class="fa fa-angle-right" aria-hidden="true"></i>
</div>
<navigation-tabs <navigation-tabs
:scope="scope" :scope="scope"
:count="state.count" :count="state.count"
......
...@@ -476,3 +476,40 @@ ...@@ -476,3 +476,40 @@
} }
} }
} }
.inner-page-scroll-tabs {
position: relative;
.fade-right {
@include fade(left, $white-light);
right: 0;
text-align: right;
.fa {
right: 5px;
}
}
.fade-left {
@include fade(right, $white-light);
left: 0;
text-align: left;
.fa {
left: 5px;
}
}
.fade-right,
.fade-left {
top: 16px;
bottom: auto;
}
&.is-smaller {
.fade-right,
.fade-left {
top: 11px;
}
}
}
= content_for :flash_message do = content_for :flash_message do
= render 'shared/project_limit' = render 'shared/project_limit'
.top-area .top-area.scrolling-tabs-container.inner-page-scroll-tabs
%ul.nav-links .fade-left= icon('angle-left')
.fade-right= icon('angle-right')
%ul.nav-links.scrolling-tabs
= nav_link(page: [dashboard_projects_path, root_path]) do = nav_link(page: [dashboard_projects_path, root_path]) do
= link_to dashboard_projects_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do = link_to dashboard_projects_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do
Your projects Your projects
......
...@@ -52,8 +52,10 @@ ...@@ -52,8 +52,10 @@
= render 'award_emoji/awards_block', awardable: @merge_request, inline: true = render 'award_emoji/awards_block', awardable: @merge_request, inline: true
.merge-request-tabs-holder{ class: ("js-tabs-affix" unless ENV['RAILS_ENV'] == 'test') } .merge-request-tabs-holder{ class: ("js-tabs-affix" unless ENV['RAILS_ENV'] == 'test') }
.merge-request-tabs-container .merge-request-tabs-container.scrolling-tabs-container.inner-page-scroll-tabs
%ul.merge-request-tabs.nav-links.no-top.no-bottom .fade-left= icon('angle-left')
.fade-right= icon('angle-right')
%ul.merge-request-tabs.nav-links.scrolling-tabs
%li.notes-tab %li.notes-tab
= link_to namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: { target: 'div#notes', action: 'notes', toggle: 'tab' } do = link_to namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: { target: 'div#notes', action: 'notes', toggle: 'tab' } do
Discussion Discussion
......
%ul.nav-links.search-filter .scrolling-tabs-container.inner-page-scroll-tabs.is-smaller
- if @project .fade-left= icon('angle-left')
%li{ class: active_when(@scope == 'blobs') } .fade-right= icon('angle-right')
= link_to search_filter_path(scope: 'blobs') do %ul.nav-links.search-filter.scrolling-tabs
Code - if @project
%span.badge %li{ class: active_when(@scope == 'blobs') }
= @search_results.blobs_count = link_to search_filter_path(scope: 'blobs') do
%li{ class: active_when(@scope == 'issues') } Code
= link_to search_filter_path(scope: 'issues') do %span.badge
Issues = @search_results.blobs_count
%span.badge %li{ class: active_when(@scope == 'issues') }
= @search_results.issues_count = link_to search_filter_path(scope: 'issues') do
%li{ class: active_when(@scope == 'merge_requests') } Issues
= link_to search_filter_path(scope: 'merge_requests') do %span.badge
Merge requests = @search_results.issues_count
%span.badge %li{ class: active_when(@scope == 'merge_requests') }
= @search_results.merge_requests_count = link_to search_filter_path(scope: 'merge_requests') do
%li{ class: active_when(@scope == 'milestones') } Merge requests
= link_to search_filter_path(scope: 'milestones') do %span.badge
Milestones = @search_results.merge_requests_count
%span.badge %li{ class: active_when(@scope == 'milestones') }
= @search_results.milestones_count = link_to search_filter_path(scope: 'milestones') do
%li{ class: active_when(@scope == 'notes') } Milestones
= link_to search_filter_path(scope: 'notes') do %span.badge
Comments = @search_results.milestones_count
%span.badge %li{ class: active_when(@scope == 'notes') }
= @search_results.notes_count = link_to search_filter_path(scope: 'notes') do
%li{ class: active_when(@scope == 'wiki_blobs') } Comments
= link_to search_filter_path(scope: 'wiki_blobs') do %span.badge
Wiki = @search_results.notes_count
%span.badge %li{ class: active_when(@scope == 'wiki_blobs') }
= @search_results.wiki_blobs_count = link_to search_filter_path(scope: 'wiki_blobs') do
%li{ class: active_when(@scope == 'commits') } Wiki
= link_to search_filter_path(scope: 'commits') do %span.badge
Commits = @search_results.wiki_blobs_count
%span.badge %li{ class: active_when(@scope == 'commits') }
= @search_results.commits_count = link_to search_filter_path(scope: 'commits') do
Commits
%span.badge
= @search_results.commits_count
- elsif @show_snippets - elsif @show_snippets
%li{ class: active_when(@scope == 'snippet_blobs') } %li{ class: active_when(@scope == 'snippet_blobs') }
= link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do = link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do
Snippet Contents Snippet Contents
%span.badge %span.badge
= @search_results.snippet_blobs_count = @search_results.snippet_blobs_count
%li{ class: active_when(@scope == 'snippet_titles') } %li{ class: active_when(@scope == 'snippet_titles') }
= link_to search_filter_path(scope: 'snippet_titles', snippets: true, group_id: nil, project_id: nil) do = link_to search_filter_path(scope: 'snippet_titles', snippets: true, group_id: nil, project_id: nil) do
Titles and Filenames Titles and Filenames
%span.badge %span.badge
= @search_results.snippet_titles_count = @search_results.snippet_titles_count
- else - else
%li{ class: active_when(@scope == 'projects') } %li{ class: active_when(@scope == 'projects') }
= link_to search_filter_path(scope: 'projects') do = link_to search_filter_path(scope: 'projects') do
Projects Projects
%span.badge %span.badge
= @search_results.projects_count = @search_results.projects_count
%li{ class: active_when(@scope == 'issues') } %li{ class: active_when(@scope == 'issues') }
= link_to search_filter_path(scope: 'issues') do = link_to search_filter_path(scope: 'issues') do
Issues Issues
%span.badge %span.badge
= @search_results.issues_count = @search_results.issues_count
%li{ class: active_when(@scope == 'merge_requests') } %li{ class: active_when(@scope == 'merge_requests') }
= link_to search_filter_path(scope: 'merge_requests') do = link_to search_filter_path(scope: 'merge_requests') do
Merge requests Merge requests
%span.badge %span.badge
= @search_results.merge_requests_count = @search_results.merge_requests_count
%li{ class: active_when(@scope == 'milestones') } %li{ class: active_when(@scope == 'milestones') }
= link_to search_filter_path(scope: 'milestones') do = link_to search_filter_path(scope: 'milestones') do
Milestones Milestones
%span.badge %span.badge
= @search_results.milestones_count = @search_results.milestones_count
%ul.nav-links.no-top.no-bottom .scrolling-tabs-container.inner-page-scroll-tabs.is-smaller
- if milestone.is_a?(GlobalMilestone) || can?(current_user, :read_issue, @project) .fade-left= icon('angle-left')
%li.active .fade-right= icon('angle-right')
= link_to '#tab-issues', 'data-toggle' => 'tab', 'data-show' => '.tab-issues-buttons' do %ul.nav-links.scrolling-tabs
Issues - if milestone.is_a?(GlobalMilestone) || can?(current_user, :read_issue, @project)
%span.badge= milestone.issues_visible_to_user(current_user).size %li.active
= link_to '#tab-issues', 'data-toggle' => 'tab', 'data-show' => '.tab-issues-buttons' do
Issues
%span.badge= milestone.issues_visible_to_user(current_user).size
%li
= link_to '#tab-merge-requests', 'data-toggle' => 'tab', 'data-show' => '.tab-merge-requests-buttons' do
Merge Requests
%span.badge= milestone.merge_requests.size
- else
%li.active
= link_to '#tab-merge-requests', 'data-toggle' => 'tab', 'data-show' => '.tab-merge-requests-buttons' do
Merge Requests
%span.badge= milestone.merge_requests.size
%li %li
= link_to '#tab-merge-requests', 'data-toggle' => 'tab', 'data-show' => '.tab-merge-requests-buttons' do = link_to '#tab-participants', 'data-toggle' => 'tab' do
Merge Requests Participants
%span.badge= milestone.merge_requests.size %span.badge= milestone.participants.count
- else %li
%li.active = link_to '#tab-labels', 'data-toggle' => 'tab' do
= link_to '#tab-merge-requests', 'data-toggle' => 'tab', 'data-show' => '.tab-merge-requests-buttons' do Labels
Merge Requests %span.badge= milestone.labels.count
%span.badge= milestone.merge_requests.size
%li
= link_to '#tab-participants', 'data-toggle' => 'tab' do
Participants
%span.badge= milestone.participants.count
%li
= link_to '#tab-labels', 'data-toggle' => 'tab' do
Labels
%span.badge= milestone.labels.count
- show_project_name = local_assigns.fetch(:show_project_name, false) - show_project_name = local_assigns.fetch(:show_project_name, false)
- show_full_project_name = local_assigns.fetch(:show_full_project_name, false) - show_full_project_name = local_assigns.fetch(:show_full_project_name, false)
......
...@@ -79,22 +79,25 @@ ...@@ -79,22 +79,25 @@
%p.profile-user-bio %p.profile-user-bio
= @user.bio = @user.bio
%ul.nav-links.center.user-profile-nav .scrolling-tabs-container
%li.js-activity-tab .fade-left= icon('angle-left')
= link_to user_path, data: {target: 'div#activity', action: 'activity', toggle: 'tab'} do .fade-right= icon('angle-right')
Activity %ul.nav-links.center.user-profile-nav.scrolling-tabs
%li.js-groups-tab %li.js-activity-tab
= link_to user_groups_path, data: {target: 'div#groups', action: 'groups', toggle: 'tab'} do = link_to user_path, data: {target: 'div#activity', action: 'activity', toggle: 'tab'} do
Groups Activity
%li.js-contributed-tab %li.js-groups-tab
= link_to user_contributed_projects_path, data: {target: 'div#contributed', action: 'contributed', toggle: 'tab'} do = link_to user_groups_path, data: {target: 'div#groups', action: 'groups', toggle: 'tab'} do
Contributed projects Groups
%li.js-projects-tab %li.js-contributed-tab
= link_to user_projects_path, data: {target: 'div#projects', action: 'projects', toggle: 'tab'} do = link_to user_contributed_projects_path, data: {target: 'div#contributed', action: 'contributed', toggle: 'tab'} do
Personal projects Contributed projects
%li.js-snippets-tab %li.js-projects-tab
= link_to user_snippets_path, data: {target: 'div#snippets', action: 'snippets', toggle: 'tab'} do = link_to user_projects_path, data: {target: 'div#projects', action: 'projects', toggle: 'tab'} do
Snippets Personal projects
%li.js-snippets-tab
= link_to user_snippets_path, data: {target: 'div#snippets', action: 'snippets', toggle: 'tab'} do
Snippets
%div{ class: container_class } %div{ class: container_class }
- if @user == current_user && !show_user_callout? - if @user == current_user && !show_user_callout?
......
---
title: Fixed tabs not scrolling on mobile
merge_request:
author:
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