From f9ecd7d486ea690c71112845de1af8cf471d5053 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 16 Aug 2017 14:00:33 +0800 Subject: [PATCH] added pagination for backend and sorting --- app/controllers/e_papers_controller.rb | 2 +- app/views/admin/e_papers/_index.html.erb | 1 + config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/e_papers_controller.rb b/app/controllers/e_papers_controller.rb index db8767a..0f2a7a3 100644 --- a/app/controllers/e_papers_controller.rb +++ b/app/controllers/e_papers_controller.rb @@ -93,7 +93,7 @@ class EPapersController < ApplicationController def widget tags = OrbitHelper.widget_tags - papers = Paper.filter_by_widget_categories.filter_by_tags(tags).collect do |paper| + papers = Paper.filter_by_widget_categories.filter_by_tags(tags).collect.desc(:period) do |paper| paper_thumb = !paper.image.nil? && !paper.image.url.nil? ? paper.image.thumb.url : "http://www.placehold.it/400x400/EFEFEF/AAAAAA" { "title" => paper.title, diff --git a/app/views/admin/e_papers/_index.html.erb b/app/views/admin/e_papers/_index.html.erb index 246b145..fc92509 100644 --- a/app/views/admin/e_papers/_index.html.erb +++ b/app/views/admin/e_papers/_index.html.erb @@ -46,6 +46,7 @@
+ <%= content_tag :div, paginate(@papers), class: "pagination pagination-centered" %> <% if user_has_rights %>