Class: Admin::ProjectsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/projects_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject


5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/admin/projects_controller.rb', line 5

def index
  @projects = Project.all
  @projects = @projects.in_namespace(params[:namespace_id]) if params[:namespace_id].present?
  @projects = @projects.where("projects.visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present?
  @projects = @projects.with_push if params[:with_push].present?
  @projects = @projects.abandoned if params[:abandoned].present?
  @projects = @projects.where(last_repository_check_failed: true) if params[:last_repository_check_failed].present?
  @projects = @projects.non_archived unless params[:with_archived].present?
  @projects = @projects.search(params[:name]) if params[:name].present?
  @projects = @projects.sort(@sort = params[:sort])
  @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page])
end

#repository_checkObject


34
35
36
37
38
39
40
41
# File 'app/controllers/admin/projects_controller.rb', line 34

def repository_check
  RepositoryCheck::SingleRepositoryWorker.perform_async(@project.id)

  redirect_to(
    admin_namespace_project_path(@project.namespace, @project),
    notice: 'Repository check was triggered.'
  )
end

#showObject


18
19
20
21
22
23
24
# File 'app/controllers/admin/projects_controller.rb', line 18

def show
  if @group
    @group_members = @group.members.order("access_level DESC").page(params[:group_members_page])
  end

  @project_members = @project.project_members.page(params[:project_members_page])
end

#transferObject


26
27
28
29
30
31
32
# File 'app/controllers/admin/projects_controller.rb', line 26

def transfer
  namespace = Namespace.find_by(id: params[:new_namespace_id])
  ::Projects::TransferService.new(@project, current_user, params.dup).execute(namespace)

  @project.reload
  redirect_to admin_namespace_project_path(@project.namespace, @project)
end