2013-01-20 06:20:50 -05:00
|
|
|
class Admin::ProjectsController < Admin::ApplicationController
|
2016-04-06 07:47:05 -04:00
|
|
|
before_action :project, only: [:show, :transfer, :repository_check]
|
2015-04-16 08:03:37 -04:00
|
|
|
before_action :group, only: [:show, :transfer]
|
2011-10-08 17:36:38 -04:00
|
|
|
|
|
|
|
def index
|
2017-08-11 05:09:07 -04:00
|
|
|
params[:sort] ||= 'latest_activity_desc'
|
|
|
|
@sort = params[:sort]
|
|
|
|
@projects = Admin::ProjectsFinder.new(params: params, current_user: current_user).execute
|
2017-03-03 05:13:03 -05:00
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
|
|
|
format.json do
|
|
|
|
render json: {
|
|
|
|
html: view_to_html_string("admin/projects/_projects", locals: { projects: @projects })
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2014-06-02 14:25:01 -04:00
|
|
|
if @group
|
2016-03-19 17:37:54 -04:00
|
|
|
@group_members = @group.members.order("access_level DESC").page(params[:group_members_page])
|
2014-06-02 14:25:01 -04:00
|
|
|
end
|
|
|
|
|
2016-06-27 10:20:57 -04:00
|
|
|
@project_members = @project.members.page(params[:project_members_page])
|
2016-07-28 13:38:32 -04:00
|
|
|
@requesters = AccessRequestsFinder.new(@project).execute(current_user)
|
2013-11-15 08:25:37 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def transfer
|
2015-07-02 08:31:25 -04:00
|
|
|
namespace = Namespace.find_by(id: params[:new_namespace_id])
|
|
|
|
::Projects::TransferService.new(@project, current_user, params.dup).execute(namespace)
|
2013-11-15 08:25:37 -05:00
|
|
|
|
2015-01-24 13:02:58 -05:00
|
|
|
@project.reload
|
2017-06-29 13:06:35 -04:00
|
|
|
redirect_to admin_project_path(@project)
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
|
2016-04-06 07:47:05 -04:00
|
|
|
def repository_check
|
2016-04-13 09:56:05 -04:00
|
|
|
RepositoryCheck::SingleRepositoryWorker.perform_async(@project.id)
|
2016-04-04 11:23:43 -04:00
|
|
|
|
|
|
|
redirect_to(
|
2017-06-29 13:06:35 -04:00
|
|
|
admin_project_path(@project),
|
2016-04-12 12:09:45 -04:00
|
|
|
notice: 'Repository check was triggered.'
|
2016-04-04 11:23:43 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2012-11-23 15:25:28 -05:00
|
|
|
protected
|
|
|
|
|
|
|
|
def project
|
2017-02-02 18:43:19 -05:00
|
|
|
@project = Project.find_by_full_path(
|
2015-01-24 13:02:58 -05:00
|
|
|
[params[:namespace_id], '/', params[:id]].join('')
|
|
|
|
)
|
2012-11-23 15:25:28 -05:00
|
|
|
@project || render_404
|
|
|
|
end
|
2013-11-15 08:25:37 -05:00
|
|
|
|
|
|
|
def group
|
2014-10-19 17:20:55 -04:00
|
|
|
@group ||= @project.group
|
2013-11-15 08:25:37 -05:00
|
|
|
end
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|