gitlab-org--gitlab-foss/app/controllers/public/projects_controller.rb
Dmitriy Zaporozhets 611c5f1d7c
Sort dropdown for Dashboard#projects page
Be default it sorts by name now
Respect filters like scope, label, visibility when do sort or another
filter

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-12-29 12:58:00 +02:00

14 lines
517 B
Ruby

class Public::ProjectsController < ApplicationController
skip_before_filter :authenticate_user!,
:reject_blocked, :set_current_user_for_observers,
:add_abilities
layout 'public'
def index
@projects = Project.public_or_internal_only(current_user)
@projects = @projects.search(params[:search]) if params[:search].present?
@projects = @projects.sort(@sort = params[:sort])
@projects = @projects.includes(:namespace).page(params[:page]).per(20)
end
end