Commit 540da508ffca41633b65b6172b0ad54dec345c0c

Authored by Dmitriy Zaporozhets
2 parents 2f82035f 973066e7

Merge pull request #6267 from robertd/feature-groups-on-profile-screen

Show avatars of groups on profile screen that user belongs to
app/assets/javascripts/profile.js.coffee
@@ -26,3 +26,5 @@ $ -> @@ -26,3 +26,5 @@ $ ->
26 form = $(this).closest("form") 26 form = $(this).closest("form")
27 filename = $(this).val().replace(/^.*[\\\/]/, '') 27 filename = $(this).val().replace(/^.*[\\\/]/, '')
28 form.find(".js-avatar-filename").text(filename) 28 form.find(".js-avatar-filename").text(filename)
  29 +
  30 + $('.profile-groups-avatars').tooltip("placement": "top")
29 \ No newline at end of file 31 \ No newline at end of file
app/assets/stylesheets/sections/profile.scss
@@ -105,3 +105,12 @@ @@ -105,3 +105,12 @@
105 } 105 }
106 } 106 }
107 } 107 }
  108 +
  109 +.profile-groups-avatars {
  110 + margin: 0 5px 10px 0;
  111 +
  112 + img {
  113 + width: 50px;
  114 + height: 50px;
  115 + }
  116 +}
app/views/users/_groups.html.haml 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +- groups.each do |group|
  2 + = link_to group, class: 'profile-groups-avatars', :title => group.name do
  3 + = image_tag group_icon(group.path)
0 \ No newline at end of file 4 \ No newline at end of file
app/views/users/show.html.haml
@@ -13,6 +13,8 @@ @@ -13,6 +13,8 @@
13 %br 13 %br
14 %small member since #{@user.created_at.stamp("Nov 12, 2031")} 14 %small member since #{@user.created_at.stamp("Nov 12, 2031")}
15 .clearfix 15 .clearfix
  16 + %h4 Groups:
  17 + = render 'groups', groups: @user.groups
16 %hr 18 %hr
17 %h4 User Activity: 19 %h4 User Activity:
18 = render @events 20 = render @events
features/profile/profile.feature
@@ -6,6 +6,13 @@ Feature: Profile @@ -6,6 +6,13 @@ Feature: Profile
6 Given I visit profile page 6 Given I visit profile page
7 Then I should see my profile info 7 Then I should see my profile info
8 8
  9 + Scenario: I can see groups I belong to
  10 + Given I have group with projects
  11 + When I visit profile page
  12 + And I click on my profile picture
  13 + Then I should see my user page
  14 + And I should see groups I belong to
  15 +
9 Scenario: I edit profile 16 Scenario: I edit profile
10 Given I visit profile page 17 Given I visit profile page
11 Then I change my profile info 18 Then I change my profile info
features/steps/profile/profile.rb
@@ -173,4 +173,17 @@ class Profile < Spinach::FeatureSteps @@ -173,4 +173,17 @@ class Profile < Spinach::FeatureSteps
173 page.should have_content current_user.name 173 page.should have_content current_user.name
174 end 174 end
175 end 175 end
  176 +
  177 + step 'I have group with projects' do
  178 + @group = create(:group)
  179 + @group.add_owner(current_user)
  180 + @project = create(:project, namespace: @group)
  181 + @event = create(:closed_issue_event, project: @project)
  182 +
  183 + @project.team << [current_user, :master]
  184 + end
  185 +
  186 + step 'I should see groups I belong to' do
  187 + page.should have_css('.profile-groups-avatars', visible: true)
  188 + end
176 end 189 end