fixes #609
This commit is contained in:
@@ -90,7 +90,7 @@ class PostPresenter < Presenter
|
|||||||
def pool_html(template)
|
def pool_html(template)
|
||||||
html = ["<ul>"]
|
html = ["<ul>"]
|
||||||
|
|
||||||
if template.params[:pool_id]
|
if template.params[:pool_id].present?
|
||||||
pool = Pool.where(:id => template.params[:pool_id]).first
|
pool = Pool.where(:id => template.params[:pool_id]).first
|
||||||
return if pool.nil?
|
return if pool.nil?
|
||||||
html = pool_link_html(html, template, pool)
|
html = pool_link_html(html, template, pool)
|
||||||
@@ -109,23 +109,31 @@ class PostPresenter < Presenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pool_link_html(html, template, pool)
|
def pool_link_html(html, template, pool)
|
||||||
html << "<li>"
|
pool_html = ["<li>"]
|
||||||
|
match_found = false
|
||||||
|
|
||||||
if pool.neighbors(@post).previous
|
if pool.neighbors(@post).previous
|
||||||
html << template.link_to("«prev".html_safe, template.post_path(pool.neighbors(@post).previous, :pool_id => pool.id), :rel => "prev")
|
pool_html << template.link_to("«prev".html_safe, template.post_path(pool.neighbors(@post).previous, :pool_id => pool.id), :rel => "prev")
|
||||||
|
match_found = true
|
||||||
else
|
else
|
||||||
html << "«prev"
|
pool_html << "«prev"
|
||||||
end
|
end
|
||||||
|
|
||||||
if pool.neighbors(@post).next
|
if pool.neighbors(@post).next
|
||||||
html << template.link_to("next»".html_safe, template.post_path(pool.neighbors(@post).next, :pool_id => pool.id), :rel => "next")
|
pool_html << template.link_to("next»".html_safe, template.post_path(pool.neighbors(@post).next, :pool_id => pool.id), :rel => "next")
|
||||||
|
match_found = true
|
||||||
else
|
else
|
||||||
html << "next»"
|
pool_html << "next»"
|
||||||
|
end
|
||||||
|
|
||||||
|
pool_html << " "
|
||||||
|
pool_html << template.link_to(pool.pretty_name, template.pool_path(pool))
|
||||||
|
pool_html << "</li>"
|
||||||
|
|
||||||
|
if match_found
|
||||||
|
html += pool_html
|
||||||
end
|
end
|
||||||
|
|
||||||
html << " "
|
|
||||||
html << template.link_to(pool.pretty_name, template.pool_path(pool))
|
|
||||||
html << "</li>"
|
|
||||||
html
|
html
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user