Sha256: 9172c3e1d13319071a7abf909b3401a2af34df0bc62238e8f40095a1f103966b

Contents?: true

Size: 1008 Bytes

Versions: 10

Compression:

Stored size: 1008 Bytes

Contents

module Proclaim
	module ApplicationHelper
		def comments_tree_for(comments)
			comments.map do |comment, nested_comments|
				commentHtml = render(partial: "proclaim/comments/comment",
				                     formats: [:html],
				                     locals: {
				                     	comment: comment,
				                     	target: "#comment_#{comment.id}_replies"
				                     })

				nestedComments = ""
				if nested_comments.size > 0
					nestedComments = comments_tree_for(nested_comments)
				end

				repliesHtml = content_tag(:div, nestedComments,
				                          id: "comment_#{comment.id}_replies",
				                          class: "replies")

				content_tag(:div, commentHtml + repliesHtml, class: "discussion")
			end.join.html_safe
		end

#		def timeago(time, options = {})
#			options[:class] ||= "timeago"
#			if time
#				content_tag(:time,
#					         time.to_s,
#					         options.merge(datetime: time.getutc.iso8601))
#			end
#		end
	end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
proclaim-0.3.1 app/helpers/proclaim/application_helper.rb
proclaim-0.3.0 app/helpers/proclaim/application_helper.rb
proclaim-0.2.4 app/helpers/proclaim/application_helper.rb
proclaim-0.2.2 app/helpers/proclaim/application_helper.rb
proclaim-0.2.1 app/helpers/proclaim/application_helper.rb
proclaim-0.2.0 app/helpers/proclaim/application_helper.rb
proclaim-0.1.3 app/helpers/proclaim/application_helper.rb
proclaim-0.1.2 app/helpers/proclaim/application_helper.rb
proclaim-0.1.1 app/helpers/proclaim/application_helper.rb
proclaim-0.1.0 app/helpers/proclaim/application_helper.rb