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
Boxiang Sun
gitlab-ce
Commits
c9b5c42b
Commit
c9b5c42b
authored
May 03, 2018
by
Constance Okoghenun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added commit form fields for delete page confirmation
parent
86b8fd3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
12 deletions
+56
-12
app/assets/javascripts/pages/projects/wikis/components/delete_wiki_modal.vue
...pts/pages/projects/wikis/components/delete_wiki_modal.vue
+51
-7
app/assets/javascripts/pages/projects/wikis/index.js
app/assets/javascripts/pages/projects/wikis/index.js
+3
-2
app/views/projects/wikis/edit.html.haml
app/views/projects/wikis/edit.html.haml
+2
-3
No files found.
app/assets/javascripts/pages/projects/wikis/components/delete_wiki_modal.vue
View file @
c9b5c42b
<
script
>
<
script
>
import
_
from
'
underscore
'
;
import
GlModal
from
'
~/vue_shared/components/gl_modal.vue
'
;
import
GlModal
from
'
~/vue_shared/components/gl_modal.vue
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -12,6 +13,11 @@ export default {
...
@@ -12,6 +13,11 @@ export default {
required
:
false
,
required
:
false
,
default
:
''
,
default
:
''
,
},
},
pageTitle
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
csrfToken
:
{
csrfToken
:
{
type
:
String
,
type
:
String
,
required
:
false
,
required
:
false
,
...
@@ -19,8 +25,22 @@ export default {
...
@@ -19,8 +25,22 @@ export default {
},
},
},
},
computed
:
{
computed
:
{
text
()
{
message
()
{
return
s__
(
'
WikiPageConfirmDelete|Are you sure you want to delete this page?
'
)
return
sprintf
(
s__
(
'
WikiPageConfirmDelete|Delete %{pageTitle}
'
),
{
pageTitle
:
_
.
escape
(
this
.
pageTitle
),
},
false
,
);
},
title
()
{
return
sprintf
(
s__
(
'
WikiPageConfirmDelete|Delete Page %{pageTitle}?
'
),
{
pageTitle
:
`'
${
_
.
escape
(
this
.
pageTitle
)}
'`
,
},
false
,
);
}
}
},
},
methods
:
{
methods
:
{
...
@@ -34,17 +54,16 @@ export default {
...
@@ -34,17 +54,16 @@ export default {
<
template
>
<
template
>
<gl-modal
<gl-modal
id=
"delete-wiki-modal"
id=
"delete-wiki-modal"
:header-title-text=
"
s__('WikiPageConfirmDelete|Delete Wiki?')
"
:header-title-text=
"
title
"
footer-primary-button-variant=
"danger"
footer-primary-button-variant=
"danger"
:footer-primary-button-text=
"s__('WikiPageConfirmDelete|Delete')"
:footer-primary-button-text=
"s__('WikiPageConfirmDelete|Delete
Page
')"
@
submit=
"onSubmit"
@
submit=
"onSubmit"
>
>
{{
text
}}
<form
<form
ref=
"form"
ref=
"form"
:action=
"deleteWikiUrl"
:action=
"deleteWikiUrl"
method=
"post"
method=
"post"
class=
"form-horizontal js-requires-input"
>
>
<input
<input
ref=
"method"
ref=
"method"
...
@@ -57,6 +76,31 @@ export default {
...
@@ -57,6 +76,31 @@ export default {
name=
"authenticity_token"
name=
"authenticity_token"
:value=
"csrfToken"
:value=
"csrfToken"
/>
/>
<div
class=
"form-group"
>
<div
class=
"col-sm-12"
>
<label
for=
"commit_message"
class=
"control-label-full-width"
>
Commit Message
</label>
</div>
<div
class=
"col-sm-12"
>
<div
class=
"commit-message-container"
>
<textarea
id=
"commit_message"
rows=
"3"
name=
"commit_message"
:value=
"message"
class=
"form-control js-commit-message"
required
></textarea>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-12"
>
<label
for=
"branch_name"
class=
"control-label-full-width"
>
Target Branch
</label>
</div>
<div
class=
"col-sm-12"
>
<input
type=
"text"
name=
"branch_name"
class=
"form-control js-commit-message ref-name"
required
/>
</div>
</div>
</form>
</form>
</gl-modal>
</gl-modal>
</
template
>
</
template
>
...
...
app/assets/javascripts/pages/projects/wikis/index.js
View file @
c9b5c42b
...
@@ -15,9 +15,9 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -15,9 +15,9 @@ document.addEventListener('DOMContentLoaded', () => {
new
GLForm
(
$
(
'
.wiki-form
'
),
true
);
// eslint-disable-line no-new
new
GLForm
(
$
(
'
.wiki-form
'
),
true
);
// eslint-disable-line no-new
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
const
{
deleteWikiUrl
}
=
document
.
getElementById
(
'
delete-wiki-button
'
).
dataset
;
const
{
deleteWikiUrl
,
pageTitle
}
=
document
.
getElementById
(
'
delete-wiki-button
'
).
dataset
;
const
deleteWikiModalEl
=
document
.
getElementById
(
'
delete-wiki-modal
'
);
const
deleteWikiModalEl
=
document
.
getElementById
(
'
delete-wiki-modal
'
);
const
deleteModal
=
new
Vue
({
const
deleteModal
=
new
Vue
({
// eslint-disable-line
el
:
deleteWikiModalEl
,
el
:
deleteWikiModalEl
,
data
:
{
data
:
{
deleteWikiUrl
:
''
,
deleteWikiUrl
:
''
,
...
@@ -25,6 +25,7 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -25,6 +25,7 @@ document.addEventListener('DOMContentLoaded', () => {
render
(
createElement
)
{
render
(
createElement
)
{
return
createElement
(
deleteWikiModal
,
{
return
createElement
(
deleteWikiModal
,
{
props
:
{
props
:
{
pageTitle
,
deleteWikiUrl
,
deleteWikiUrl
,
csrfToken
:
csrf
.
token
,
csrfToken
:
csrf
.
token
,
},
},
...
...
app/views/projects/wikis/edit.html.haml
View file @
c9b5c42b
...
@@ -28,11 +28,10 @@
...
@@ -28,11 +28,10 @@
=
link_to
project_wiki_history_path
(
@project
,
@page
),
class:
"btn"
do
=
link_to
project_wiki_history_path
(
@project
,
@page
),
class:
"btn"
do
=
s_
(
"Wiki|Page history"
)
=
s_
(
"Wiki|Page history"
)
-
if
can?
(
current_user
,
:admin_wiki
,
@project
)
-
if
can?
(
current_user
,
:admin_wiki
,
@project
)
-# = link_to project_wiki_path(@project, @page), data: { confirm: s_("WikiPageConfirmDelete|Are you sure you want to delete this page?")}, method: :delete, class: "btn btn-danger" do
-# = _("Delete")
%button
.btn.btn-danger
{
data:
{
toggle:
'modal'
,
%button
.btn.btn-danger
{
data:
{
toggle:
'modal'
,
target:
'#delete-wiki-modal'
,
target:
'#delete-wiki-modal'
,
delete_wiki_url:
project_wiki_path
(
@project
,
@page
)
},
delete_wiki_url:
project_wiki_path
(
@project
,
@page
),
page_title:
@page
.
title
.
capitalize
},
id:
'delete-wiki-button'
,
id:
'delete-wiki-button'
,
type:
'button'
}
type:
'button'
}
=
_
(
'Delete'
)
=
_
(
'Delete'
)
...
...
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