Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
ffe6cb57
Commit
ffe6cb57
authored
May 29, 2019
by
Luke Picciau
Committed by
Robert Speicher
May 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirect to admin projects index if project was deleted from admin page
parent
76471e2f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+10
-1
app/views/admin/projects/_projects.html.haml
app/views/admin/projects/_projects.html.haml
+2
-2
config/routes/admin.rb
config/routes/admin.rb
+1
-1
No files found.
app/controllers/admin/projects_controller.rb
View file @
ffe6cb57
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
class
Admin::ProjectsController
<
Admin
::
ApplicationController
class
Admin::ProjectsController
<
Admin
::
ApplicationController
include
MembersPresentation
include
MembersPresentation
before_action
:project
,
only:
[
:show
,
:transfer
,
:repository_check
]
before_action
:project
,
only:
[
:show
,
:transfer
,
:repository_check
,
:destroy
]
before_action
:group
,
only:
[
:show
,
:transfer
]
before_action
:group
,
only:
[
:show
,
:transfer
]
def
index
def
index
...
@@ -35,6 +35,15 @@ class Admin::ProjectsController < Admin::ApplicationController
...
@@ -35,6 +35,15 @@ class Admin::ProjectsController < Admin::ApplicationController
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
def
destroy
::
Projects
::
DestroyService
.
new
(
@project
,
current_user
,
{}).
async_execute
flash
[
:notice
]
=
_
(
"Project '%{project_name}' is in the process of being deleted."
)
%
{
project_name:
@project
.
full_name
}
redirect_to
admin_projects_path
,
status: :found
rescue
Projects
::
DestroyService
::
DestroyError
=>
ex
redirect_to
admin_projects_path
,
status:
302
,
alert:
ex
.
message
end
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
transfer
def
transfer
namespace
=
Namespace
.
find_by
(
id:
params
[
:new_namespace_id
])
namespace
=
Namespace
.
find_by
(
id:
params
[
:new_namespace_id
])
...
...
app/views/admin/projects/_projects.html.haml
View file @
ffe6cb57
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
=
link_to
'Edit'
,
edit_project_path
(
project
),
id:
"edit_
#{
dom_id
(
project
)
}
"
,
class:
"btn"
=
link_to
'Edit'
,
edit_project_path
(
project
),
id:
"edit_
#{
dom_id
(
project
)
}
"
,
class:
"btn"
%button
.delete-project-button.btn.btn-danger
{
data:
{
toggle:
'modal'
,
%button
.delete-project-button.btn.btn-danger
{
data:
{
toggle:
'modal'
,
target:
'#delete-project-modal'
,
target:
'#delete-project-modal'
,
delete_project_url:
project_path
(
project
),
delete_project_url:
admin_
project_path
(
project
),
project_name:
project
.
name
},
type:
'button'
}
project_name:
project
.
name
},
type:
'button'
}
=
s_
(
'AdminProjects|Delete'
)
=
s_
(
'AdminProjects|Delete'
)
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
-
if
project
.
archived
-
if
project
.
archived
%span
.badge.badge-warning
archived
%span
.badge.badge-warning
archived
.title
.title
=
link_to
(
admin_
namespace_project_path
(
project
.
namespace
,
project
))
do
=
link_to
(
admin_
project_path
(
project
))
do
.dash-project-avatar
.dash-project-avatar
.avatar-container.rect-avatar.s40
.avatar-container.rect-avatar.s40
=
project_icon
(
project
,
alt:
''
,
class:
'avatar project-avatar s40'
,
width:
40
,
height:
40
)
=
project_icon
(
project
,
alt:
''
,
class:
'avatar project-avatar s40'
,
width:
40
,
height:
40
)
...
...
config/routes/admin.rb
View file @
ffe6cb57
...
@@ -83,7 +83,7 @@ namespace :admin do
...
@@ -83,7 +83,7 @@ namespace :admin do
resources
(
:projects
,
resources
(
:projects
,
path:
'/'
,
path:
'/'
,
constraints:
{
id:
Gitlab
::
PathRegex
.
project_route_regex
},
constraints:
{
id:
Gitlab
::
PathRegex
.
project_route_regex
},
only:
[
:show
])
do
only:
[
:show
,
:destroy
])
do
member
do
member
do
put
:transfer
put
:transfer
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment