refactoring

This commit is contained in:
albert
2011-06-25 19:31:39 -04:00
parent 28d179708f
commit 739e28919a
11 changed files with 159 additions and 54 deletions

View File

@@ -0,0 +1,36 @@
module PostSetPresenters
class Post
attr_accessor :post_set, :tag_set_presenter
def initialize(post_set)
@post_set = post_set
@tag_set_presenter = TagSetPresenter.new(
RelatedTagCalculator.calculate_from_sample_to_array(
post_set.tag_string
).map {|x| x[0]}
)
end
def posts
post_set.posts
end
def tag_list_html(template)
tag_set_presenter.tag_list_html(template)
end
def post_previews_html(template)
html = ""
if posts.empty?
return template.render(:partial => "post_sets/blank")
end
posts.each do |post|
html << PostPresenter.preview(post)
end
html.html_safe
end
end
end