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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
bc931b90
Commit
bc931b90
authored
Sep 01, 2020
by
Jarek Ostrowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update delete project modal
MR:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41011
parent
63124283
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
47 deletions
+49
-47
app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue
.../admin/projects/index/components/delete_project_modal.vue
+36
-31
app/assets/javascripts/pages/admin/projects/index/index.js
app/assets/javascripts/pages/admin/projects/index/index.js
+12
-9
app/views/admin/projects/_projects.html.haml
app/views/admin/projects/_projects.html.haml
+1
-4
locale/gitlab.pot
locale/gitlab.pot
+0
-3
No files found.
app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue
View file @
bc931b90
<
script
>
import
{
GlSafeHtmlDirective
as
SafeHtml
}
from
'
@gitlab/ui
'
;
import
{
GlSafeHtmlDirective
as
SafeHtml
,
GlModal
}
from
'
@gitlab/ui
'
;
import
{
escape
}
from
'
lodash
'
;
import
DeprecatedModal
from
'
~/vue_shared/components/deprecated_modal.vue
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
__
,
s__
,
sprintf
}
from
'
~/locale
'
;
export
default
{
components
:
{
Deprecated
Modal
,
Gl
Modal
,
},
directives
:
{
SafeHtml
,
...
...
@@ -66,51 +65,57 @@ export default {
false
,
);
},
primaryButtonLabel
()
{
return
s__
(
'
AdminProjects|Delete project
'
);
},
canSubmit
()
{
return
this
.
enteredProjectName
===
this
.
projectName
;
},
primaryProps
()
{
return
{
text
:
s__
(
'
Delete project
'
),
attributes
:
[{
variant
:
'
danger
'
},
{
category
:
'
primary
'
},
{
disabled
:
!
this
.
canSubmit
}],
};
},
},
methods
:
{
onCancel
()
{
this
.
enteredProjectName
=
''
;
},
onSubmit
()
{
if
(
!
this
.
canSubmit
)
{
return
;
}
this
.
$refs
.
form
.
submit
();
this
.
enteredProjectName
=
''
;
},
},
cancelProps
:
{
text
:
__
(
'
Cancel
'
),
},
};
</
script
>
<
template
>
<
deprecated
-modal
id=
"delete-project-modal"
<
gl
-modal
modal-
id=
"delete-project-modal"
:title=
"title"
:text=
"text"
:primary-button-label=
"primaryButtonLabel"
:submit-disabled=
"!canSubmit"
kind=
"danger"
@
submit=
"onSubmit"
:action-primary=
"primaryProps"
:action-cancel=
"$options.cancelProps"
:ok-disabled=
"!canSubmit"
@
primary=
"onSubmit"
@
cancel=
"onCancel"
>
<template
#body
="
props
"
>
<p
v-safe-html=
"props.text"
></p>
<p
v-safe-html=
"confirmationTextLabel"
></p>
<form
ref=
"form"
:action=
"deleteProjectUrl"
method=
"post"
>
<input
ref=
"method"
type=
"hidden"
name=
"_method"
value=
"delete"
/>
<input
:value=
"csrfToken"
type=
"hidden"
name=
"authenticity_token"
/>
<input
v-model=
"enteredProjectName"
name=
"projectName"
class=
"form-control"
type=
"text"
aria-labelledby=
"input-label"
autocomplete=
"off"
/>
</form>
</
template
>
</deprecated-modal>
<p
v-safe-html=
"text"
></p>
<p
v-safe-html=
"confirmationTextLabel"
></p>
<form
ref=
"form"
:action=
"deleteProjectUrl"
method=
"post"
>
<input
ref=
"method"
type=
"hidden"
name=
"_method"
value=
"delete"
/>
<input
:value=
"csrfToken"
type=
"hidden"
name=
"authenticity_token"
/>
<input
v-model=
"enteredProjectName"
name=
"projectName"
class=
"form-control"
type=
"text"
aria-labelledby=
"input-label"
autocomplete=
"off"
/>
</form>
</gl-modal>
</
template
>
app/assets/javascripts/pages/admin/projects/index/index.js
View file @
bc931b90
import
$
from
'
jquery
'
;
import
Vue
from
'
vue
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
...
...
@@ -17,6 +16,18 @@ document.addEventListener('DOMContentLoaded', () => {
deleteProjectUrl
:
''
,
projectName
:
''
,
},
mounted
()
{
const
deleteProjectButtons
=
document
.
querySelectorAll
(
'
.delete-project-button
'
);
deleteProjectButtons
.
forEach
(
button
=>
{
button
.
addEventListener
(
'
click
'
,
()
=>
{
const
buttonProps
=
button
.
dataset
;
deleteModal
.
deleteProjectUrl
=
buttonProps
.
deleteProjectUrl
;
deleteModal
.
projectName
=
buttonProps
.
projectName
;
this
.
$root
.
$emit
(
'
bv::show::modal
'
,
'
delete-project-modal
'
);
});
});
},
render
(
createElement
)
{
return
createElement
(
deleteProjectModal
,
{
props
:
{
...
...
@@ -27,12 +38,4 @@ document.addEventListener('DOMContentLoaded', () => {
});
},
});
$
(
document
).
on
(
'
shown.bs.modal
'
,
event
=>
{
if
(
event
.
relatedTarget
.
classList
.
contains
(
'
delete-project-button
'
))
{
const
buttonProps
=
event
.
relatedTarget
.
dataset
;
deleteModal
.
deleteProjectUrl
=
buttonProps
.
deleteProjectUrl
;
deleteModal
.
projectName
=
buttonProps
.
projectName
;
}
});
});
app/views/admin/projects/_projects.html.haml
View file @
bc931b90
...
...
@@ -5,10 +5,7 @@
%li
.project-row
{
class:
(
'no-description'
if
project
.
description
.
blank?
)
}
.controls
=
link_to
'Edit'
,
edit_project_path
(
project
),
id:
"edit_
#{
dom_id
(
project
)
}
"
,
class:
"btn"
%button
.delete-project-button.btn.btn-danger
{
data:
{
toggle:
'modal'
,
target:
'#delete-project-modal'
,
delete_project_url:
admin_project_path
(
project
),
project_name:
project
.
name
},
type:
'button'
}
%button
.delete-project-button.btn.btn-danger
{
data:
{
delete_project_url:
admin_project_path
(
project
),
project_name:
project
.
name
}
}
=
s_
(
'AdminProjects|Delete'
)
.stats
...
...
locale/gitlab.pot
View file @
bc931b90
...
...
@@ -1830,9 +1830,6 @@ msgstr ""
msgid "AdminProjects|Delete Project %{projectName}?"
msgstr ""
msgid "AdminProjects|Delete project"
msgstr ""
msgid "AdminSettings|Apply integration settings to all Projects"
msgstr ""
...
...
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