added pagination for backend and sorting

This commit is contained in:
Harry Bomrah 2017-08-16 14:00:33 +08:00
parent d994a4fe78
commit f9ecd7d486
4 changed files with 4 additions and 1 deletions

View File

@ -93,7 +93,7 @@ class EPapersController < ApplicationController
def widget def widget
tags = OrbitHelper.widget_tags 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" paper_thumb = !paper.image.nil? && !paper.image.url.nil? ? paper.image.thumb.url : "http://www.placehold.it/400x400/EFEFEF/AAAAAA"
{ {
"title" => paper.title, "title" => paper.title,

View File

@ -46,6 +46,7 @@
</tbody> </tbody>
</table> </table>
<div class="bottomnav clearfix" style="left: 81px;"> <div class="bottomnav clearfix" style="left: 81px;">
<%= content_tag :div, paginate(@papers), class: "pagination pagination-centered" %>
<% if user_has_rights %> <% if user_has_rights %>
<div class="action pull-right"> <div class="action pull-right">
<a class="btn btn-primary" href="<%= new_admin_e_paper_path %>"> <a class="btn btn-primary" href="<%= new_admin_e_paper_path %>">

View File

@ -1,4 +1,5 @@
en: en:
module_name: "E Paper"
e_paper: e_paper:
e_paper: "e_Paper" e_paper: "e_Paper"
title: Title title: Title

View File

@ -1,4 +1,5 @@
zh_tw: zh_tw:
module_name: 電子報
e_paper: e_paper:
e_paper: "電子報" e_paper: "電子報"
title: "電子報名稱" title: "電子報名稱"