Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
96ede7f7
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,发现更多精彩内容 >>
提交
96ede7f7
编写于
6月 16, 2017
作者:
F
Fatih Acet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
IssueNotesRefactor: Implement logic for delete action.
No backend request for now. It’s just client side logic.
上级
66f4af5c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
62 addition
and
9 deletion
+62
-9
app/assets/javascripts/notes/components/issue_discussion.vue
app/assets/javascripts/notes/components/issue_discussion.vue
+1
-1
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+21
-2
app/assets/javascripts/notes/components/issue_note_actions.vue
...ssets/javascripts/notes/components/issue_note_actions.vue
+8
-1
app/assets/javascripts/notes/components/issue_system_note.vue
...assets/javascripts/notes/components/issue_system_note.vue
+2
-2
app/assets/javascripts/notes/services/issue_notes_service.js
app/assets/javascripts/notes/services/issue_notes_service.js
+3
-0
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+27
-3
未找到文件。
app/assets/javascripts/notes/components/issue_discussion.vue
浏览文件 @
96ede7f7
...
...
@@ -48,7 +48,7 @@ export default {
this
.
$store
.
commit
(
'
toggleDiscussion
'
,
{
discussionId
:
this
.
note
.
id
,
});
}
}
,
},
};
</
script
>
...
...
app/assets/javascripts/notes/components/issue_note.vue
浏览文件 @
96ede7f7
...
...
@@ -14,6 +14,7 @@ export default {
data
()
{
return
{
isEditing
:
false
,
isDeleting
:
false
,
};
},
components
:
{
...
...
@@ -26,11 +27,28 @@ export default {
author
()
{
return
this
.
note
.
author
;
},
classNameBindings
()
{
return
{
'
is-editing
'
:
this
.
isEditing
,
'
disabled-content
'
:
this
.
isDeleting
,
};
},
},
methods
:
{
editHandler
()
{
this
.
isEditing
=
true
;
},
deleteHandler
()
{
this
.
isDeleting
=
true
;
this
.
$store
.
dispatch
(
'
deleteNote
'
,
this
.
note
)
.
then
(()
=>
{
this
.
isDeleting
=
false
;
})
.
catch
(()
=>
{
this
.
isDeleting
=
false
;
});
},
formUpdateHandler
()
{
// console.log('update requested', data);
},
...
...
@@ -44,7 +62,7 @@ export default {
<
template
>
<li
class=
"note timeline-entry"
:class=
"
{ 'is-editing': isEditing }
">
:class=
"
classNameBindings
"
>
<div
class=
"timeline-entry-inner"
>
<div
class=
"timeline-icon"
>
<user-avatar-link
...
...
@@ -66,7 +84,8 @@ export default {
:canEdit=
"note.can_edit"
:canDelete=
"note.can_edit"
:reportAbusePath=
"note.report_abuse_path"
:editHandler=
"editHandler"
/>
:editHandler=
"editHandler"
:deleteHandler=
"deleteHandler"
/>
</div>
<issue-note-body
:note=
"note"
...
...
app/assets/javascripts/notes/components/issue_note_actions.vue
浏览文件 @
96ede7f7
...
...
@@ -26,6 +26,10 @@ export default {
type
:
Function
,
required
:
true
,
},
deleteHandler
:
{
type
:
Function
,
required
:
true
,
},
},
data
()
{
return
{
...
...
@@ -92,7 +96,10 @@ export default {
</a>
</li>
<li>
<a
class=
"js-note-delete"
>
<a
@
click.prevent=
"deleteHandler"
class=
"js-note-delete"
href=
"#"
>
<span
class=
"text-danger"
>
Delete comment
</span>
...
...
app/assets/javascripts/notes/components/issue_system_note.vue
浏览文件 @
96ede7f7
...
...
@@ -12,12 +12,12 @@ export default {
data
()
{
return
{
svg
:
iconsMap
[
this
.
note
.
system_note_icon_name
],
}
}
;
},
components
:
{
IssueNoteHeader
,
},
}
}
;
</
script
>
<
template
>
...
...
app/assets/javascripts/notes/services/issue_notes_service.js
浏览文件 @
96ede7f7
...
...
@@ -7,4 +7,7 @@ export default {
fetchNotes
(
endpoint
)
{
return
Vue
.
http
.
get
(
endpoint
);
},
deleteNote
(
endpoint
)
{
return
Vue
.
http
.
get
(
endpoint
);
},
};
app/assets/javascripts/notes/stores/issue_notes_store.js
浏览文件 @
96ede7f7
...
...
@@ -3,9 +3,7 @@
import
service
from
'
../services/issue_notes_service
'
;
const
findNoteObjectById
=
(
notes
,
id
)
=>
{
return
notes
.
filter
(
n
=>
n
.
id
===
id
)[
0
];
};
const
findNoteObjectById
=
(
notes
,
id
)
=>
notes
.
filter
(
n
=>
n
.
id
===
id
)[
0
];
const
state
=
{
notes
:
[],
...
...
@@ -26,6 +24,20 @@ const mutations = {
discussion
.
expanded
=
!
discussion
.
expanded
;
},
deleteNote
(
storeState
,
note
)
{
const
noteObj
=
findNoteObjectById
(
storeState
.
notes
,
note
.
discussion_id
);
if
(
noteObj
.
individual_note
)
{
storeState
.
notes
.
splice
(
storeState
.
notes
.
indexOf
(
noteObj
),
1
);
}
else
{
const
comment
=
findNoteObjectById
(
noteObj
.
notes
,
note
.
id
);
noteObj
.
notes
.
splice
(
noteObj
.
notes
.
indexOf
(
comment
),
1
);
if
(
!
noteObj
.
notes
.
length
)
{
storeState
.
notes
.
splice
(
storeState
.
notes
.
indexOf
(
noteObj
),
1
);
}
}
},
};
const
actions
=
{
...
...
@@ -40,6 +52,18 @@ const actions = {
new
Flash
(
'
Something went wrong while fetching issue comments. Please try again.
'
);
// eslint-disable-line
});
},
deleteNote
(
context
,
note
)
{
// FIXME: Implement request, remove fake delete timer...
return
service
.
deleteNote
(
`
${
document
.
location
.
href
}
.json`
)
.
then
(
res
=>
res
.
json
)
.
then
(()
=>
{
context
.
commit
(
'
deleteNote
'
,
note
);
})
.
catch
(()
=>
{
new
Flash
(
'
Something went wrong while deleting your note. Please try again.
'
);
// eslint-disable-line
});
},
};
export
default
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录