2012-05-02 10:18:07 +01:00
|
|
|
class Users::ProfileController < Users::BaseController
|
2014-11-13 00:17:22 +00:00
|
|
|
include PaginateHelper
|
|
|
|
|
2015-03-04 23:19:19 +00:00
|
|
|
skip_before_action :authenticate_user!, only: :show if APP_CONFIG['anonymous_access']
|
2012-05-02 10:18:07 +01:00
|
|
|
|
|
|
|
def show
|
2015-04-06 23:54:16 +01:00
|
|
|
authorize @user
|
2014-11-13 00:17:22 +00:00
|
|
|
respond_to do |format|
|
|
|
|
format.html do
|
|
|
|
@groups = @user.groups.order(:uname)
|
|
|
|
end
|
|
|
|
format.json do
|
|
|
|
@projects = @user.own_projects.search(params[:term]).recent
|
|
|
|
case params[:visibility]
|
2014-11-13 21:19:18 +00:00
|
|
|
when 'open'
|
|
|
|
@projects = @projects.opened
|
2014-11-13 00:17:22 +00:00
|
|
|
when 'hidden'
|
2015-03-26 00:26:24 +00:00
|
|
|
@projects = ProjectPolicy::Scope.new(current_user, @projects.by_visibilities('hidden')).read
|
2014-11-13 00:17:22 +00:00
|
|
|
else
|
2015-03-26 00:26:24 +00:00
|
|
|
@projects = ProjectPolicy::Scope.new(current_user, @projects).read
|
2014-11-13 00:17:22 +00:00
|
|
|
end
|
|
|
|
@total_items = @projects.count
|
|
|
|
@projects = @projects.paginate(paginate_params)
|
2013-09-10 18:03:00 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-05-02 10:18:07 +01:00
|
|
|
end
|