Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
6d9715d8
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,体验更适合开发者的 AI 搜索 >>
提交
6d9715d8
编写于
7月 28, 2016
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Show existing discussion when adding new comment on line with a hidden resolved discussion
上级
ce1843b7
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
47 addition
and
49 deletion
+47
-49
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+6
-1
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+11
-6
app/models/note.rb
app/models/note.rb
+0
-1
app/views/discussions/_diff_discussion.html.haml
app/views/discussions/_diff_discussion.html.haml
+4
-11
app/views/discussions/_diff_with_notes.html.haml
app/views/discussions/_diff_with_notes.html.haml
+1
-1
app/views/discussions/_discussion.html.haml
app/views/discussions/_discussion.html.haml
+2
-1
app/views/discussions/_notes.html.haml
app/views/discussions/_notes.html.haml
+13
-5
app/views/discussions/_parallel_diff_discussion.html.haml
app/views/discussions/_parallel_diff_discussion.html.haml
+10
-23
未找到文件。
app/assets/javascripts/application.js
浏览文件 @
6d9715d8
...
...
@@ -224,7 +224,12 @@
});
$body
.
on
(
"
click
"
,
"
.js-toggle-diff-comments
"
,
function
(
e
)
{
$
(
this
).
toggleClass
(
'
active
'
);
$
(
this
).
closest
(
"
.diff-file
"
).
find
(
"
.notes_holder
"
).
toggle
();
var
notesHolders
=
$
(
this
).
closest
(
"
.diff-file
"
).
find
(
"
.notes_holder
"
);
if
(
$
(
this
).
hasClass
(
'
active
'
))
{
notesHolders
.
show
();
}
else
{
notesHolders
.
hide
();
}
return
e
.
preventDefault
();
});
$document
.
off
(
"
click
"
,
'
.js-confirm-danger
'
);
...
...
app/assets/javascripts/notes.js
浏览文件 @
6d9715d8
...
...
@@ -637,16 +637,19 @@
nextRow
=
row
.
next
();
hasNotes
=
nextRow
.
is
(
"
.notes_holder
"
);
addForm
=
false
;
targetContent
=
"
.notes_content
"
;
rowCssToAdd
=
"
<tr class=
\"
notes_holder js-temp-notes-holder
\"
><td class=
\"
notes_line
\"
colspan=
\"
2
\"
></td><td class=
\"
notes_content
\"
></td></tr>
"
;
notesContentSelector
=
"
.notes_content
"
;
rowCssToAdd
=
"
<tr class=
\"
notes_holder js-temp-notes-holder
\"
><td class=
\"
notes_line
\"
colspan=
\"
2
\"
></td><td class=
\"
notes_content
\"
><
div class=
\"
content
\"
></div><
/td></tr>
"
;
if
(
this
.
isParallelView
())
{
lineType
=
$link
.
data
(
"
lineType
"
);
targetContent
+=
"
.
"
+
lineType
;
rowCssToAdd
=
"
<tr class=
\"
notes_holder js-temp-notes-holder
\"
><td class=
\"
notes_line
\"
></td><td class=
\"
notes_content parallel old
\"
></td><td class=
\"
notes_line
\"
></td><td class=
\"
notes_content parallel new
\"
></td></tr>
"
;
notesContentSelector
+=
"
.
"
+
lineType
;
rowCssToAdd
=
"
<tr class=
\"
notes_holder js-temp-notes-holder
\"
><td class=
\"
notes_line
old
\"
></td><td class=
\"
notes_content parallel old
\"
><div class=
\"
content
\"
></div></td><td class=
\"
notes_line new
\"
></td><td class=
\"
notes_content parallel new
\"
><div class=
\"
content
\"
></div
></td></tr>
"
;
}
notesContentSelector
+=
"
.content
"
;
if
(
hasNotes
)
{
notesContent
=
nextRow
.
find
(
targetContent
);
nextRow
.
show
();
notesContent
=
nextRow
.
find
(
notesContentSelector
);
if
(
notesContent
.
length
)
{
notesContent
.
show
();
replyButton
=
notesContent
.
find
(
"
.js-discussion-reply-button:visible
"
);
if
(
replyButton
.
length
)
{
e
.
target
=
replyButton
[
0
];
...
...
@@ -660,11 +663,13 @@
}
}
else
{
row
.
after
(
rowCssToAdd
);
nextRow
=
row
.
next
();
notesContent
=
nextRow
.
find
(
notesContentSelector
);
addForm
=
true
;
}
if
(
addForm
)
{
newForm
=
this
.
formClone
.
clone
();
newForm
.
appendTo
(
row
.
next
().
find
(
targetContent
)
);
newForm
.
appendTo
(
notesContent
);
return
this
.
setupDiscussionNoteForm
(
$link
,
newForm
);
}
};
...
...
app/models/note.rb
浏览文件 @
6d9715d8
...
...
@@ -88,7 +88,6 @@ class Note < ActiveRecord::Base
def
grouped_diff_discussions
active_notes
=
diff_notes
.
fresh
.
select
(
&
:active?
)
Discussion
.
for_diff_notes
(
active_notes
).
reject
(
&
:resolved?
).
map
{
|
d
|
[
d
.
line_code
,
d
]
}.
to_h
end
...
...
app/views/discussions/_diff_discussion.html.haml
浏览文件 @
6d9715d8
%tr
.notes_holder
-
expanded
=
local_assigns
.
fetch
(
:expanded
,
discussion
.
expanded?
)
%tr
.notes_holder
{
class:
(
'hide'
unless
expanded
)}
%td
.notes_line
{
colspan:
2
}
%td
.notes_content
%ul
.notes
{
data:
{
discussion_id:
discussion
.
id
}
}
=
render
partial:
"projects/notes/note"
,
collection:
discussion
.
notes
,
as: :note
.discussion-reply-holder
.discussion-with-resolve-btn
{
role:
"group"
}
.btn-group
{
role:
"group"
}
=
link_to_reply_discussion
(
discussion
)
.btn-group
{
role:
"group"
}
=
render
"discussions/resolve_all"
,
discussion:
discussion
=
render
"discussions/jump_to_next"
,
discussion:
discussion
.content
=
render
"discussions/notes"
,
discussion:
discussion
app/views/discussions/_diff_with_notes.html.haml
浏览文件 @
6d9715d8
...
...
@@ -11,4 +11,4 @@
=
render
"projects/diffs/line"
,
line:
line
,
diff_file:
diff_file
,
plain:
true
-
if
discussion
.
for_line?
(
line
)
=
render
"discussions/diff_discussion"
,
discussion:
discussion
=
render
"discussions/diff_discussion"
,
discussion:
discussion
,
expanded:
true
app/views/discussions/_discussion.html.haml
浏览文件 @
6d9715d8
...
...
@@ -44,4 +44,5 @@
-
if
discussion
.
diff_discussion?
&&
discussion
.
diff_file
=
render
"discussions/diff_with_notes"
,
discussion:
discussion
-
else
=
render
"discussions/notes"
,
discussion:
discussion
.panel.panel-default
=
render
"discussions/notes"
,
discussion:
discussion
app/views/discussions/_notes.html.haml
浏览文件 @
6d9715d8
.panel.panel-default
.notes
{
data:
{
discussion_id:
discussion
.
id
}
}
%ul
.notes.timeline
=
render
partial:
"projects/notes/note"
,
collection:
discussion
.
notes
,
as: :note
%ul
.notes
{
data:
{
discussion_id:
discussion
.
id
}
}
=
render
partial:
"projects/notes/note"
,
collection:
discussion
.
notes
,
as: :note
.discussion-reply-holder
.discussion-reply-holder
-
if
discussion
.
diff_discussion?
-
line_type
=
local_assigns
.
fetch
(
:line_type
,
nil
)
.btn-group-justified.discussion-with-resolve-btn
{
role:
"group"
}
.btn-group
{
role:
"group"
}
=
link_to_reply_discussion
(
discussion
,
line_type
)
.btn-group
{
role:
"group"
}
=
render
"discussions/resolve_all"
,
discussion:
discussion
=
render
"discussions/jump_to_next"
,
discussion:
discussion
-
else
=
link_to_reply_discussion
(
discussion
)
app/views/discussions/_parallel_diff_discussion.html.haml
浏览文件 @
6d9715d8
%tr
.notes_holder
-
expanded
=
discussion_left
.
try
(
:expanded?
)
||
discussion_right
.
try
(
:expanded?
)
%tr
.notes_holder
{
class:
(
'hide'
unless
expanded
)}
-
if
discussion_left
%td
.notes_line.old
%td
.notes_content.parallel.old
%ul
.notes
{
data:
{
discussion_id:
discussion_left
.
id
}
}
=
render
partial:
"projects/notes/note"
,
collection:
discussion_left
.
notes
,
as: :note
.discussion-reply-holder
.btn-group-justified.discussion-with-resolve-btn
{
role:
"group"
}
.btn-group
{
role:
"group"
}
=
link_to_reply_discussion
(
discussion_left
,
'old'
)
.btn-group
{
role:
"group"
}
=
render
"discussions/resolve_all"
,
discussion:
discussion_left
=
render
"discussions/jump_to_next"
,
discussion:
discussion_left
.content
{
class:
(
'hide'
unless
discussion_left
.
expanded?
)}
=
render
"discussions/notes"
,
discussion:
discussion_left
,
line_type:
'old'
-
else
%td
.notes_line.old
=
""
%td
.notes_content.parallel.old
=
""
%td
.notes_content.parallel.old
.content
-
if
discussion_right
%td
.notes_line.new
%td
.notes_content.parallel.new
%ul
.notes
{
data:
{
discussion_id:
discussion_right
.
id
}
}
=
render
partial:
"projects/notes/note"
,
collection:
discussion_right
.
notes
,
as: :note
.discussion-reply-holder
.btn-group-justified.discussion-with-resolve-btn
{
role:
"group"
}
.btn-group
{
role:
"group"
}
=
link_to_reply_discussion
(
discussion_right
,
'new'
)
.btn-group
{
role:
"group"
}
=
render
"discussions/resolve_all"
,
discussion:
discussion_right
=
render
"discussions/jump_to_next"
,
discussion:
discussion_right
.content
{
class:
(
'hide'
unless
discussion_right
.
expanded?
)}
=
render
"discussions/notes"
,
discussion:
discussion_right
,
line_type:
'new'
-
else
%td
.notes_line.new
=
""
%td
.notes_content.parallel.new
=
""
%td
.notes_content.parallel.new
.content
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录