2012-05-02 10:18:07 +01:00
|
|
|
class Users::ProfileController < Users::BaseController
|
2012-10-02 13:04:26 +01:00
|
|
|
skip_before_filter :authenticate_user!, :only => :show if APP_CONFIG['anonymous_access']
|
2012-05-02 10:18:07 +01:00
|
|
|
|
|
|
|
def show
|
2013-09-10 19:04:47 +01:00
|
|
|
@path, page = user_path, params[:page].to_i
|
2013-09-12 08:49:42 +01:00
|
|
|
@projects = @user.own_projects.search(params[:search]).recent
|
2013-09-11 16:43:53 +01:00
|
|
|
if request.xhr?
|
2013-09-10 18:03:00 +01:00
|
|
|
if params[:visibility] != 'hidden'
|
|
|
|
@projects = @projects.opened
|
|
|
|
@hidden = true
|
|
|
|
else
|
|
|
|
@projects = @projects.by_visibilities('hidden').accessible_by(current_ability, :read)
|
|
|
|
end
|
|
|
|
render :partial => 'shared/profile_projects', :layout => nil, :locals => {:projects => paginate_projects(page)}
|
|
|
|
else
|
|
|
|
@projects = paginate_projects(page)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def paginate_projects(page)
|
|
|
|
@projects.paginate(:page => (page>0 ? page : nil), :per_page => 24)
|
2012-05-02 10:18:07 +01:00
|
|
|
end
|
|
|
|
end
|