#1885: add prefetch for pools
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
class PostPresenter < Presenter
|
class PostPresenter < Presenter
|
||||||
|
attr_reader :pool, :next_post_in_pool
|
||||||
|
|
||||||
def self.preview(post, options = {})
|
def self.preview(post, options = {})
|
||||||
if post.is_deleted? && options[:tags] !~ /status:(?:all|any|deleted|banned)/ && !options[:raw]
|
if post.is_deleted? && options[:tags] !~ /status:(?:all|any|deleted|banned)/ && !options[:raw]
|
||||||
return ""
|
return ""
|
||||||
@@ -231,6 +233,7 @@ class PostPresenter < Presenter
|
|||||||
pool_html << '</span> '
|
pool_html << '</span> '
|
||||||
|
|
||||||
if pool.neighbors(@post).next
|
if pool.neighbors(@post).next
|
||||||
|
@next_post_in_pool = pool.neighbors(@post).next
|
||||||
pool_html << template.link_to("next ›".html_safe, template.post_path(pool.neighbors(@post).next, :pool_id => pool.id), :rel => next_rel, :class => "#{klass} next", :title => "to page #{pool.page_number(pool.neighbors(@post).next)}")
|
pool_html << template.link_to("next ›".html_safe, template.post_path(pool.neighbors(@post).next, :pool_id => pool.id), :rel => next_rel, :class => "#{klass} next", :title => "to page #{pool.page_number(pool.neighbors(@post).next)}")
|
||||||
match_found = true
|
match_found = true
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -116,6 +116,10 @@
|
|||||||
<meta name="twitter:image:width" content="<%= @post.image_width %>">
|
<meta name="twitter:image:width" content="<%= @post.image_width %>">
|
||||||
<meta name="twitter:image:height" content="<%= @post.image_height %>">
|
<meta name="twitter:image:height" content="<%= @post.image_height %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if @post.presenter.next_post_in_pool %>
|
||||||
|
<link rel="prefetch" href="<%= post_path(@post.presenter.next_post_in_pool, :pool_id => params[:pool_id]) %>">
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "posts/partials/common/secondary_links" %>
|
<%= render "posts/partials/common/secondary_links" %>
|
||||||
|
|||||||
Reference in New Issue
Block a user