Move reply button to helper from view

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-06-24 13:34:46 +03:00
parent 2d9667df26
commit a49d45db41
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
5 changed files with 21 additions and 15 deletions

View file

@ -61,4 +61,21 @@ module NotesHelper
link_to "", "javascript:;", class: "add-diff-note js-add-diff-note-button",
data: data, title: "Add a comment to this line"
end
def link_to_reply_diff(note)
data = {
noteable_type: note.noteable_type,
noteable_id: note.noteable_id,
commit_id: note.commit_id,
line_code: note.line_code,
discussion_id: note.discussion_id
}
link_to "javascript:;", class: "btn reply-btn js-discussion-reply-button",
data: data, title: "Add a reply" do
link_text = ""
link_text < content_tag(:i, nil, class: 'icon-comment')
link_text << "Reply"
end
end
end

View file

@ -9,5 +9,4 @@
%td.notes_content
%ul.notes{ rel: note.discussion_id }
= render notes
= render "projects/notes/discussion_reply_button", note: note
= link_to_reply_diff(note)

View file

@ -12,7 +12,7 @@
%ul.notes{ rel: note1.discussion_id }
= render notes1
= render "projects/notes/discussion_reply_button", note: note1
= link_to_reply_diff(note1)
- else
%td= ""
%td= ""
@ -26,7 +26,7 @@
%ul.notes{ rel: note2.discussion_id }
= render notes2
= render "projects/notes/discussion_reply_button", note: note2
= link_to_reply_diff(note2)
- else
%td= ""
%td= ""

View file

@ -43,4 +43,4 @@
- else
.notes{ rel: discussion_notes.first.discussion_id }
= render discussion_notes
= render "projects/notes/discussion_reply_button", note: discussion_notes.first
= link_to_reply_diff(discussion_notes.first)

View file

@ -1,10 +0,0 @@
= link_to "javascript:;",
class: "btn reply-btn js-discussion-reply-button",
data: { noteable_type: note.noteable_type,
noteable_id: note.noteable_id,
commit_id: note.commit_id,
line_code: note.line_code,
discussion_id: note.discussion_id },
title: "Add a reply" do
%i.icon-comment
Reply