From b8e81e558f4387b4ab4fed6594594ac29a7adec2 Mon Sep 17 00:00:00 2001 From: robertd Date: Thu, 6 Feb 2014 23:19:49 -0700 Subject: Show avatars of groups on profile screen that user belongs to --- app/assets/javascripts/profile.js.coffee | 2 ++ app/assets/stylesheets/sections/profile.scss | 9 +++++++++ app/views/users/_groups.html.haml | 3 +++ app/views/users/show.html.haml | 2 ++ 4 files changed, 16 insertions(+) create mode 100644 app/views/users/_groups.html.haml diff --git a/app/assets/javascripts/profile.js.coffee b/app/assets/javascripts/profile.js.coffee index 744f3086d55..b37a78ac197 100644 --- a/app/assets/javascripts/profile.js.coffee +++ b/app/assets/javascripts/profile.js.coffee @@ -26,3 +26,5 @@ $ -> form = $(this).closest("form") filename = $(this).val().replace(/^.*[\\\/]/, '') form.find(".js-avatar-filename").text(filename) + + $('.profile-groups-avatars').tooltip("placement": "top") \ No newline at end of file diff --git a/app/assets/stylesheets/sections/profile.scss b/app/assets/stylesheets/sections/profile.scss index 3a3bf7cdf2a..0ee46b9a2f7 100644 --- a/app/assets/stylesheets/sections/profile.scss +++ b/app/assets/stylesheets/sections/profile.scss @@ -105,3 +105,12 @@ } } } + +.profile-groups-avatars { + margin: 0 5px 10px 0; + + img { + width: 50px; + height: 50px; + } +} diff --git a/app/views/users/_groups.html.haml b/app/views/users/_groups.html.haml new file mode 100644 index 00000000000..412df943fcc --- /dev/null +++ b/app/views/users/_groups.html.haml @@ -0,0 +1,3 @@ +- groups.each do |group| + = link_to group, class: 'profile-groups-avatars', :title => group.name do + = image_tag group_icon(group.path) \ No newline at end of file diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 65f46500a89..98210af1e3d 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -13,6 +13,8 @@ %br %small member since #{@user.created_at.stamp("Nov 12, 2031")} .clearfix + %h4 Groups: + = render 'groups', groups: @user.groups %hr %h4 User Activity: = render @events -- cgit v1.2.1 From 973066e76dac1f6dae6c5356420abba7cb589462 Mon Sep 17 00:00:00 2001 From: robertd Date: Fri, 7 Feb 2014 22:45:46 -0700 Subject: Add tests for groups avatars check on user page --- features/profile/profile.feature | 7 +++++++ features/steps/profile/profile.rb | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/features/profile/profile.feature b/features/profile/profile.feature index 8b6ee6fd67f..44bb190f624 100644 --- a/features/profile/profile.feature +++ b/features/profile/profile.feature @@ -6,6 +6,13 @@ Feature: Profile Given I visit profile page Then I should see my profile info + Scenario: I can see groups I belong to + Given I have group with projects + When I visit profile page + And I click on my profile picture + Then I should see my user page + And I should see groups I belong to + Scenario: I edit profile Given I visit profile page Then I change my profile info diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index 33ae6c72998..879bcf41b40 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -173,4 +173,17 @@ class Profile < Spinach::FeatureSteps page.should have_content current_user.name end end + + step 'I have group with projects' do + @group = create(:group) + @group.add_owner(current_user) + @project = create(:project, namespace: @group) + @event = create(:closed_issue_event, project: @project) + + @project.team << [current_user, :master] + end + + step 'I should see groups I belong to' do + page.should have_css('.profile-groups-avatars', visible: true) + end end -- cgit v1.2.1