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
562ccdae
Commit
562ccdae
authored
Jul 22, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Add referenced users and commands to markdown field.
parent
14eb2aba
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
10 deletions
+40
-10
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+2
-4
app/assets/javascripts/notes/components/issue_note_form.vue
app/assets/javascripts/notes/components/issue_note_form.vue
+2
-4
app/assets/javascripts/notes/index.js
app/assets/javascripts/notes/index.js
+1
-1
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+2
-1
app/assets/javascripts/vue_shared/components/markdown/field.vue
...sets/javascripts/vue_shared/components/markdown/field.vue
+33
-0
No files found.
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
562ccdae
...
@@ -13,8 +13,8 @@ export default {
...
@@ -13,8 +13,8 @@ export default {
return
{
return
{
note
:
''
,
note
:
''
,
markdownPreviewUrl
:
''
,
markdownDocsUrl
:
''
,
markdownDocsUrl
:
''
,
markdownPreviewUrl
:
gl
.
issueData
.
preview_note_path
,
noteType
:
'
comment
'
,
noteType
:
'
comment
'
,
issueState
:
state
,
issueState
:
state
,
endpoint
:
create_note_path
,
endpoint
:
create_note_path
,
...
@@ -142,10 +142,8 @@ export default {
...
@@ -142,10 +142,8 @@ export default {
mounted
()
{
mounted
()
{
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
const
issueData
=
JSON
.
parse
(
issuableDataEl
.
innerHTML
.
replace
(
/"/g
,
'
"
'
));
const
issueData
=
JSON
.
parse
(
issuableDataEl
.
innerHTML
.
replace
(
/"/g
,
'
"
'
));
const
{
markdownDocs
,
markdownPreviewUrl
}
=
issueData
;
this
.
markdownDocsUrl
=
markdownDocs
;
this
.
markdownDocsUrl
=
issueData
.
markdownDocs
;
this
.
markdownPreviewUrl
=
markdownPreviewUrl
;
eventHub
.
$on
(
'
issueStateChanged
'
,
(
isClosed
)
=>
{
eventHub
.
$on
(
'
issueStateChanged
'
,
(
isClosed
)
=>
{
this
.
issueState
=
isClosed
?
'
closed
'
:
'
reopened
'
;
this
.
issueState
=
isClosed
?
'
closed
'
:
'
reopened
'
;
...
...
app/assets/javascripts/notes/components/issue_note_form.vue
View file @
562ccdae
...
@@ -31,7 +31,7 @@ export default {
...
@@ -31,7 +31,7 @@ export default {
return
{
return
{
initialNote
:
this
.
noteBody
,
initialNote
:
this
.
noteBody
,
note
:
this
.
noteBody
,
note
:
this
.
noteBody
,
markdownPreviewUrl
:
''
,
markdownPreviewUrl
:
gl
.
issueData
.
preview_note_path
,
markdownDocsUrl
:
''
,
markdownDocsUrl
:
''
,
conflictWhileEditing
:
false
,
conflictWhileEditing
:
false
,
};
};
...
@@ -69,10 +69,8 @@ export default {
...
@@ -69,10 +69,8 @@ export default {
mounted
()
{
mounted
()
{
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
const
issueData
=
JSON
.
parse
(
issuableDataEl
.
innerHTML
.
replace
(
/"/g
,
'
"
'
));
const
issueData
=
JSON
.
parse
(
issuableDataEl
.
innerHTML
.
replace
(
/"/g
,
'
"
'
));
const
{
markdownDocs
,
markdownPreviewUrl
}
=
issueData
;
this
.
markdownDocsUrl
=
markdownDocs
;
this
.
markdownDocsUrl
=
issueData
.
markdownDocs
;
this
.
markdownPreviewUrl
=
markdownPreviewUrl
;
this
.
$refs
.
textarea
.
focus
();
this
.
$refs
.
textarea
.
focus
();
},
},
watch
:
{
watch
:
{
...
...
app/assets/javascripts/notes/index.js
View file @
562ccdae
...
@@ -6,7 +6,7 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -6,7 +6,7 @@ document.addEventListener('DOMContentLoaded', () => {
const
vm
=
new
Vue
({
const
vm
=
new
Vue
({
el
:
'
#js-notes
'
,
el
:
'
#js-notes
'
,
components
:
{
components
:
{
issueNotes
issueNotes
,
},
},
template
:
`
template
:
`
<issue-notes ref="notes" />
<issue-notes ref="notes" />
...
...
app/assets/javascripts/notes/stores/issue_notes_store.js
View file @
562ccdae
/* eslint-disable no-param-reassign */
/* eslint-disable no-param-reassign */
/* global Flash */
import
service
from
'
../services/issue_notes_service
'
;
import
service
from
'
../services/issue_notes_service
'
;
import
utils
from
'
./issue_notes_utils
'
;
import
utils
from
'
./issue_notes_utils
'
;
...
@@ -263,7 +264,7 @@ const actions = {
...
@@ -263,7 +264,7 @@ const actions = {
const
msg
=
'
Your comment could not be submitted! Please check your network connection and try again.
'
;
const
msg
=
'
Your comment could not be submitted! Please check your network connection and try again.
'
;
Flash
(
msg
,
'
alert
'
,
$
(
noteData
.
flashContainer
));
Flash
(
msg
,
'
alert
'
,
$
(
noteData
.
flashContainer
));
context
.
commit
(
'
removePlaceholderNotes
'
);
context
.
commit
(
'
removePlaceholderNotes
'
);
})
})
;
},
},
poll
(
context
)
{
poll
(
context
)
{
const
{
notesPath
}
=
$
(
'
.js-notes-wrapper
'
)[
0
].
dataset
;
const
{
notesPath
}
=
$
(
'
.js-notes-wrapper
'
)[
0
].
dataset
;
...
...
app/assets/javascripts/vue_shared/components/markdown/field.vue
View file @
562ccdae
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
import
markdownHeader
from
'
./header.vue
'
;
import
markdownHeader
from
'
./header.vue
'
;
import
markdownToolbar
from
'
./toolbar.vue
'
;
import
markdownToolbar
from
'
./toolbar.vue
'
;
const
REFERENCED_USERS_THRESHOLD
=
10
;
export
default
{
export
default
{
props
:
{
props
:
{
markdownPreviewUrl
:
{
markdownPreviewUrl
:
{
...
@@ -23,6 +25,8 @@
...
@@ -23,6 +25,8 @@
data
()
{
data
()
{
return
{
return
{
markdownPreview
:
''
,
markdownPreview
:
''
,
referencedCommands
:
''
,
referencedUsers
:
''
,
markdownPreviewLoading
:
false
,
markdownPreviewLoading
:
false
,
previewMarkdown
:
false
,
previewMarkdown
:
false
,
};
};
...
@@ -31,6 +35,11 @@
...
@@ -31,6 +35,11 @@
markdownHeader
,
markdownHeader
,
markdownToolbar
,
markdownToolbar
,
},
},
computed
:
{
shouldShowReferencedUsers
()
{
return
this
.
referencedUsers
.
length
>=
REFERENCED_USERS_THRESHOLD
;
},
},
methods
:
{
methods
:
{
toggleMarkdownPreview
()
{
toggleMarkdownPreview
()
{
this
.
previewMarkdown
=
!
this
.
previewMarkdown
;
this
.
previewMarkdown
=
!
this
.
previewMarkdown
;
...
@@ -53,6 +62,8 @@
...
@@ -53,6 +62,8 @@
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
this
.
markdownPreviewLoading
=
false
;
this
.
markdownPreviewLoading
=
false
;
this
.
markdownPreview
=
data
.
body
;
this
.
markdownPreview
=
data
.
body
;
this
.
referencedCommands
=
data
.
references
.
commands
;
this
.
referencedUsers
=
data
.
references
.
users
;
if
(
!
this
.
markdownPreview
)
{
if
(
!
this
.
markdownPreview
)
{
this
.
markdownPreview
=
'
Nothing to preview.
'
;
this
.
markdownPreview
=
'
Nothing to preview.
'
;
...
@@ -118,5 +129,27 @@
...
@@ -118,5 +129,27 @@
Loading...
Loading...
</span>
</span>
</div>
</div>
<template
v-if=
"previewMarkdown && !markdownPreviewLoading"
>
<div
v-if=
"referencedCommands"
v-html=
"referencedCommands"
class=
"referenced-commands"
></div>
<div
v-if=
"shouldShowReferencedUsers"
class=
"referenced-users"
>
<span>
<i
class=
"fa fa-exclamation-triangle"
aria-hidden=
"true"
>
</i>
You are about to add
<strong>
<span
class=
"js-referenced-users-count"
>
{{
referencedUsers
.
length
}}
</span>
</strong>
people to the discussion. Proceed with caution.
</span>
</div>
</
template
>
</div>
</div>
</template>
</template>
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