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 26 form = $(this).closest("form")
27 27 filename = $(this).val().replace(/^.*[\\\/]/, '')
28 28 form.find(".js-avatar-filename").text(filename)
  29 +
  30 + $('.profile-groups-avatars').tooltip("placement": "top")
29 31 \ No newline at end of file
... ...
app/assets/stylesheets/sections/profile.scss
... ... @@ -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 @@
  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 4 \ No newline at end of file
... ...
app/views/users/show.html.haml
... ... @@ -13,6 +13,8 @@
13 13 %br
14 14 %small member since #{@user.created_at.stamp("Nov 12, 2031")}
15 15 .clearfix
  16 + %h4 Groups:
  17 + = render 'groups', groups: @user.groups
16 18 %hr
17 19 %h4 User Activity:
18 20 = render @events
... ...
features/profile/profile.feature
... ... @@ -6,6 +6,13 @@ Feature: Profile
6 6 Given I visit profile page
7 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 16 Scenario: I edit profile
10 17 Given I visit profile page
11 18 Then I change my profile info
... ...
features/steps/profile/profile.rb
... ... @@ -173,4 +173,17 @@ class Profile < Spinach::FeatureSteps
173 173 page.should have_content current_user.name
174 174 end
175 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 189 end
... ...