* Factor out the post navbar into a component. The post navbar is the part of the post containing the current search, the list of pools, and the list of favgroups, along with next/prev navigation links. * Change navbar markup: remove various unused CSS classes/IDs, change pools to use same markup as favgroups, replace nested <div>'s with flat <ul>/<li> list. * Use CSS to truncate long searches/pool names/favgroup names if they're too wide for the screen (especially on mobile).
21 lines
591 B
Ruby
21 lines
591 B
Ruby
class PostPresenter
|
|
attr_reader :pool, :next_post_in_pool
|
|
delegate :tag_list_html, :split_tag_list_html, :split_tag_list_text, :inline_tag_list_html, to: :tag_set_presenter
|
|
|
|
def initialize(post)
|
|
@post = post
|
|
end
|
|
|
|
def tag_set_presenter
|
|
@tag_set_presenter ||= TagSetPresenter.new(@post.tag_array)
|
|
end
|
|
|
|
def humanized_essential_tag_string
|
|
@humanized_essential_tag_string ||= tag_set_presenter.humanized_essential_tag_string.presence || "##{@post.id}"
|
|
end
|
|
|
|
def filename_for_download
|
|
"#{humanized_essential_tag_string} - #{@post.md5}.#{@post.file_ext}"
|
|
end
|
|
end
|