This commit is contained in:
r888888888
2013-11-20 15:45:03 -08:00
parent ce55d57728
commit 231993b98e
11 changed files with 177 additions and 5 deletions

View File

@@ -20,7 +20,11 @@ class PostPresenter < Presenter
else
tag_param = nil
end
html << %{<a href="#{path}/#{post.id}#{tag_param}">}
if options[:mobile]
html << %{<a href="/m#{path}/#{post.id}#{tag_param}">}
else
html << %{<a href="#{path}/#{post.id}#{tag_param}">}
end
html << %{<img src="#{post.preview_file_url}" alt="#{h(post.tag_string)}">}
html << %{</a>}
html << %{</article>}

View File

@@ -4,7 +4,7 @@ module PostSetPresenters
raise NotImplementedError
end
def post_previews_html(template)
def post_previews_html(template, options = {})
html = ""
if posts.empty?
@@ -12,7 +12,7 @@ module PostSetPresenters
end
posts.each do |post|
html << PostPresenter.preview(post, :tags => @post_set.tag_string, :raw => @post_set.raw)
html << PostPresenter.preview(post, :tags => @post_set.tag_string, :raw => @post_set.raw, :mobile => options[:mobile])
html << "\n"
end

View File

@@ -48,8 +48,8 @@ module PostSetPresenters
RelatedTagCalculator.calculate_from_post_set_to_array(post_set).map(&:first)
end
def tag_list_html(template)
tag_set_presenter.tag_list_html(template)
def tag_list_html(template, options = {})
tag_set_presenter.tag_list_html(template, options)
end
end
end