Commit 72b29525 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Show only personal projects on profile page

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent d54d3324
...@@ -4,10 +4,12 @@ class UsersController < ApplicationController ...@@ -4,10 +4,12 @@ class UsersController < ApplicationController
def show def show
@user = User.find_by_username!(params[:username]) @user = User.find_by_username!(params[:username])
@projects = @user.authorized_projects.accessible_to(current_user) @projects = Project.personal(@user).accessible_to(current_user)
if !current_user && @projects.empty? if !current_user && @projects.empty?
return authenticate_user! return authenticate_user!
end end
@groups = @user.groups.accessible_to(current_user) @groups = @user.groups.accessible_to(current_user)
@events = @user.recent_events.where(project_id: @projects.pluck(:id)).limit(20) @events = @user.recent_events.where(project_id: @projects.pluck(:id)).limit(20)
@title = @user.name @title = @user.name
......
.panel.panel-default .panel.panel-default
.panel-heading Projects .panel-heading Personal projects
%ul.well-list %ul.well-list
- @projects.each do |project| - @projects.each do |project|
%li %li
......
...@@ -20,4 +20,5 @@ ...@@ -20,4 +20,5 @@
= render @events = render @events
.col-md-4 .col-md-4
= render 'profile', user: @user = render 'profile', user: @user
= render 'projects' - if @projects.present?
= render 'projects'
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