Guest User

Untitled

a guest
May 27th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. diff --git a/app/controllers/flows_controller.rb b/app/controllers/flows_controller.rb
  2. index a1bf97d..05d655b 100644
  3. --- a/app/controllers/flows_controller.rb
  4. +++ b/app/controllers/flows_controller.rb
  5. @@ -349,16 +349,29 @@ class FlowsController < BaseSpacesController
  6.  
  7. @limit = params[:limit].to_i if params[:limit]
  8. @limit ||= 20
  9. + @page=params[:page].blank? ? 1 : params[:page]
  10.  
  11. case flow_filter_view_type
  12. when 'priority'
  13. - @flow_items_pages, @flow_items = paginate :flows, :per_page => @limit, :order => 'priority ASC, flows.created_at DESC', :conditions => [ '(' + filter_sql + ") and space_id = ? and approved = ?", @space.id, true], :include => :user
  14. + @flow_items = Flow.paginate(:page=>@page, :per_page => @limit,
  15. + :order => 'priority ASC, flows.created_at DESC',
  16. + :conditions => [ '(' + filter_sql + ") and space_id = ? and approved = ?", @space.id, true],
  17. + :include => :user)
  18. when 'date'
  19. - @flow_items_pages, @flow_items = paginate :flows, :per_page => @limit, :order => 'flows.created_at DESC', :conditions => ['(' + filter_sql + ") and space_id = ? and approved = ?", @space.id, true], :include => :user
  20. + @flow_items = Flow.paginate(:page=>@page, :per_page => @limit,
  21. + :order => 'flows.created_at DESC',
  22. + :conditions => ['(' + filter_sql + ") and space_id = ? and approved = ?", @space.id, true],
  23. + :include => :user)
  24. when 'outline'
  25. - @flow_items_pages, @flow_items = paginate :flows, :per_page => @limit, :order => 'flows.thread_started_at DESC, lft', :conditions => ['(' + filter_sql + ") and space_id = ? and approved = ?", @space.id, true], :include => :user
  26. + @flow_items = Flow.paginate(:page=>@page, :per_page => @limit,
  27. + :order => 'flows.thread_started_at DESC, lft',
  28. + :conditions => ['(' + filter_sql + ") and space_id = ? and approved = ?", @space.id, true],
  29. + :include => :user)
  30. else # empty or threaded
  31. - @flow_items_pages, @flow_items = paginate :flows, :per_page => @limit, :order => 'flows.created_at DESC', :conditions => ['(' + filter_sql + ') and depth=0 and space_id=? and approved = 1', @space.id], :include => :user
  32. + @flow_items = Flow.paginate(:page=>@page,:per_page => @limit,
  33. + :order => 'flows.created_at DESC',
  34. + :conditions => ['(' + filter_sql + ') and depth=0 and space_id=? and approved = 1', @space.id],
  35. + :include => :user)
  36. end
  37. end
  38.  
  39. diff --git a/app/views/flows/_list_items.rhtml b/app/views/flows/_list_items.rhtml
  40. index db5c8e6..be3aa92 100644
  41. --- a/app/views/flows/_list_items.rhtml
  42. +++ b/app/views/flows/_list_items.rhtml
  43. @@ -4,27 +4,15 @@
  44. <% if @flow_items.empty? %>
  45. <p class="note"><%= _("No items found.") %></p>
  46. <% else %>
  47. -
  48. <ul>
  49. <%= render :partial => "list_items_#{@flow_filter['viewtype'].downcase}" %>
  50. </ul>
  51. -
  52. - <% if @flow_items_pages.page_count > 1 -%>
  53. - <div class="page-list">Pages: <% pagination_links_each(@flow_items_pages, :link_to_current_page => true) do |n|
  54. - if(params[:page] == n.to_s || (params[:page].nil? && n == 1)) %>
  55. - <%= n %>
  56. - <% else %>
  57. - <% if @image_tool_comments%>
  58. - <%= link_to n, { :action => "index", :id => @space.id, :document_id => params[:document_id], :page => n }, :id => 'page_link_' + n.to_s %>
  59. - <% else %>
  60. - <%= link_to n, { :action => "flow", :id => @space.id, :page => n }, :id => 'page_link_' + n.to_s %>
  61. - <% end%>
  62. - <% end %>
  63. - <!-- end do -->
  64. - <% end %>
  65. - </div>
  66. -
  67. - <% end -%>
  68. +
  69. + <% if @image_tool_comments%>
  70. + <%=will_paginate @flow_items,:params=>{:action => "index", :id => @space.id, :document_id => params[:document_id]} %>
  71. + <% else %>
  72. + <%=will_paginate @flow_items,:params=>{:action => "flow", :id => @space.id} %>
  73. + <% end %>
  74.  
  75. <% end %>
Add Comment
Please, Sign In to add comment