Merge branch 'user-avatar-header' into 'master'

Added user avatar to header

## What does this MR do?

Adds  the users avatar to the header with a dropdown for profile & sign out.

## What are the relevant issue numbers?

Closes #18543 

## Screenshots (if relevant)

![Screen_Shot_2016-06-27_at_12.47.34](/uploads/852d0eb7075eefcf21f5cf5ff71a389a/Screen_Shot_2016-06-27_at_12.47.34.png)

![Screen_Shot_2016-06-27_at_12.47.36](/uploads/6cb29843d3a12bbf2d3ed2a7c9bde770/Screen_Shot_2016-06-27_at_12.47.36.png)

See merge request !4939
This commit is contained in:
Dmitriy Zaporozhets 2016-07-04 18:51:12 +00:00
commit c6bfad2a67
6 changed files with 42 additions and 20 deletions

View file

@ -20,7 +20,8 @@
} }
.open { .open {
.dropdown-menu { .dropdown-menu,
.dropdown-menu-nav {
display: block; display: block;
} }
@ -66,7 +67,8 @@
} }
} }
.dropdown-menu { .dropdown-menu,
.dropdown-menu-nav {
display: none; display: none;
position: absolute; position: absolute;
top: 100%; top: 100%;
@ -77,7 +79,7 @@
margin-bottom: 0; margin-bottom: 0;
font-size: 15px; font-size: 15px;
font-weight: normal; font-weight: normal;
padding: 10px 0; padding: 8px 0;
background-color: $dropdown-bg; background-color: $dropdown-bg;
border: 1px solid $dropdown-border-color; border: 1px solid $dropdown-border-color;
border-radius: $border-radius-base; border-radius: $border-radius-base;
@ -101,12 +103,12 @@
li { li {
text-align: left; text-align: left;
list-style: none; list-style: none;
padding: 0 10px; padding: 0 8px;
} }
.divider { .divider {
height: 1px; height: 1px;
margin: 8px 10px; margin: 8px;
padding: 0; padding: 0;
background-color: $dropdown-divider-color; background-color: $dropdown-divider-color;
} }
@ -122,7 +124,7 @@
a { a {
display: block; display: block;
position: relative; position: relative;
padding: 5px 10px; padding: 5px 8px;
color: $dropdown-link-color; color: $dropdown-link-color;
line-height: initial; line-height: initial;
text-overflow: ellipsis; text-overflow: ellipsis;

View file

@ -60,7 +60,7 @@ header {
margin: ($header-height - 28) / 2 0; margin: ($header-height - 28) / 2 0;
margin-left: 10px; margin-left: 10px;
height: 28px; height: 28px;
width: 28px; min-width: 28px;
line-height: 28px; line-height: 28px;
text-align: center; text-align: center;
@ -241,14 +241,23 @@ header {
.navbar-collapse { .navbar-collapse {
padding-left: 5px; padding-left: 5px;
li { .nav > li {
display: table-cell; display: table-cell;
width: 1%; width: 1%;
a {
margin-left: 8px !important;
}
} }
} }
} }
} }
.header-user {
.dropdown-menu-nav {
width: 140px;
margin-top: -5px;
}
}
.header-user-avatar {
float: left;
margin-right: 5px;
border-radius: 50%;
}

View file

@ -38,9 +38,17 @@
= link_to sherlock_transactions_path, title: 'Sherlock Transactions', = link_to sherlock_transactions_path, title: 'Sherlock Transactions',
data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
= icon('tachometer fw') = icon('tachometer fw')
%li %li.header-user.dropdown
= link_to destroy_user_session_path, class: 'logout', method: :delete, title: 'Sign out', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do = link_to current_user, class: "header-user-dropdown-toggle", data: { toggle: "dropdown" } do
= icon('sign-out') = image_tag avatar_icon(current_user, 26), width: 26, height: 26, class: "header-user-avatar"
%span.caret
.dropdown-menu-nav.dropdown-menu-align-right
%ul
%li
= link_to "Profile", current_user
%li.divider
%li
= link_to "Sign out", destroy_user_session_path, method: :delete, class: "sign-out-link", title: 'Sign out'
- else - else
%li %li
%div %div

View file

@ -219,8 +219,8 @@ Feature: Project Issues
When I click button "Unsubscribe" When I click button "Unsubscribe"
Then I should see that I am unsubscribed Then I should see that I am unsubscribed
@javascript
Scenario: I submit new unassigned issue as guest Scenario: I submit new unassigned issue as guest
Given I logout
Given public project "Community" Given public project "Community"
When I visit project "Community" page When I visit project "Community" page
And I visit project "Community" issues page And I visit project "Community" issues page

View file

@ -73,13 +73,15 @@ Feature: Search
Scenario: I logout and should see project I am looking for Scenario: I logout and should see project I am looking for
Given project "Shop" is public Given project "Shop" is public
And I logout And I logout directly
And I visit dashboard search page
And I search for "Sho" And I search for "Sho"
Then I should see "Shop" project link Then I should see "Shop" project link
Scenario: I logout and should see issues I am looking for Scenario: I logout and should see issues I am looking for
Given project "Shop" is public Given project "Shop" is public
And I logout And I logout directly
And I visit dashboard search page
And project has issues And project has issues
When I search for "Foo" When I search for "Foo"
And I click "Issues" link And I click "Issues" link
@ -88,7 +90,7 @@ Feature: Search
Scenario: I logout and should see project code I am looking for Scenario: I logout and should see project code I am looking for
Given project "Shop" is public Given project "Shop" is public
And I logout And I logout directly
When I visit project "Shop" page When I visit project "Shop" page
And I search for "rspec" on project page And I search for "rspec" on project page
Then I should see code results for project "Shop" Then I should see code results for project "Shop"

View file

@ -39,7 +39,8 @@ module LoginHelpers
# Requires Javascript driver. # Requires Javascript driver.
def logout def logout
find(:css, ".fa.fa-sign-out").click find(".header-user-dropdown-toggle").click
click_link "Sign out"
end end
# Logout without JavaScript driver # Logout without JavaScript driver