Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
562ccdae
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
562ccdae
编写于
7月 22, 2017
作者:
F
Fatih Acet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
IssueNotesRefactor: Add referenced users and commands to markdown field.
上级
14eb2aba
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
40 addition
and
10 deletion
+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
未找到文件。
app/assets/javascripts/notes/components/issue_comment_form.vue
浏览文件 @
562ccdae
...
...
@@ -13,8 +13,8 @@ export default {
return
{
note
:
''
,
markdownPreviewUrl
:
''
,
markdownDocsUrl
:
''
,
markdownPreviewUrl
:
gl
.
issueData
.
preview_note_path
,
noteType
:
'
comment
'
,
issueState
:
state
,
endpoint
:
create_note_path
,
...
...
@@ -142,10 +142,8 @@ export default {
mounted
()
{
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
const
issueData
=
JSON
.
parse
(
issuableDataEl
.
innerHTML
.
replace
(
/"/g
,
'
"
'
));
const
{
markdownDocs
,
markdownPreviewUrl
}
=
issueData
;
this
.
markdownDocsUrl
=
markdownDocs
;
this
.
markdownPreviewUrl
=
markdownPreviewUrl
;
this
.
markdownDocsUrl
=
issueData
.
markdownDocs
;
eventHub
.
$on
(
'
issueStateChanged
'
,
(
isClosed
)
=>
{
this
.
issueState
=
isClosed
?
'
closed
'
:
'
reopened
'
;
...
...
app/assets/javascripts/notes/components/issue_note_form.vue
浏览文件 @
562ccdae
...
...
@@ -31,7 +31,7 @@ export default {
return
{
initialNote
:
this
.
noteBody
,
note
:
this
.
noteBody
,
markdownPreviewUrl
:
''
,
markdownPreviewUrl
:
gl
.
issueData
.
preview_note_path
,
markdownDocsUrl
:
''
,
conflictWhileEditing
:
false
,
};
...
...
@@ -69,10 +69,8 @@ export default {
mounted
()
{
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
const
issueData
=
JSON
.
parse
(
issuableDataEl
.
innerHTML
.
replace
(
/"/g
,
'
"
'
));
const
{
markdownDocs
,
markdownPreviewUrl
}
=
issueData
;
this
.
markdownDocsUrl
=
markdownDocs
;
this
.
markdownPreviewUrl
=
markdownPreviewUrl
;
this
.
markdownDocsUrl
=
issueData
.
markdownDocs
;
this
.
$refs
.
textarea
.
focus
();
},
watch
:
{
...
...
app/assets/javascripts/notes/index.js
浏览文件 @
562ccdae
...
...
@@ -6,7 +6,7 @@ document.addEventListener('DOMContentLoaded', () => {
const
vm
=
new
Vue
({
el
:
'
#js-notes
'
,
components
:
{
issueNotes
issueNotes
,
},
template
:
`
<issue-notes ref="notes" />
...
...
app/assets/javascripts/notes/stores/issue_notes_store.js
浏览文件 @
562ccdae
/* eslint-disable no-param-reassign */
/* global Flash */
import
service
from
'
../services/issue_notes_service
'
;
import
utils
from
'
./issue_notes_utils
'
;
...
...
@@ -263,7 +264,7 @@ const actions = {
const
msg
=
'
Your comment could not be submitted! Please check your network connection and try again.
'
;
Flash
(
msg
,
'
alert
'
,
$
(
noteData
.
flashContainer
));
context
.
commit
(
'
removePlaceholderNotes
'
);
})
})
;
},
poll
(
context
)
{
const
{
notesPath
}
=
$
(
'
.js-notes-wrapper
'
)[
0
].
dataset
;
...
...
app/assets/javascripts/vue_shared/components/markdown/field.vue
浏览文件 @
562ccdae
...
...
@@ -3,6 +3,8 @@
import
markdownHeader
from
'
./header.vue
'
;
import
markdownToolbar
from
'
./toolbar.vue
'
;
const
REFERENCED_USERS_THRESHOLD
=
10
;
export
default
{
props
:
{
markdownPreviewUrl
:
{
...
...
@@ -23,6 +25,8 @@
data
()
{
return
{
markdownPreview
:
''
,
referencedCommands
:
''
,
referencedUsers
:
''
,
markdownPreviewLoading
:
false
,
previewMarkdown
:
false
,
};
...
...
@@ -31,6 +35,11 @@
markdownHeader
,
markdownToolbar
,
},
computed
:
{
shouldShowReferencedUsers
()
{
return
this
.
referencedUsers
.
length
>=
REFERENCED_USERS_THRESHOLD
;
},
},
methods
:
{
toggleMarkdownPreview
()
{
this
.
previewMarkdown
=
!
this
.
previewMarkdown
;
...
...
@@ -53,6 +62,8 @@
.
then
((
data
)
=>
{
this
.
markdownPreviewLoading
=
false
;
this
.
markdownPreview
=
data
.
body
;
this
.
referencedCommands
=
data
.
references
.
commands
;
this
.
referencedUsers
=
data
.
references
.
users
;
if
(
!
this
.
markdownPreview
)
{
this
.
markdownPreview
=
'
Nothing to preview.
'
;
...
...
@@ -118,5 +129,27 @@
Loading...
</span>
</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>
</template>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录