Skip to content

Commit

Permalink
Added pagination to limit the revisions of a wiki page at a time in R…
Browse files Browse the repository at this point in the history
…evision Tab to 20 (#2707)
  • Loading branch information
namangupta01 authored and jywarren committed May 10, 2018
1 parent 5f649b8 commit bfff566
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
12 changes: 12 additions & 0 deletions Gemfile.lock
Expand Up @@ -218,6 +218,7 @@ GEM
mini_portile2 (~> 2.3.0)
nokogumbo (1.5.0)
nokogiri
oauth (0.5.4)
oauth2 (1.4.0)
faraday (>= 0.8, < 0.13)
jwt (~> 1.0)
Expand All @@ -229,13 +230,22 @@ GEM
rack (>= 1.6.2, < 3)
omniauth-facebook (3.0.0)
omniauth-oauth2 (~> 1.2)
omniauth-github (1.3.0)
omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0, < 2.0)
omniauth-google-oauth2 (0.5.3)
jwt (>= 1.5)
omniauth (>= 1.1.1)
omniauth-oauth2 (>= 1.5)
omniauth-oauth (1.1.0)
oauth
omniauth (~> 1.0)
omniauth-oauth2 (1.5.0)
oauth2 (~> 1.1)
omniauth (~> 1.2)
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
rack
options (2.3.2)
paperclip (5.2.1)
activemodel (>= 4.2.0)
Expand Down Expand Up @@ -445,7 +455,9 @@ DEPENDENCIES
nifty-generators
omniauth (~> 1.3, >= 1.3.1)
omniauth-facebook (~> 3.0)
omniauth-github (~> 1.1, >= 1.1.2)
omniauth-google-oauth2
omniauth-twitter
paperclip (~> 5.2.0)
passenger
php-serialize
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/wiki_controller.rb
Expand Up @@ -266,9 +266,10 @@ def revisions
@node = Node.find_wiki(params[:id])
if @node
@revisions = @node.revisions
@revisions = @revisions.where(status: 1) unless current_user && current_user.can_moderate?
@revisions = @revisions.where(status: 1).page(params[:page]).per_page(20) unless current_user && current_user.can_moderate?
@title = I18n.t('wiki_controller.revisions_for', title: @node.title).html_safe
@tags = @node.tags
@paginated = true unless current_user && current_user.can_moderate?
else
flash[:error] = I18n.t('wiki_controller.invalid_wiki_page')
end
Expand Down
7 changes: 4 additions & 3 deletions app/views/wiki/revisions.html.erb
Expand Up @@ -46,9 +46,9 @@
<% end %>
</table>

<hr />
</div>
<hr />
<%= will_paginate @revisions, :renderer => BootstrapPagination::Rails if @paginated %>
</div>
<div class="col-md-7">
<div class="btn-group pull-right">
<a class="btn btn-link" href="javascript:void(0)" onClick="prev()">&laquo;</a>
Expand Down Expand Up @@ -123,3 +123,4 @@

<% end %>
</div>

0 comments on commit bfff566

Please sign in to comment.