Skip to content

Commit

Permalink
blog paginate -> pagy (publiclab#8446)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-wel authored and reginaalyssa committed Oct 16, 2021
1 parent 6786bd2 commit 40380ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions app/controllers/tag_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,7 @@ def widget

def blog
nids = Tag.find_nodes_by_type(params[:id], 'note', nil).collect(&:nid)
@notes = Node.paginate(page: params[:page], per_page: 6)
.where('status = 1 AND nid in (?)', nids)
.order('created DESC')
@pagy, @notes = pagy(Node.where('status = 1 AND nid in (?)', nids).order('created DESC'), items: 6)
@tags = Tag.where(name: params[:id])
@tagnames = @tags.collect(&:name).uniq! || []
@title = @tagnames.join(',') + ' Blog' if @tagnames
Expand Down
4 changes: 4 additions & 0 deletions app/views/tag/blog.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@
<% end %>

<div class="text-center">
<% if @pagy %>
<%== pagy_bootstrap_nav @pagy %>
<% else %>
<%= will_paginate @notes, renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated %>
<% end %>
</div>

<% end %>
Expand Down

0 comments on commit 40380ff

Please sign in to comment.