Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
507b15e7
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,发现更多精彩内容 >>
提交
507b15e7
编写于
8月 04, 2017
作者:
F
Filipa Lacerda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ci skip] Enable submit button on paste
Reset form after response is submitted
上级
9e4164d4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
17 deletion
+46
-17
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+45
-14
app/assets/javascripts/notes/components/issue_discussion.vue
app/assets/javascripts/notes/components/issue_discussion.vue
+1
-3
未找到文件。
app/assets/javascripts/notes/components/issue_comment_form.vue
浏览文件 @
507b15e7
...
...
@@ -2,6 +2,7 @@
/* global Flash, Autosave */
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
_
from
'
underscore
'
;
import
userAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
markdownField
from
'
../../vue_shared/components/markdown/field.vue
'
;
import
issueNoteSignedOutWidget
from
'
./issue_note_signed_out_widget.vue
'
;
...
...
@@ -11,19 +12,14 @@
export
default
{
data
()
{
const
{
getUserData
,
getIssueData
,
getNotesData
}
=
this
.
$store
.
getters
;
return
{
note
:
''
,
markdownDocsUrl
:
getNotesData
.
markdownDocs
,
quickActionsDocsUrl
:
getNotesData
.
quickActionsDocs
,
markdownPreviewUrl
:
getIssueData
.
preview_note_path
,
noteType
:
constants
.
COMMENT
,
issueState
:
getIssueData
.
state
,
endpoint
:
getIssueData
.
create_note_path
,
author
:
getUserData
,
canUpdateIssue
:
getIssueData
.
current_user
.
can_update
,
// Can't use mapGetters,
// this needs to be in the data object because it belongs to the state
issueState
:
this
.
$store
.
getters
.
getIssueData
.
state
,
isSubmitting
:
false
,
isSubmitButtonDisabled
:
true
,
};
},
components
:
{
...
...
@@ -31,11 +27,28 @@
markdownField
,
issueNoteSignedOutWidget
,
},
watch
:
{
note
(
newNote
)
{
if
(
!
_
.
isEmpty
(
newNote
)
&&
!
this
.
isSubmitting
)
{
this
.
isSubmitButtonDisabled
=
false
;
}
else
{
this
.
isSubmitButtonDisabled
=
true
;
}
},
isSubmitting
(
newValue
)
{
if
(
!
_
.
isEmpty
(
this
.
note
)
&&
!
newValue
)
{
this
.
isSubmitButtonDisabled
=
false
;
}
else
{
this
.
isSubmitButtonDisabled
=
true
;
}
},
},
computed
:
{
...
mapGetters
([
'
getCurrentUserLastNote
'
,
'
getUserData
'
,
'
getIssueData
'
,
'
getNotesData
'
,
]),
isLoggedIn
()
{
return
this
.
getUserData
!==
null
;
...
...
@@ -63,8 +76,23 @@
'
js-note-target-reopen
'
:
!
this
.
isIssueOpen
,
};
},
canSubmit
()
{
return
!
this
.
note
.
length
||
this
.
isSubmitting
;
markdownDocsUrl
()
{
return
this
.
getNotesData
.
markdownDocs
;
},
quickActionsDocsUrl
()
{
return
this
.
getNotesData
.
quickActionsDocs
;
},
markdownPreviewUrl
()
{
return
this
.
getIssueData
.
preview_note_path
;
},
author
()
{
return
this
.
getUserData
;
},
canUpdateIssue
()
{
return
this
.
getIssueData
.
current_user
.
can_update
;
},
endpoint
()
{
return
this
.
getIssueData
.
create_note_path
;
},
},
methods
:
{
...
...
@@ -139,6 +167,9 @@
if
(
shouldClear
)
{
this
.
note
=
''
;
}
// reset autostave
this
.
autosave
.
reset
();
},
setNoteType
(
type
)
{
this
.
noteType
=
type
;
...
...
@@ -155,7 +186,7 @@
}
},
initAutoSave
()
{
return
new
Autosave
(
$
(
this
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
getIssueData
.
id
]);
this
.
autosave
=
new
Autosave
(
$
(
this
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
getIssueData
.
id
]);
},
},
mounted
()
{
...
...
@@ -212,13 +243,13 @@
<div
class=
"pull-left btn-group append-right-10 comment-type-dropdown js-comment-type-dropdown droplab-dropdown"
>
<button
@
click=
"handleSave()"
:disabled=
"
canSubmit
"
:disabled=
"
isSubmitButtonDisabled
"
class=
"btn btn-nr btn-create comment-btn js-comment-button js-comment-submit-button"
type=
"button"
>
{{
commentButtonTitle
}}
</button>
<button
:disabled=
"
canSubmit
"
:disabled=
"
isSubmitButtonDisabled
"
name=
"button"
type=
"button"
class=
"btn btn-nr comment-btn note-type-toggle js-note-new-discussion dropdown-toggle"
...
...
app/assets/javascripts/notes/components/issue_discussion.vue
浏览文件 @
507b15e7
...
...
@@ -79,10 +79,8 @@
},
cancelReplyForm
(
shouldConfirm
)
{
if
(
shouldConfirm
&&
this
.
$refs
.
noteForm
.
isDirty
)
{
const
msg
=
'
Are you sure you want to cancel creating this comment?
'
;
// eslint-disable-next-line no-alert
const
isConfirmed
=
confirm
(
msg
);
if
(
!
isConfirmed
)
{
if
(
!
confirm
(
'
Are you sure you want to cancel creating this comment?
'
))
{
return
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录