FEATURE: improve no-js topic list information
- Provide links to pages - Provied link to last topic
This commit is contained in:
parent
e3f31da861
commit
5db768b69f
|
@ -0,0 +1,20 @@
|
|||
module ListHelper
|
||||
def page_links(topic)
|
||||
posts = topic.posts_count
|
||||
max_pages = 10
|
||||
total_pages = (posts / TopicView.chunk_size) + (posts == TopicView.chunk_size ? 0 : 1)
|
||||
|
||||
return if total_pages < 2
|
||||
|
||||
page = [total_pages - (max_pages+1), 2].max
|
||||
|
||||
result = "("
|
||||
while page <= total_pages
|
||||
result << " <a href='#{topic.relative_url}?page=#{page}'>#{page}</a> "
|
||||
page += 1
|
||||
end
|
||||
|
||||
result << ")"
|
||||
result.html_safe
|
||||
end
|
||||
end
|
|
@ -21,10 +21,11 @@
|
|||
<a href='<%= t.relative_url %>' itemprop='item'>
|
||||
<span itemprop='name'><%= t.title %></span>
|
||||
</a>
|
||||
<%= page_links(t) %>
|
||||
<% if !@category && t.category %>
|
||||
<span>[<a href='<%= t.category.url %>'><%= t.category.name %></a>]</span>
|
||||
<% end %>
|
||||
<span title='<%= t 'posts' %>'>(<%= t.posts_count %>)</span>
|
||||
<span title='<%= t 'posts' %>'>(<a href="<%=t.last_post_url%>"><%= t.posts_count %></a>)</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue