summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2017-08-07 12:24:52 -0500
committerAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2017-08-07 12:24:52 -0500
commit625b0bcfba0a3cb1bf4f4a0d5f224c958e73239c (patch)
tree8fe159a8e2ebc56eb2ae765d4a7763abf16dc1c9 /app
parentb12107a0b953b566cd58db30ae880800a4a695a6 (diff)
downloadgitlab-ce-625b0bcfba0a3cb1bf4f4a0d5f224c958e73239c.tar.gz
Remove JS flicker on page load; UI tweaks
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/new_sidebar.js6
-rw-r--r--app/assets/stylesheets/new_sidebar.scss1
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/helpers/nav_helper.rb1
-rw-r--r--app/views/layouts/nav/_new_project_sidebar.html.haml4
5 files changed, 12 insertions, 4 deletions
diff --git a/app/assets/javascripts/new_sidebar.js b/app/assets/javascripts/new_sidebar.js
index 3a3e6b14ec4..930218dd1f5 100644
--- a/app/assets/javascripts/new_sidebar.js
+++ b/app/assets/javascripts/new_sidebar.js
@@ -45,8 +45,10 @@ export default class NewNavSidebar {
toggleCollapsedSidebar(collapsed) {
this.$sidebar.toggleClass('sidebar-icons-only', collapsed);
- this.$page.toggleClass('page-with-new-sidebar', !collapsed);
- this.$page.toggleClass('page-with-icon-sidebar', collapsed);
+ if (this.$sidebar.length) {
+ this.$page.toggleClass('page-with-new-sidebar', !collapsed);
+ this.$page.toggleClass('page-with-icon-sidebar', collapsed);
+ }
NewNavSidebar.setCollapsedCookie(collapsed);
}
diff --git a/app/assets/stylesheets/new_sidebar.scss b/app/assets/stylesheets/new_sidebar.scss
index 10c9c97df0e..30029a94d9d 100644
--- a/app/assets/stylesheets/new_sidebar.scss
+++ b/app/assets/stylesheets/new_sidebar.scss
@@ -400,6 +400,7 @@ $new-sidebar-collapsed-width: 50px;
.toggle-sidebar-button {
width: $new-sidebar-collapsed-width - 2px;
+ padding: 16px 18px;
.collapse-text,
.fa-angle-double-left {
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 14dc9bd9d62..0cfd7822d05 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -305,4 +305,8 @@ module ApplicationHelper
def show_new_nav?
cookies["new_nav"] == "true"
end
+
+ def collapsed_sidebar?
+ cookies["sidebar_collapsed"] == "true"
+ end
end
diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb
index b1205b8529b..e0f1948ce20 100644
--- a/app/helpers/nav_helper.rb
+++ b/app/helpers/nav_helper.rb
@@ -2,6 +2,7 @@ module NavHelper
def page_with_sidebar_class
class_name = page_gutter_class
class_name << 'page-with-new-sidebar' if defined?(@new_sidebar) && @new_sidebar
+ class_name << 'page-with-icon-sidebar' if collapsed_sidebar?
class_name
end
diff --git a/app/views/layouts/nav/_new_project_sidebar.html.haml b/app/views/layouts/nav/_new_project_sidebar.html.haml
index 4b7209fa69e..df8dfe0c2f7 100644
--- a/app/views/layouts/nav/_new_project_sidebar.html.haml
+++ b/app/views/layouts/nav/_new_project_sidebar.html.haml
@@ -1,4 +1,4 @@
-.nav-sidebar
+.nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) }
- can_edit = can?(current_user, :admin_project, @project)
.context-header
= link_to project_path(@project), title: @project.name do
@@ -219,7 +219,7 @@
= link_to project_settings_members_path(@project), title: 'Members', class: 'shortcuts-tree' do
.nav-icon-container
= custom_icon('members')
- %span
+ %span.nav-item-name
Members
= render 'shared/sidebar_toggle_button'