Commit 4b4cda85 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch '17339-mobile-navigation' into 'master'

Mobile navigation fade out

Closes #17339     
Closes #17610  

<img src="/uploads/e382dd363bf8beb28339fa6b152be092/Screen_Shot_2016-05-18_at_10.16.59_AM.png" width="400px">


See merge request !4195
parents 41624600 ec6d456b
class @LayoutNav
$ ->
$('.fade-left').addClass('end-scroll')
$('.scrolling-tabs').on 'scroll', (event) ->
$this = $(this)
$el = $(event.target)
currentPosition = $this.scrollLeft()
size = bp.getBreakpointSize()
controlBtnWidth = $('.controls').width()
maxPosition = $this.get(0).scrollWidth - $this.parent().width()
maxPosition += controlBtnWidth if size isnt 'xs' and $('.nav-control').length
$el.find('.fade-left').toggleClass('end-scroll', currentPosition is 0)
$el.find('.fade-right').toggleClass('end-scroll', currentPosition is maxPosition)
@mixin fade($gradient-direction, $rgba, $gradient-color) {
visibility: visible;
opacity: 1;
position: absolute;
bottom: 12px;
width: 43px;
height: 30px;
transition-duration: .3s;
-webkit-transform: translateZ(0);
background: -webkit-linear-gradient($gradient-direction, $rgba, $gradient-color 45%);
background: -o-linear-gradient($gradient-direction, $rgba, $gradient-color 45%);
background: -moz-linear-gradient($gradient-direction, $rgba, $gradient-color 45%);
background: linear-gradient($gradient-direction, $rgba, $gradient-color 45%);
&.end-scroll {
visibility: hidden;
opacity: 0;
transition-duration: .3s;
}
}
@mixin scrolling-links() {
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
&::-webkit-scrollbar {
display: none;
}
}
.nav-links { .nav-links {
padding: 0; padding: 0;
margin: 0; margin: 0;
...@@ -209,13 +240,8 @@ ...@@ -209,13 +240,8 @@
float: right; float: right;
padding: 7px 0 0; padding: 7px 0 0;
@media (max-width: $screen-xs-min) { @media (max-width: $screen-xs-max) {
float: none; display: none;
padding: 0 9px;
.dropdown-new {
width: 100%;
}
} }
i { i {
...@@ -246,14 +272,18 @@ ...@@ -246,14 +272,18 @@
} }
.nav-links { .nav-links {
@include scrolling-links();
border-bottom: none; border-bottom: none;
height: 51px; height: 51px;
white-space: nowrap;
overflow-x: auto; .fade-right {
overflow-y: hidden; @include fade(left, rgba(250, 250, 250, 0.4), $background-color);
-webkit-overflow-scrolling: touch; right: 0;
&::-webkit-scrollbar { }
display: none;
.fade-left {
@include fade(right, rgba(250, 250, 250, 0.4), $background-color);
left: 0;
} }
li { li {
...@@ -278,16 +308,39 @@ ...@@ -278,16 +308,39 @@
} }
} }
.nav-control {
.fade-right {
@media (min-width: $screen-xs-max) {
right: 67px;
}
@media (max-width: $screen-xs-min) {
right: 0;
}
}
}
} }
.page-with-layout-nav { .nav-block {
margin-top: $header-height + 2; position: relative;
&.controls-dropdown-visible { .nav-links {
@media (max-width: $screen-xs-min) { @include scrolling-links();
margin-top: 96px;
.fade-right {
@include fade(left, rgba(255, 255, 255, 0.4), $white-light);
right: 0;
}
.fade-left {
@include fade(right, rgba(255, 255, 255, 0.4), $white-light);
left: 0;
} }
} }
}
.page-with-layout-nav {
margin-top: $header-height + 2;
.right-sidebar { .right-sidebar {
top: ($header-height * 2) + 2; top: ($header-height * 2) + 2;
......
...@@ -324,7 +324,7 @@ ...@@ -324,7 +324,7 @@
.layout-nav { .layout-nav {
@media (max-width: $screen-xs-min) { @media (max-width: $screen-xs-min) {
padding-right: 0;; padding-right: 0;
} }
@media (min-width: $screen-xs-min) and (max-width: $screen-md-min) { @media (min-width: $screen-xs-min) and (max-width: $screen-md-min) {
......
...@@ -48,7 +48,7 @@ module NavHelper ...@@ -48,7 +48,7 @@ module NavHelper
"page-with-layout-nav" if defined?(nav) && nav "page-with-layout-nav" if defined?(nav) && nav
end end
def layout_dropdown_class def nav_control_class
"controls-dropdown-visible" if current_user "nav-control" if current_user
end end
end end
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
.layout-nav .layout-nav
.container-fluid .container-fluid
= render "layouts/nav/#{nav}" = render "layouts/nav/#{nav}"
.content-wrapper{ class: "#{layout_nav_class} #{layout_dropdown_class}" } .content-wrapper{ class: "#{layout_nav_class}" }
= render "layouts/broadcast" = render "layouts/broadcast"
= render "layouts/flash" = render "layouts/flash"
= yield :flash_message = yield :flash_message
......
= render 'layouts/nav/group_settings' %div{ class: nav_control_class }
= render 'layouts/nav/group_settings'
%ul.nav-links %ul.nav-links.scrolling-tabs
= nav_link(path: 'groups#show', html_options: {class: 'home'}) do .fade-left
= link_to group_path(@group), title: 'Home' do = nav_link(path: 'groups#show', html_options: {class: 'home'}) do
= icon('group fw') = link_to group_path(@group), title: 'Home' do
%span = icon('group fw')
Group %span
= nav_link(path: 'groups#activity') do Group
= link_to activity_group_path(@group), title: 'Activity' do = nav_link(path: 'groups#activity') do
= icon('dashboard fw') = link_to activity_group_path(@group), title: 'Activity' do
%span = icon('dashboard fw')
Activity %span
= nav_link(controller: [:group, :milestones]) do Activity
= link_to group_milestones_path(@group), title: 'Milestones' do = nav_link(controller: [:group, :milestones]) do
= icon('clock-o fw') = link_to group_milestones_path(@group), title: 'Milestones' do
%span = icon('clock-o fw')
Milestones %span
= nav_link(path: 'groups#issues') do Milestones
= link_to issues_group_path(@group), title: 'Issues' do = nav_link(path: 'groups#issues') do
= icon('exclamation-circle fw') = link_to issues_group_path(@group), title: 'Issues' do
%span = icon('exclamation-circle fw')
Issues %span
- issues = IssuesFinder.new(current_user, group_id: @group.id, state: 'opened').execute Issues
%span.badge.count= number_with_delimiter(issues.count) - issues = IssuesFinder.new(current_user, group_id: @group.id, state: 'opened').execute
= nav_link(path: 'groups#merge_requests') do %span.badge.count= number_with_delimiter(issues.count)
= link_to merge_requests_group_path(@group), title: 'Merge Requests' do = nav_link(path: 'groups#merge_requests') do
= icon('tasks fw') = link_to merge_requests_group_path(@group), title: 'Merge Requests' do
%span = icon('tasks fw')
Merge Requests %span
- merge_requests = MergeRequestsFinder.new(current_user, group_id: @group.id, state: 'opened').execute Merge Requests
%span.badge.count= number_with_delimiter(merge_requests.count) - merge_requests = MergeRequestsFinder.new(current_user, group_id: @group.id, state: 'opened').execute
= nav_link(controller: [:group_members]) do %span.badge.count= number_with_delimiter(merge_requests.count)
= link_to group_group_members_path(@group), title: 'Members' do = nav_link(controller: [:group_members]) do
= icon('users fw') = link_to group_group_members_path(@group), title: 'Members' do
%span = icon('users fw')
Members %span
Members
.fade-right
%ul.nav-links %ul.nav-links.scrolling-tabs
.fade-left
= nav_link(path: 'profiles#show', html_options: {class: 'home'}) do = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
= link_to profile_path, title: 'Profile Settings' do = link_to profile_path, title: 'Profile Settings' do
= icon('user fw') = icon('user fw')
...@@ -47,3 +48,4 @@ ...@@ -47,3 +48,4 @@
= icon('history fw') = icon('history fw')
%span %span
Audit Log Audit Log
.fade-right
...@@ -19,113 +19,117 @@ ...@@ -19,113 +19,117 @@
data: { confirm: leave_project_message(@project) }, method: :delete, title: 'Leave project' do data: { confirm: leave_project_message(@project) }, method: :delete, title: 'Leave project' do
Leave Project Leave Project
%ul.nav-links %div{ class: nav_control_class }
= nav_link(path: 'projects#show', html_options: {class: 'home'}) do %ul.nav-links.scrolling-tabs
= link_to project_path(@project), title: 'Project', class: 'shortcuts-project' do .fade-left
= icon('bookmark fw') = nav_link(path: 'projects#show', html_options: {class: 'home'}) do
%span = link_to project_path(@project), title: 'Project', class: 'shortcuts-project' do
Project = icon('bookmark fw')
= nav_link(path: 'projects#activity') do
= link_to activity_project_path(@project), title: 'Activity', class: 'shortcuts-project-activity' do
= icon('dashboard fw')
%span
Activity
- if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree find_file)) do
= link_to project_files_path(@project), title: 'Files', class: 'shortcuts-tree' do
= icon('files-o fw')
%span %span
Files Project
= nav_link(path: 'projects#activity') do
- if project_nav_tab? :commits = link_to activity_project_path(@project), title: 'Activity', class: 'shortcuts-project-activity' do
= nav_link(controller: %w(commit commits compare repositories tags branches releases network)) do = icon('dashboard fw')
= link_to project_commits_path(@project), title: 'Commits', class: 'shortcuts-commits' do
= icon('history fw')
%span %span
Commits Activity
- if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree find_file)) do
= link_to project_files_path(@project), title: 'Files', class: 'shortcuts-tree' do
= icon('files-o fw')
%span
Files
- if project_nav_tab? :pipelines - if project_nav_tab? :commits
= nav_link(controller: :pipelines) do = nav_link(controller: %w(commit commits compare repositories tags branches releases network)) do
= link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do = link_to project_commits_path(@project), title: 'Commits', class: 'shortcuts-commits' do
= icon('ship fw') = icon('history fw')
%span %span
Pipelines Commits
%span.badge.count.ci_counter= number_with_delimiter(@project.ci_commits.running_or_pending.count)
- if project_nav_tab? :builds - if project_nav_tab? :pipelines
= nav_link(controller: %w(builds)) do = nav_link(controller: :pipelines) do
= link_to project_builds_path(@project), title: 'Builds', class: 'shortcuts-builds' do = link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do
= icon('cubes fw') = icon('ship fw')
%span %span
Builds Pipelines
%span.badge.count.builds_counter= number_with_delimiter(@project.builds.running_or_pending.count(:all)) %span.badge.count.ci_counter= number_with_delimiter(@project.ci_commits.running_or_pending.count)
- if project_nav_tab? :container_registry - if project_nav_tab? :builds
= nav_link(controller: %w(container_registry)) do = nav_link(controller: %w(builds)) do
= link_to project_container_registry_path(@project), title: 'Container Registry', class: 'shortcuts-container-registry' do = link_to project_builds_path(@project), title: 'Builds', class: 'shortcuts-builds' do
= icon('hdd-o fw') = icon('cubes fw')
%span %span
Container Registry Builds
%span.badge.count.builds_counter= number_with_delimiter(@project.builds.running_or_pending.count(:all))
- if project_nav_tab? :graphs - if project_nav_tab? :container_registry
= nav_link(controller: %w(graphs)) do = nav_link(controller: %w(container_registry)) do
= link_to namespace_project_graph_path(@project.namespace, @project, current_ref), title: 'Graphs', class: 'shortcuts-graphs' do = link_to project_container_registry_path(@project), title: 'Container Registry', class: 'shortcuts-container-registry' do
= icon('area-chart fw') = icon('hdd-o fw')
%span %span
Graphs Container Registry
- if project_nav_tab? :milestones - if project_nav_tab? :graphs
= nav_link(controller: :milestones) do = nav_link(controller: %w(graphs)) do
= link_to namespace_project_milestones_path(@project.namespace, @project), title: 'Milestones' do = link_to namespace_project_graph_path(@project.namespace, @project, current_ref), title: 'Graphs', class: 'shortcuts-graphs' do
= icon('clock-o fw') = icon('area-chart fw')
%span %span
Milestones Graphs
- if project_nav_tab? :issues - if project_nav_tab? :milestones
= nav_link(controller: :issues) do = nav_link(controller: :milestones) do
= link_to url_for_project_issues(@project, only_path: true), title: 'Issues', class: 'shortcuts-issues' do = link_to namespace_project_milestones_path(@project.namespace, @project), title: 'Milestones' do
= icon('exclamation-circle fw') = icon('clock-o fw')
%span %span
Issues Milestones
- if @project.default_issues_tracker?
%span.badge.count.issue_counter= number_with_delimiter(@project.issues.visible_to_user(current_user).opened.count)
- if project_nav_tab? :merge_requests - if project_nav_tab? :issues
= nav_link(controller: :merge_requests) do = nav_link(controller: :issues) do
= link_to namespace_project_merge_requests_path(@project.namespace, @project), title: 'Merge Requests', class: 'shortcuts-merge_requests' do = link_to url_for_project_issues(@project, only_path: true), title: 'Issues', class: 'shortcuts-issues' do
= icon('tasks fw') = icon('exclamation-circle fw')
%span %span
Merge Requests Issues
%span.badge.count.merge_counter= number_with_delimiter(@project.merge_requests.opened.count) - if @project.default_issues_tracker?
%span.badge.count.issue_counter= number_with_delimiter(@project.issues.visible_to_user(current_user).opened.count)
- if project_nav_tab? :labels - if project_nav_tab? :merge_requests
= nav_link(controller: :labels) do = nav_link(controller: :merge_requests) do
= link_to namespace_project_labels_path(@project.namespace, @project), title: 'Labels' do = link_to namespace_project_merge_requests_path(@project.namespace, @project), title: 'Merge Requests', class: 'shortcuts-merge_requests' do
= icon('tags fw') = icon('tasks fw')
%span %span
Labels Merge Requests
%span.badge.count.merge_counter= number_with_delimiter(@project.merge_requests.opened.count)
- if project_nav_tab? :wiki - if project_nav_tab? :labels
= nav_link(controller: :wikis) do = nav_link(controller: :labels) do
= link_to get_project_wiki_path(@project), title: 'Wiki', class: 'shortcuts-wiki' do = link_to namespace_project_labels_path(@project.namespace, @project), title: 'Labels' do
= icon('book fw') = icon('tags fw')
%span %span
Wiki Labels
- if project_nav_tab? :snippets - if project_nav_tab? :wiki
= nav_link(controller: :snippets) do = nav_link(controller: :wikis) do
= link_to namespace_project_snippets_path(@project.namespace, @project), title: 'Snippets', class: 'shortcuts-snippets' do = link_to get_project_wiki_path(@project), title: 'Wiki', class: 'shortcuts-wiki' do
= icon('clipboard fw') = icon('book fw')
%span %span
Snippets Wiki
- if project_nav_tab? :snippets
= nav_link(controller: :snippets) do
= link_to namespace_project_snippets_path(@project.namespace, @project), title: 'Snippets', class: 'shortcuts-snippets' do
= icon('clipboard fw')
%span
Snippets
-# Global shortcut to network page for compatibility
- if project_nav_tab? :network
%li.hidden
= link_to namespace_project_network_path(@project.namespace, @project, current_ref), title: 'Network', class: 'shortcuts-network' do
Network
-# Global shortcut to network page for compatibility -# Shortcut to create a new issue
- if project_nav_tab? :network
%li.hidden %li.hidden
= link_to namespace_project_network_path(@project.namespace, @project, current_ref), title: 'Network', class: 'shortcuts-network' do = link_to new_namespace_project_issue_path(@project.namespace, @project), class: 'shortcuts-new-issue' do
Network Create a new issue
-# Shortcut to create a new issue .fade-right
%li.hidden
= link_to new_namespace_project_issue_path(@project.namespace, @project), class: 'shortcuts-new-issue' do
Create a new issue
%ul.nav-links.event-filter %ul.nav-links.event-filter.scrolling-tabs
.fade-left
= event_filter_link EventFilter.push, 'Push events' = event_filter_link EventFilter.push, 'Push events'
= event_filter_link EventFilter.merged, 'Merge events' = event_filter_link EventFilter.merged, 'Merge events'
= event_filter_link EventFilter.comments, 'Comments' = event_filter_link EventFilter.comments, 'Comments'
= event_filter_link EventFilter.team, 'Team' = event_filter_link EventFilter.team, 'Team'
.fade-right
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