summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Rose <samrose3@gmail.com>2017-04-07 13:26:39 +0000
committerJacob Schatz <jschatz@gitlab.com>2017-04-07 13:26:39 +0000
commitd6e39d8a4cafe275d4c4d46048bf6403e5068e82 (patch)
tree400fad153e0b51311043d980c54e73a2a2a185df
parentfb85537a0acffda0d8c13c4bf90c369982e63c6f (diff)
downloadgitlab-ce-d6e39d8a4cafe275d4c4d46048bf6403e5068e82.tar.gz
MR shortcuts counter for stable
-rw-r--r--app/assets/javascripts/header.js15
-rw-r--r--app/assets/stylesheets/framework/header.scss70
-rw-r--r--app/assets/stylesheets/framework/variables.scss3
-rw-r--r--app/assets/stylesheets/pages/todos.scss20
-rw-r--r--app/views/layouts/header/_default.html.haml33
-rw-r--r--app/views/shared/icons/_mr_bold.svg1
-rw-r--r--changelogs/unreleased/29866-navbar-counters.yml4
-rw-r--r--features/steps/dashboard/todos.rb6
-rw-r--r--spec/features/issues/todo_spec.rb8
-rw-r--r--spec/features/todos/todos_spec.rb6
-rw-r--r--spec/javascripts/header_spec.js14
11 files changed, 108 insertions, 72 deletions
diff --git a/app/assets/javascripts/header.js b/app/assets/javascripts/header.js
index a853c3aeb1f..dc170c60456 100644
--- a/app/assets/javascripts/header.js
+++ b/app/assets/javascripts/header.js
@@ -1,8 +1,7 @@
-/* eslint-disable wrap-iife, func-names, space-before-function-paren, prefer-arrow-callback, no-var, max-len */
-(function() {
- $(document).on('todo:toggle', function(e, count) {
- var $todoPendingCount = $('.todos-pending-count');
- $todoPendingCount.text(gl.text.highCountTrim(count));
- $todoPendingCount.toggleClass('hidden', count === 0);
- });
-})();
+/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var */
+
+$(document).on('todo:toggle', function(e, count) {
+ var $todoPendingCount = $('.todos-count');
+ $todoPendingCount.text(gl.text.highCountTrim(count));
+ $todoPendingCount.toggleClass('hidden', count === 0);
+});
diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss
index 5d1aba4e529..e07f18eaa30 100644
--- a/app/assets/stylesheets/framework/header.scss
+++ b/app/assets/stylesheets/framework/header.scss
@@ -48,10 +48,10 @@ header {
color: $gl-text-color-secondary;
font-size: 18px;
padding: 0;
- margin: ($header-height - 28) / 2 0;
+ margin: (($header-height - 28) / 2) 3px;
margin-left: 8px;
height: 28px;
- min-width: 28px;
+ min-width: 32px;
line-height: 28px;
text-align: center;
@@ -73,21 +73,29 @@ header {
background-color: $gray-light;
color: $gl-text-color;
- .todos-pending-count {
- background: darken($todo-alert-blue, 10%);
+ svg {
+ fill: $gl-text-color;
}
}
.fa-caret-down {
font-size: 14px;
}
+
+ svg {
+ position: relative;
+ top: 2px;
+ height: 17px;
+ // hack to get SVG to line up with FA icons
+ width: 23px;
+ fill: $gl-text-color-secondary;
+ }
}
.navbar-toggle {
color: $nav-toggle-gray;
- margin: 6px 0;
+ margin: 5px 0;
border-radius: 0;
- position: absolute;
right: -10px;
padding: 6px 10px;
@@ -135,14 +143,12 @@ header {
}
.header-content {
+ display: flex;
+ justify-content: space-between;
position: relative;
height: $header-height;
padding-left: 30px;
- @media (min-width: $screen-sm-min) {
- padding-right: 0;
- }
-
.dropdown-menu {
margin-top: -5px;
}
@@ -164,6 +170,12 @@ header {
}
}
+ .title-container {
+ display: inline-block;
+ flex: 1 1 auto;
+ overflow: hidden;
+ }
+
.title {
position: relative;
padding-right: 20px;
@@ -227,10 +239,7 @@ header {
.navbar-collapse {
float: right;
border-top: none;
-
- @media (min-width: $screen-md-min) {
- padding: 0;
- }
+ padding: 0;
@media (max-width: $screen-xs-max) {
float: none;
@@ -255,6 +264,34 @@ header {
}
}
+.navbar-nav {
+ li {
+ .badge {
+ position: inherit;
+ top: -3px;
+ font-weight: normal;
+ margin-left: -12px;
+ font-size: 11px;
+ color: $white-light;
+ padding: 1px 5px 2px;
+ border-radius: 7px;
+ box-shadow: 0 1px 0 rgba($gl-header-color, .2);
+
+ &.issues-count {
+ background-color: $green-500;
+ }
+
+ &.merge-requests-count {
+ background-color: $orange-600;
+ }
+
+ &.todos-count {
+ background-color: $blue-500;
+ }
+ }
+ }
+}
+
@media (max-width: $screen-xs-max) {
header .container-fluid {
font-size: 18px;
@@ -268,14 +305,13 @@ header {
}
.navbar-collapse {
- padding-left: 5px;
-
.nav > li:not(.hidden-xs) {
display: table-cell!important;
width: 25%;
a {
- margin-right: 8px;
+ margin-right: 0;
+ margin-left: 0;
}
}
}
diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss
index 6841adb637e..7e68cd52ec2 100644
--- a/app/assets/stylesheets/framework/variables.scss
+++ b/app/assets/stylesheets/framework/variables.scss
@@ -29,10 +29,12 @@ $gray-darkest: #c4c4c4;
$green-light: #3cbd70;
$green-normal: darken($green-light, $darken-normal-factor);
$green-dark: darken($green-light, $darken-dark-factor);
+$green-500: #1aaa55;
$blue-light: #2ea8e5;
$blue-normal: darken($blue-light, $darken-normal-factor);
$blue-dark: darken($blue-light, $darken-dark-factor);
+$blue-500: #1f78d1;
$blue-medium-light: #3498cb;
$blue-medium: darken($blue-medium-light, $darken-normal-factor);
@@ -43,6 +45,7 @@ $blue-light-transparent: rgba(44, 159, 216, 0.05);
$orange-light: #fc8a51;
$orange-normal: darken($orange-light, $darken-normal-factor);
$orange-dark: darken($orange-light, $darken-dark-factor);
+$orange-600: #de7e00;
$red-light: #e52c5a;
$red-normal: darken($red-light, $darken-normal-factor);
diff --git a/app/assets/stylesheets/pages/todos.scss b/app/assets/stylesheets/pages/todos.scss
index 5f0aede4f5e..45307802411 100644
--- a/app/assets/stylesheets/pages/todos.scss
+++ b/app/assets/stylesheets/pages/todos.scss
@@ -2,26 +2,6 @@
* Dashboard Todos
*
*/
-
-.navbar-nav {
- li {
- .badge.todos-pending-count {
- position: inherit;
- top: -6px;
- margin-top: -5px;
- font-weight: normal;
- background: $todo-alert-blue;
- margin-left: -17px;
- font-size: 11px;
- color: $white-light;
- padding: 3px;
- padding-top: 1px;
- padding-bottom: 1px;
- border-radius: 3px;
- }
- }
-}
-
.todos-list > .todo {
// workaround because we cannot use border-colapse
border-top: 1px solid transparent;
diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml
index f4ab7392be8..8ac2bf273d2 100644
--- a/app/views/layouts/header/_default.html.haml
+++ b/app/views/layouts/header/_default.html.haml
@@ -11,9 +11,13 @@
= render 'layouts/nav/dashboard'
- else
= render 'layouts/nav/explore'
- %button.navbar-toggle{ type: 'button' }
- %span.sr-only Toggle navigation
- = icon('ellipsis-v')
+
+ .header-logo
+ = link_to root_path, class: 'home', title: 'Dashboard', id: 'logo' do
+ = brand_header_logo
+
+ .title-container
+ %h1.title= title
.navbar-collapse.collapse
%ul.nav.navbar-nav
@@ -41,9 +45,19 @@
data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
= icon('tachometer fw')
%li
- = link_to dashboard_todos_path, title: 'Todos', aria: { label: "Todos" }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
- = icon('bell fw')
- %span.badge.todos-pending-count{ class: ("hidden" if todos_pending_count == 0) }
+ = link_to assigned_issues_dashboard_path, title: 'Issues', aria: { label: "Issues" }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
+ = icon('hashtag fw')
+ %span.badge.issues-count
+ = number_with_delimiter(cached_assigned_issuables_count(current_user, :issues, :opened))
+ %li
+ = link_to assigned_mrs_dashboard_path, title: 'Merge requests', aria: { label: "Merge requests" }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
+ = custom_icon('mr_bold')
+ %span.badge.merge-requests-count
+ = number_with_delimiter(cached_assigned_issuables_count(current_user, :merge_requests, :opened))
+ %li
+ = link_to dashboard_todos_path, title: 'Todos', aria: { label: "Todos" }, class: 'shortcuts-todos', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
+ = icon('check-circle fw')
+ %span.badge.todos-count
= todos_count_format(todos_pending_count)
%li.header-user.dropdown
= link_to current_user, class: "header-user-dropdown-toggle", data: { toggle: "dropdown" } do
@@ -63,11 +77,10 @@
%div
= link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-success'
- .header-logo
- = link_to root_path, class: 'home', title: 'Dashboard', id: 'logo' do
- = brand_header_logo
- %h1.title= title
+ %button.navbar-toggle{ type: 'button' }
+ %span.sr-only Toggle navigation
+ = icon('ellipsis-v')
= yield :header_content
diff --git a/app/views/shared/icons/_mr_bold.svg b/app/views/shared/icons/_mr_bold.svg
new file mode 100644
index 00000000000..2daa55a8652
--- /dev/null
+++ b/app/views/shared/icons/_mr_bold.svg
@@ -0,0 +1 @@
+<svg width="15" height="20" viewBox="0 0 12 14" xmlns="http://www.w3.org/2000/svg"><path d="M1 4.967a2.15 2.15 0 1 1 2.3 0v5.066a2.15 2.15 0 1 1-2.3 0V4.967zm7.85 5.17V5.496c0-.745-.603-1.346-1.35-1.346V6l-3-3 3-3v1.85c2.016 0 3.65 1.63 3.65 3.646v4.45a2.15 2.15 0 1 1-2.3.191z" fill-rule="nonzero"/></svg>
diff --git a/changelogs/unreleased/29866-navbar-counters.yml b/changelogs/unreleased/29866-navbar-counters.yml
new file mode 100644
index 00000000000..c67dff6cffa
--- /dev/null
+++ b/changelogs/unreleased/29866-navbar-counters.yml
@@ -0,0 +1,4 @@
+---
+title: Add shortcuts and counters to MRs and issues in navbar
+merge_request:
+author:
diff --git a/features/steps/dashboard/todos.rb b/features/steps/dashboard/todos.rb
index eb906a55a83..a447f3ff00d 100644
--- a/features/steps/dashboard/todos.rb
+++ b/features/steps/dashboard/todos.rb
@@ -28,7 +28,7 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
merge_request_reference = merge_request.to_reference(full: true)
issue_reference = issue.to_reference(full: true)
- page.within('.todos-pending-count') { expect(page).to have_content '4' }
+ page.within('.todos-count') { expect(page).to have_content '4' }
expect(page).to have_content 'To do 4'
expect(page).to have_content 'Done 0'
@@ -44,7 +44,7 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
click_link 'Done'
end
- page.within('.todos-pending-count') { expect(page).to have_content '3' }
+ page.within('.todos-count') { expect(page).to have_content '3' }
expect(page).to have_content 'To do 3'
expect(page).to have_content 'Done 1'
should_see_todo(1, "John Doe assigned you merge request #{merge_request.to_reference(full: true)}", merge_request.title, state: :done_reversible)
@@ -56,7 +56,7 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
click_link 'Mark all as done'
- page.within('.todos-pending-count') { expect(page).to have_content '0' }
+ page.within('.todos-count') { expect(page).to have_content '0' }
expect(page).to have_content 'To do 0'
expect(page).to have_content 'Done 4'
expect(page).to have_content "You're all done!"
diff --git a/spec/features/issues/todo_spec.rb b/spec/features/issues/todo_spec.rb
index 41ff31d2b99..3fde85b0a5c 100644
--- a/spec/features/issues/todo_spec.rb
+++ b/spec/features/issues/todo_spec.rb
@@ -17,13 +17,13 @@ feature 'Manually create a todo item from issue', feature: true, js: true do
expect(page).to have_content 'Mark done'
end
- page.within '.header-content .todos-pending-count' do
+ page.within '.header-content .todos-count' do
expect(page).to have_content '1'
end
visit namespace_project_issue_path(project.namespace, project, issue)
- page.within '.header-content .todos-pending-count' do
+ page.within '.header-content .todos-count' do
expect(page).to have_content '1'
end
end
@@ -34,10 +34,10 @@ feature 'Manually create a todo item from issue', feature: true, js: true do
click_button 'Mark done'
end
- expect(page).to have_selector('.todos-pending-count', visible: false)
+ expect(page).to have_selector('.todos-count', visible: false)
visit namespace_project_issue_path(project.namespace, project, issue)
- expect(page).to have_selector('.todos-pending-count', visible: false)
+ expect(page).to have_selector('.todos-count', visible: false)
end
end
diff --git a/spec/features/todos/todos_spec.rb b/spec/features/todos/todos_spec.rb
index 3495091a0d5..4763f7b27d3 100644
--- a/spec/features/todos/todos_spec.rb
+++ b/spec/features/todos/todos_spec.rb
@@ -164,7 +164,7 @@ describe 'Dashboard Todos', feature: true do
end
it 'shows "All done" message' do
- within('.todos-pending-count') { expect(page).to have_content '0' }
+ within('.todos-count') { expect(page).to have_content '0' }
expect(page).to have_content 'To do 0'
expect(page).to have_content 'Done 0'
expect(page).to have_selector('.todos-all-done', count: 1)
@@ -180,7 +180,7 @@ describe 'Dashboard Todos', feature: true do
end
it 'shows 99+ for count >= 100 in notification' do
- expect(page).to have_selector('.todos-pending-count', text: '99+')
+ expect(page).to have_selector('.todos-count', text: '99+')
end
it 'shows exact number in To do tab' do
@@ -190,7 +190,7 @@ describe 'Dashboard Todos', feature: true do
it 'shows exact number for count < 100' do
3.times { first('.js-done-todo').click }
- expect(page).to have_selector('.todos-pending-count', text: '98')
+ expect(page).to have_selector('.todos-count', text: '98')
end
end
diff --git a/spec/javascripts/header_spec.js b/spec/javascripts/header_spec.js
index 46a27b8c98f..b5dde5525e5 100644
--- a/spec/javascripts/header_spec.js
+++ b/spec/javascripts/header_spec.js
@@ -5,7 +5,7 @@ require('~/lib/utils/text_utility');
(function() {
describe('Header', function() {
- var todosPendingCount = '.todos-pending-count';
+ var todosPendingCount = '.todos-count';
var fixtureTemplate = 'issues/open-issue.html.raw';
function isTodosCountHidden() {
@@ -21,31 +21,31 @@ require('~/lib/utils/text_utility');
loadFixtures(fixtureTemplate);
});
- it('should update todos-pending-count after receiving the todo:toggle event', function() {
+ it('should update todos-count after receiving the todo:toggle event', function() {
triggerToggle(5);
expect($(todosPendingCount).text()).toEqual('5');
});
- it('should hide todos-pending-count when it is 0', function() {
+ it('should hide todos-count when it is 0', function() {
triggerToggle(0);
expect(isTodosCountHidden()).toEqual(true);
});
- it('should show todos-pending-count when it is more than 0', function() {
+ it('should show todos-count when it is more than 0', function() {
triggerToggle(10);
expect(isTodosCountHidden()).toEqual(false);
});
- describe('when todos-pending-count is 1000', function() {
+ describe('when todos-count is 1000', function() {
beforeEach(function() {
triggerToggle(1000);
});
- it('should show todos-pending-count', function() {
+ it('should show todos-count', function() {
expect(isTodosCountHidden()).toEqual(false);
});
- it('should show 99+ for todos-pending-count', function() {
+ it('should show 99+ for todos-count', function() {
expect($(todosPendingCount).text()).toEqual('99+');
});
});