Commit dba18fa4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Show contributed projects on user page and stars for it

parent 846c9310
......@@ -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)
......
......@@ -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?
......
.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
......@@ -35,9 +35,7 @@
= render @events
.col-md-4
= render 'profile', user: @user
- if @projects.present?
= render 'projects', projects: @projects
= render 'projects'
:coffeescript
$ ->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment