Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
717c3022
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,发现更多精彩内容 >>
提交
717c3022
编写于
7月 11, 2017
作者:
F
Fatih Acet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
IssueNotesRefactor: Implement up arrow to edit last note.
上级
d45a8e00
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
4 deletion
+41
-4
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+13
-0
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+10
-0
app/assets/javascripts/notes/components/issue_note_form.vue
app/assets/javascripts/notes/components/issue_note_form.vue
+14
-0
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+2
-2
app/views/shared/issuable/_close_reopen_button.html.haml
app/views/shared/issuable/_close_reopen_button.html.haml
+2
-2
未找到文件。
app/assets/javascripts/notes/components/issue_comment_form.vue
浏览文件 @
717c3022
...
...
@@ -4,6 +4,7 @@
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
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
props
:
{},
...
...
@@ -101,6 +102,17 @@ export default {
handleError
()
{
new
Flash
(
'
Something went wrong while adding your comment. Please try again.
'
);
// eslint-disable-line
},
editMyLastNote
()
{
if
(
this
.
note
===
''
)
{
const
myLastNoteId
=
$
(
'
.js-my-note
'
).
last
().
attr
(
'
id
'
);
if
(
myLastNoteId
)
{
eventHub
.
$emit
(
'
EnterEditMode
'
,
{
noteId
:
parseInt
(
myLastNoteId
.
replace
(
'
note_
'
,
''
),
10
),
});
}
}
},
},
mounted
()
{
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
...
...
@@ -143,6 +155,7 @@ export default {
ref=
"textarea"
slot=
"textarea"
placeholder=
"Write a comment or drag your files here..."
@
keydown.up=
"editMyLastNote"
@
keydown.meta.enter=
"handleSave()"
>
</textarea>
</markdown-field>
...
...
app/assets/javascripts/notes/components/issue_note.vue
浏览文件 @
717c3022
...
...
@@ -6,6 +6,7 @@ import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_
import
IssueNoteHeader
from
'
./issue_note_header.vue
'
;
import
IssueNoteActions
from
'
./issue_note_actions.vue
'
;
import
IssueNoteBody
from
'
./issue_note_body.vue
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
props
:
{
...
...
@@ -37,6 +38,7 @@ export default {
return
{
'
is-editing
'
:
this
.
isEditing
,
'
disabled-content
'
:
this
.
isDeleting
,
'
js-my-note
'
:
this
.
author
.
id
===
window
.
gon
.
current_user_id
,
target
:
this
.
targetNoteHash
===
this
.
noteAnchorId
,
};
},
...
...
@@ -100,6 +102,14 @@ export default {
this
.
isEditing
=
false
;
},
},
created
()
{
eventHub
.
$on
(
'
EnterEditMode
'
,
({
noteId
})
=>
{
if
(
noteId
===
this
.
note
.
id
)
{
this
.
isEditing
=
true
;
this
.
$store
.
dispatch
(
'
scrollToNoteIfNeeded
'
,
$
(
this
.
$el
));
}
});
},
};
</
script
>
...
...
app/assets/javascripts/notes/components/issue_note_form.vue
浏览文件 @
717c3022
<
script
>
import
MarkdownField
from
'
../../vue_shared/components/markdown/field.vue
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
props
:
{
...
...
@@ -39,6 +40,18 @@ export default {
note
:
this
.
note
,
});
},
editMyLastNote
()
{
if
(
this
.
note
===
''
)
{
const
discussion
=
$
(
this
.
$el
).
closest
(
'
.discussion-notes
'
);
const
myLastNoteId
=
discussion
.
find
(
'
.js-my-note
'
).
last
().
attr
(
'
id
'
);
if
(
myLastNoteId
)
{
eventHub
.
$emit
(
'
EnterEditMode
'
,
{
noteId
:
parseInt
(
myLastNoteId
.
replace
(
'
note_
'
,
''
),
10
),
});
}
}
},
},
computed
:
{
isDirty
()
{
...
...
@@ -75,6 +88,7 @@ export default {
slot=
"textarea"
placeholder=
"Write a comment or drag your files here..."
@
keydown.meta.enter=
"handleUpdate"
@
keydown.up=
"editMyLastNote"
@
keydown.esc=
"cancelHandler(true)"
>
</textarea>
</markdown-field>
...
...
app/assets/javascripts/notes/stores/issue_notes_store.js
浏览文件 @
717c3022
...
...
@@ -197,10 +197,10 @@ const actions = {
if
(
!
skipMutalityCheck
&&
(
awardName
===
'
thumbsup
'
||
awardName
===
'
thumbsdown
'
))
{
const
counterAward
=
awardName
===
'
thumbsup
'
?
'
thumbsdown
'
:
'
thumbsup
'
;
const
n
ote
=
context
.
getters
.
notesById
[
noteId
];
const
targetN
ote
=
context
.
getters
.
notesById
[
noteId
];
let
amIAwarded
=
false
;
n
ote
.
award_emoji
.
forEach
((
a
)
=>
{
targetN
ote
.
award_emoji
.
forEach
((
a
)
=>
{
if
(
a
.
name
===
counterAward
&&
a
.
user
.
id
===
window
.
gon
.
current_user_id
)
{
amIAwarded
=
true
;
}
...
...
app/views/shared/issuable/_close_reopen_button.html.haml
浏览文件 @
717c3022
...
...
@@ -4,9 +4,9 @@
-
if
can_update
&&
is_current_user
=
link_to
"Close
#{
display_issuable_type
}
"
,
close_issuable_url
(
issuable
),
method:
button_method
,
class:
"hidden-xs hidden-sm btn btn-grouped btn-close
#{
issuable_button_visibility
(
issuable
,
true
)
}
"
,
title:
"Close
#{
display_issuable_type
}
"
class:
"hidden-xs hidden-sm btn btn-grouped btn-close
js-btn-issue-action
#{
issuable_button_visibility
(
issuable
,
true
)
}
"
,
title:
"Close
#{
display_issuable_type
}
"
=
link_to
"Reopen
#{
display_issuable_type
}
"
,
reopen_issuable_url
(
issuable
),
method:
button_method
,
class:
"hidden-xs hidden-sm btn btn-grouped btn-reopen
#{
issuable_button_visibility
(
issuable
,
false
)
}
"
,
title:
"Reopen
#{
display_issuable_type
}
"
class:
"hidden-xs hidden-sm btn btn-grouped btn-reopen
js-btn-issue-action
#{
issuable_button_visibility
(
issuable
,
false
)
}
"
,
title:
"Reopen
#{
display_issuable_type
}
"
-
elsif
can_update
&&
!
is_current_user
=
render
'shared/issuable/close_reopen_report_toggle'
,
issuable:
issuable
-
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录