diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-17 22:40:00 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-18 15:54:58 -0800 |
commit | dba18fa4ddb88b8cc636086f869f31957ecb95d1 (patch) | |
tree | 0b86796dbb5c2a600fd4c2abe11b3fb6770afb35 | |
parent | 846c93102a3df0f99c7c4801f3b7df8b0295cac1 (diff) | |
download | gitlab-ce-dba18fa4ddb88b8cc636086f869f31957ecb95d1.tar.gz |
Show contributed projects on user page and stars for it
-rw-r--r-- | app/controllers/users_controller.rb | 3 | ||||
-rw-r--r-- | app/views/explore/projects/_project.html.haml | 8 | ||||
-rw-r--r-- | app/views/users/_projects.html.haml | 27 | ||||
-rw-r--r-- | app/views/users/show.html.haml | 4 |
4 files changed, 28 insertions, 14 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 84a04c5ebe6..e4f588c6a60 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -8,6 +8,9 @@ class UsersController < ApplicationController visible_projects = ProjectsFinder.new.execute(current_user) authorized_projects_ids = visible_projects.pluck(:id) + @contributed_projects = Project.where(id: authorized_projects_ids). + in_group_namespace + @projects = @user.personal_projects. where(id: authorized_projects_ids) diff --git a/app/views/explore/projects/_project.html.haml b/app/views/explore/projects/_project.html.haml index ffbddbae4d6..b093ec00c57 100644 --- a/app/views/explore/projects/_project.html.haml +++ b/app/views/explore/projects/_project.html.haml @@ -3,11 +3,9 @@ .project-access-icon = visibility_level_icon(project.visibility_level) = link_to project.name_with_namespace, project - - - if current_page?(starred_explore_projects_path) - %strong.pull-right - %i.fa.fa-star - = pluralize project.star_count, 'star' + %span.pull-right + %i.fa.fa-star + = project.star_count .project-info - if project.description.present? diff --git a/app/views/users/_projects.html.haml b/app/views/users/_projects.html.haml index 1d38f8e8ab8..c925a48f550 100644 --- a/app/views/users/_projects.html.haml +++ b/app/views/users/_projects.html.haml @@ -1,6 +1,21 @@ -.panel.panel-default - .panel-heading Personal projects - %ul.well-list - - projects.each do |project| - %li - = link_to_project project +- if @contributed_projects.present? + .panel.panel-default + .panel-heading Projects contributed to + %ul.well-list + - @contributed_projects.sort_by(&:star_count).reverse.each do |project| + %li + = link_to_project project + %span.pull-right.light + %i.fa.fa-star + = project.star_count + +- if @projects.present? + .panel.panel-default + .panel-heading Personal projects + %ul.well-list + - @projects.sort_by(&:star_count).reverse.each do |project| + %li + = link_to_project project + %span.pull-right.light + %i.fa.fa-star + = project.star_count diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index b05918b019e..5e82d5780cf 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -35,9 +35,7 @@ = render @events .col-md-4 = render 'profile', user: @user - - if @projects.present? - = render 'projects', projects: @projects - + = render 'projects' :coffeescript $ -> |