summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-24 13:34:46 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-24 13:34:46 +0300
commita49d45db419bcba4cb80919bdb3e1699725b15ce (patch)
tree0f146435aee06c34b5cc4f88a8d72cf7819676f1
parent2d9667df264dae9a11fe58f8320a716d61e48e06 (diff)
downloadgitlab-ce-a49d45db419bcba4cb80919bdb3e1699725b15ce.tar.gz
Move reply button to helper from view
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/helpers/notes_helper.rb17
-rw-r--r--app/views/projects/notes/_diff_notes_with_reply.html.haml3
-rw-r--r--app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml4
-rw-r--r--app/views/projects/notes/_discussion.html.haml2
-rw-r--r--app/views/projects/notes/_discussion_reply_button.html.haml10
5 files changed, 21 insertions, 15 deletions
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 9ed38ba84b2..c0135b77128 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -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
diff --git a/app/views/projects/notes/_diff_notes_with_reply.html.haml b/app/views/projects/notes/_diff_notes_with_reply.html.haml
index 9acadc6a14e..6ec9169d432 100644
--- a/app/views/projects/notes/_diff_notes_with_reply.html.haml
+++ b/app/views/projects/notes/_diff_notes_with_reply.html.haml
@@ -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)
diff --git a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml
index 399ce30d1a9..02f189f7c5a 100644
--- a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml
+++ b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml
@@ -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= ""
diff --git a/app/views/projects/notes/_discussion.html.haml b/app/views/projects/notes/_discussion.html.haml
index 78793eb860f..b4bbfdc3f44 100644
--- a/app/views/projects/notes/_discussion.html.haml
+++ b/app/views/projects/notes/_discussion.html.haml
@@ -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)
diff --git a/app/views/projects/notes/_discussion_reply_button.html.haml b/app/views/projects/notes/_discussion_reply_button.html.haml
deleted file mode 100644
index d1c5ccc29db..00000000000
--- a/app/views/projects/notes/_discussion_reply_button.html.haml
+++ /dev/null
@@ -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