diff --git a/app/assets/stylesheets/osem.css.scss b/app/assets/stylesheets/osem.css.scss
index acab9a05..85f4337a 100644
--- a/app/assets/stylesheets/osem.css.scss
+++ b/app/assets/stylesheets/osem.css.scss
@@ -56,3 +56,15 @@ fieldset {
}
.bootstrap-switch { height: 1.7em }
+
+.comment-reply{
+ padding-top: 40px;
+}
+
+p.comment-body {
+ padding-top: 20px;
+}
+
+.well.comment-section {
+ padding-bottom: 40px;
+}
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ab888440..722384f0 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -146,31 +146,6 @@ module ApplicationHelper
end
end
- # TODO Output better html
- def format_comments(comment, padding = 0)
- result = ''
- result += "
"
- result += "
"
- result += "
#{comment.user.name} #{comment.created_at}"
- result += comment.body
- result += "
"
- result += "
'
- result += '
'
- #result += edit_admin_conference_event_path(@conference.short_title, @event)
- comment.children.each do |child|
- result += format_comments(child, 50)
- result += '
'
- end
-
- result
- end
-
def event_types(conference)
all = conference.event_types.map { |et | et.title.pluralize }
first = all[0...-1]
diff --git a/app/views/admin/events/_nested_comments.html.haml b/app/views/admin/events/_nested_comments.html.haml
new file mode 100644
index 00000000..24c641f8
--- /dev/null
+++ b/app/views/admin/events/_nested_comments.html.haml
@@ -0,0 +1,15 @@
+%div{style: "padding-left:#{padding}px"}
+ .well.comment-section
+ %strong= comment.user.name
+ %i= comment.created_at
+ %p.comment-body= comment.body
+ %div
+ %a.pull-right.comment-reply-link{href: "#"} Reply
+ .comment-reply
+ = form_tag "#{comment_admin_conference_event_path(@conference.short_title, comment.commentable_id)}", method: :post do
+ %input{name: "parent", type: "hidden", value: "#{comment.id}"}
+ %input{name: "authenticity_token", type: "hidden", value: "#{form_authenticity_token}"}
+ %textarea{name: "comment"}
+ %button.btn.btn-primary.pull-right{name: "button", type: "submit"} Add Reply
+ - comment.children.each do |child|
+ = render "nested_comments", comment: child, padding: 50
diff --git a/app/views/admin/events/_proposal.html.haml b/app/views/admin/events/_proposal.html.haml
index 6ec74ec4..03160090 100644
--- a/app/views/admin/events/_proposal.html.haml
+++ b/app/views/admin/events/_proposal.html.haml
@@ -141,4 +141,4 @@
%br
- @comments.each do |comment|
%div
- = raw format_comments(comment)
+ = render "nested_comments", comment: comment, padding: 0