2013-01-20 12:20:50 +01:00
|
|
|
class Admin::ProjectsController < Admin::ApplicationController
|
2012-11-23 05:31:09 +01:00
|
|
|
before_filter :project, only: [:edit, :show, :update, :destroy, :team_update]
|
2011-10-08 23:36:38 +02:00
|
|
|
|
|
|
|
def index
|
2012-11-23 05:31:09 +01:00
|
|
|
@projects = Project.scoped
|
2012-11-23 05:24:09 +01:00
|
|
|
@projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present?
|
2013-01-13 16:24:29 +01:00
|
|
|
@projects = @projects.where(public: true) if params[:public_only].present?
|
2013-01-14 08:44:27 +01:00
|
|
|
@projects = @projects.with_push if params[:with_push].present?
|
2013-01-14 08:37:29 +01:00
|
|
|
@projects = @projects.abandoned if params[:abandoned].present?
|
2012-12-03 19:14:05 +01:00
|
|
|
@projects = @projects.where(namespace_id: nil) if params[:namespace_id] == Namespace.global_id
|
2012-11-23 05:31:09 +01:00
|
|
|
@projects = @projects.search(params[:name]) if params[:name].present?
|
2012-11-23 19:11:09 +01:00
|
|
|
@projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2013-01-04 07:43:25 +01:00
|
|
|
@repository = @project.repository
|
2012-12-04 14:22:22 +01:00
|
|
|
@users = User.active
|
2012-11-23 05:31:09 +01:00
|
|
|
@users = @users.not_in_project(@project) if @project.users.present?
|
2012-07-31 07:32:49 +02:00
|
|
|
@users = @users.all
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
2012-11-23 21:25:28 +01:00
|
|
|
protected
|
|
|
|
|
|
|
|
def project
|
|
|
|
id = params[:project_id] || params[:id]
|
|
|
|
|
2012-11-25 11:26:34 +01:00
|
|
|
@project = Project.find_with_namespace(id)
|
2012-11-23 21:25:28 +01:00
|
|
|
@project || render_404
|
|
|
|
end
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|