Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
9b919939
Commit
9b919939
authored
Oct 29, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix parameter passing and wording for per line notes
parent
b91d6802
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
27 additions
and
12 deletions
+27
-12
app/controllers/commit_controller.rb
app/controllers/commit_controller.rb
+3
-1
app/controllers/merge_requests_controller.rb
app/controllers/merge_requests_controller.rb
+3
-1
app/views/commits/_text_file.html.haml
app/views/commits/_text_file.html.haml
+1
-1
app/views/merge_requests/_show.html.haml
app/views/merge_requests/_show.html.haml
+2
-2
app/views/notes/_create_per_line_note.js.haml
app/views/notes/_create_per_line_note.js.haml
+1
-1
app/views/notes/_per_line_form.html.haml
app/views/notes/_per_line_form.html.haml
+2
-2
app/views/notes/_per_line_note_link.html.haml
app/views/notes/_per_line_note_link.html.haml
+6
-1
app/views/notes/_per_line_notes_with_reply.html.haml
app/views/notes/_per_line_notes_with_reply.html.haml
+1
-1
app/views/notes/_per_line_reply_button.html.haml
app/views/notes/_per_line_reply_button.html.haml
+8
-2
No files found.
app/controllers/commit_controller.rb
View file @
9b919939
...
@@ -17,7 +17,9 @@ class CommitController < ProjectResourceController
...
@@ -17,7 +17,9 @@ class CommitController < ProjectResourceController
@note
=
result
[
:note
]
@note
=
result
[
:note
]
@line_notes
=
result
[
:line_notes
]
@line_notes
=
result
[
:line_notes
]
@notes_count
=
result
[
:notes_count
]
@notes_count
=
result
[
:notes_count
]
@comments_allowed
=
true
@comments_allowed
=
@reply_allowed
=
true
@comments_target
=
{
noteable_type:
'Commit'
,
noteable_id:
@commit
.
id
}
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
...
...
app/controllers/merge_requests_controller.rb
View file @
9b919939
...
@@ -34,7 +34,9 @@ class MergeRequestsController < ProjectResourceController
...
@@ -34,7 +34,9 @@ class MergeRequestsController < ProjectResourceController
@diffs
=
@merge_request
.
diffs
@diffs
=
@merge_request
.
diffs
@commit
=
@merge_request
.
last_commit
@commit
=
@merge_request
.
last_commit
@comments_allowed
=
true
@comments_allowed
=
@reply_allowed
=
true
@comments_target
=
{
noteable_type:
'MergeRequest'
,
noteable_id:
@merge_request
.
id
}
@line_notes
=
@merge_request
.
notes
.
where
(
"line_code is not null"
)
@line_notes
=
@merge_request
.
notes
.
where
(
"line_code is not null"
)
end
end
...
...
app/views/commits/_text_file.html.haml
View file @
9b919939
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
%td
.new_line
=
link_to
raw
(
type
==
"old"
?
" "
:
line_new
)
,
"#
#{
line_code
}
"
,
id:
line_code
%td
.new_line
=
link_to
raw
(
type
==
"old"
?
" "
:
line_new
)
,
"#
#{
line_code
}
"
,
id:
line_code
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
"line_code"
=>
line_code
}=
raw
"
#{
line
}
"
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
"line_code"
=>
line_code
}=
raw
"
#{
line
}
"
-
if
@
comments
_allowed
-
if
@
reply
_allowed
-
comments
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
line_code
}.
sort_by
(
&
:created_at
)
-
comments
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
line_code
}.
sort_by
(
&
:created_at
)
-
unless
comments
.
empty?
-
unless
comments
.
empty?
=
render
"notes/per_line_notes_with_reply"
,
notes:
comments
=
render
"notes/per_line_notes_with_reply"
,
notes:
comments
app/views/merge_requests/_show.html.haml
View file @
9b919939
...
@@ -7,11 +7,11 @@
...
@@ -7,11 +7,11 @@
-
if
@commits
.
present?
-
if
@commits
.
present?
%ul
.nav.nav-tabs.mr_nav_tabs
%ul
.nav.nav-tabs.mr_nav_tabs
%li
%li
=
link_to
"#notes"
,
"data-url"
=>
project_merge_request_path
(
@project
,
@merge_request
),
class:
"merge-notes-tab tab"
do
=
link_to
"#notes"
,
title:
"Comments"
,
"data-url"
=>
project_merge_request_path
(
@project
,
@merge_request
),
class:
"merge-notes-tab tab"
do
%i
.icon-comment
%i
.icon-comment
Comments
Comments
%li
%li
=
link_to
"#diffs"
,
"data-url"
=>
diffs_project_merge_request_path
(
@project
,
@merge_request
),
class:
"merge-diffs-tab tab"
do
=
link_to
"#diffs"
,
title:
"Diff"
,
"data-url"
=>
diffs_project_merge_request_path
(
@project
,
@merge_request
),
class:
"merge-diffs-tab tab"
do
%i
.icon-list-alt
%i
.icon-list-alt
Diff
Diff
...
...
app/views/notes/_create_per_line_note.js.haml
View file @
9b919939
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
// find the commented line ...
// find the commented line ...
var trEl = $(".
#{
note
.
line_code
}
").parent();
var trEl = $(".
#{
note
.
line_code
}
").parent();
// ... and insert the note and the reply button after it
// ... and insert the note and the reply button after it
trEl.after("
#{
escape_javascript
(
render
"notes/per_line_reply_button"
,
line_code:
note
.
line_cod
e
)
}
");
trEl.after("
#{
escape_javascript
(
render
"notes/per_line_reply_button"
,
note:
not
e
)
}
");
trEl.after("
#{
escape_javascript
(
render
"notes/per_line_note"
,
note:
note
)
}
");
trEl.after("
#{
escape_javascript
(
render
"notes/per_line_note"
,
note:
note
)
}
");
} else {
} else {
// instert new note before reply button
// instert new note before reply button
...
...
app/views/notes/_per_line_form.html.haml
View file @
9b919939
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
%td
{
colspan:
3
}
%td
{
colspan:
3
}
.line-note-form-holder
.line-note-form-holder
=
form_for
[
@project
,
@note
],
remote:
"true"
,
multipart:
true
do
|
f
|
=
form_for
[
@project
,
@note
],
remote:
"true"
,
multipart:
true
do
|
f
|
%h3
.page_title
Leave a
note
%h3
.page_title
Leave a
comment
%div
.span10
%div
.span10
-
if
@note
.
errors
.
any?
-
if
@note
.
errors
.
any?
.alert-message.block-message.error
.alert-message.block-message.error
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
=
f
.
text_area
:note
,
size:
255
,
class:
'line-note-text js-gfm-input'
=
f
.
text_area
:note
,
size:
255
,
class:
'line-note-text js-gfm-input'
.note_actions
.note_actions
.buttons
.buttons
=
f
.
submit
'Add
note
'
,
class:
"btn save-btn submit_note submit_inline_note"
,
id:
"submit_note"
=
f
.
submit
'Add
Comment
'
,
class:
"btn save-btn submit_note submit_inline_note"
,
id:
"submit_note"
=
link_to
"Cancel"
,
"#"
,
class:
"btn hide-button"
=
link_to
"Cancel"
,
"#"
,
class:
"btn hide-button"
.options
.options
%h6
.left
Notify via email:
%h6
.left
Notify via email:
...
...
app/views/notes/_per_line_note_link.html.haml
View file @
9b919939
=
link_to
""
,
"#"
,
class:
"line_note_link"
,
data:
{
line_code:
line_code
},
title:
"Add note for this line"
=
link_to
""
,
"#"
,
id:
"line-note-
#{
line_code
}
"
,
class:
"line_note_link"
,
data:
@comments_target
.
merge
({
line_code:
line_code
}),
title:
"Add comment on line
#{
line_code
[
/[0-9]+$/
]
}
"
app/views/notes/_per_line_notes_with_reply.html.haml
View file @
9b919939
-
notes
.
each
do
|
note
|
-
notes
.
each
do
|
note
|
=
render
"notes/per_line_note"
,
note:
note
=
render
"notes/per_line_note"
,
note:
note
=
render
"notes/per_line_reply_button"
,
line_code:
notes
.
first
.
line_code
=
render
"notes/per_line_reply_button"
,
note:
notes
.
first
app/views/notes/_per_line_reply_button.html.haml
View file @
9b919939
%tr
.line_notes_row.reply
%tr
.line_notes_row.reply
%td
{
colspan:
3
}
%td
{
colspan:
3
}
%i
.icon-comment
=
link_to
"#"
,
=
link_to
"Reply"
,
"#"
,
class:
"line_note_reply_link"
,
data:
{
line_code:
line_code
},
title:
"Add note for this line"
class:
"line_note_reply_link"
,
data:
{
line_code:
note
.
line_code
,
noteable_type:
note
.
noteable_type
,
noteable_id:
note
.
noteable_id
},
title:
"Add note for this line"
do
%i
.icon-comment
Reply
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment