Guest User

Untitled

a guest
Jul 25th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. diff --git a/app/views/orders/index.js.erb b/app/views/orders/index.js.erb
  2. index 439f038..9888fbd 100644
  3. --- a/app/views/orders/index.js.erb
  4. +++ b/app/views/orders/index.js.erb
  5. @@ -1,3 +1,16 @@
  6. $("#order_lis_container").html("<%= escape_javascript(render partial: 'orders/list_orders',locals: {orders: @orders} ) %>");
  7.  
  8. -$('.pagination').replaceWith('<%= j paginate(@orders) %>');
  9. \ No newline at end of file
  10. +<% data = j paginate(@orders) %>
  11. +<% if data.blank? %>
  12. + $('.pagination').hide();
  13. +<% else %>
  14. + $('.pagination').show();
  15. + $('.pagination').replaceWith('<%= data %>');
  16. +<% end %>
  17. +
  18. +$(".paginate_collection a").click(function(e){
  19. + e.preventDefault();
  20. + var thisObj = $(this);
  21. + $("#page").val( parseInt($.trim(thisObj.text())) || parseInt($.trim(getUrlParameter('page',thisObj.attr("href")))) || "");
  22. + $("#search_form").submit();
  23. +});
  24. \ No newline at end of file
Add Comment
Please, Sign In to add comment