Slide 14
Slide 14 text
class PostItemComponentBuilder < ComponentBuilder
def self.build(post)
post_path = UrlGenerator.post_path(post)
PostItemComponent.new(
:title_link => Link.new(post.name, post_path),
:description => post.description,
:views => post.view_count,
:post_thumbnail =>
PostThumbnailComponentBuilder.build(post),
:comments => post.comments.published.count,
:edit_link => Link.new("Edit Post",
UrlGenerator.edit_post_path(post)),
:status_class => build_status_class(post),
:status_text => build_status_text(post),
:delete_button =>
DeleteButtonComponentBuilder.build(post)
)
end
#...
end
lib/post_item_component_builder.rb