From 999b3957633606e5ec09ff168c0daa12f3a2915b Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 30 Jan 2015 17:26:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Kaminari=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=96=87=E4=BB=B6=EF=BC=8C=20=5Fpaginator.ht?= =?UTF-8?q?ml.erb=20=E8=BF=99=E6=98=AF=E6=80=BB=E7=9A=84=E5=85=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E5=8F=AF=E4=BB=A5=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=83=E6=9D=A5=E8=B0=83=E6=95=B4=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E6=95=B4=E4=BD=93=E7=BB=93=E6=9E=84=20?= =?UTF-8?q?=E6=AF=94=E5=A6=82=E6=88=91=E4=B8=8D=E9=9C=80=E8=A6=81=E2=80=9C?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E2=80=9D=EF=BC=8C=E2=80=9D=E6=9C=AB=E9=A1=B5?= =?UTF-8?q?=E2=80=9C=E8=BF=99=E4=B8=A4=E4=B8=AA=E9=93=BE=E6=8E=A5=EF=BC=8C?= =?UTF-8?q?=E9=82=A3=E4=B9=88=E6=88=91=E5=B0=B1=E5=9C=A8=E8=BF=99=E4=B8=AA?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=87=8C=E9=9D=A2=E5=B0=86=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81=E5=88=A0=E9=99=A4=20=5Fpage.html.er?= =?UTF-8?q?b=20=E5=AF=B9=E5=BA=94=E9=A1=B5=E7=A0=81=E9=93=BE=E6=8E=A5=20?= =?UTF-8?q?=5Ffirst=5Fpage.html.erb=20/=20=5Flast=5Fpage.html.erb=20?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E2=80=9C=E9=A6=96=E9=A1=B5=E2=80=9D=E5=92=8C?= =?UTF-8?q?=E2=80=9C=E6=9C=AB=E9=A1=B5=E2=80=9D=E7=9A=84=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=20=5Fprev=5Fpage.html.erb=20/=20=5Fnext=5Fpage.html.erb=20?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E2=80=9C=E4=B8=8A=E4=B8=80=E9=A1=B5=E2=80=9D?= =?UTF-8?q?=E5=92=8C=E2=80=9C=E4=B8=8B=E4=B8=80=E9=A1=B5=E2=80=9D=E7=9A=84?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=20=5Fgap.html.erb=20=E7=A9=BA=E9=9A=99?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA=EF=BC=8C=E9=BB=98=E8=AE=A4=E6=98=AF?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E7=9A=84=E7=9C=81=E7=95=A5=E5=8F=B7(...)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/kaminari/_first_page.html.erb | 11 +++++++++++ app/views/kaminari/_gap.html.erb | 8 ++++++++ app/views/kaminari/_last_page.html.erb | 11 +++++++++++ app/views/kaminari/_next_page.html.erb | 11 +++++++++++ app/views/kaminari/_page.html.erb | 13 +++++++++++++ app/views/kaminari/_paginator.html.erb | 23 +++++++++++++++++++++++ app/views/kaminari/_prev_page.html.erb | 11 +++++++++++ 7 files changed, 88 insertions(+) create mode 100644 app/views/kaminari/_first_page.html.erb create mode 100644 app/views/kaminari/_gap.html.erb create mode 100644 app/views/kaminari/_last_page.html.erb create mode 100644 app/views/kaminari/_next_page.html.erb create mode 100644 app/views/kaminari/_page.html.erb create mode 100644 app/views/kaminari/_paginator.html.erb create mode 100644 app/views/kaminari/_prev_page.html.erb diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb new file mode 100644 index 000000000..ec2c75026 --- /dev/null +++ b/app/views/kaminari/_first_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "First" page + - available local variables + url: url to the first page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless current_page.first?, l('views.pagination.first').html_safe, url, :remote => remote %> + diff --git a/app/views/kaminari/_gap.html.erb b/app/views/kaminari/_gap.html.erb new file mode 100644 index 000000000..258fd29b2 --- /dev/null +++ b/app/views/kaminari/_gap.html.erb @@ -0,0 +1,8 @@ +<%# Non-link tag that stands for skipped pages... + - available local variables + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb new file mode 100644 index 000000000..410d05c55 --- /dev/null +++ b/app/views/kaminari/_last_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "Last" page + - available local variables + url: url to the last page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote %> + diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb new file mode 100644 index 000000000..d119475ff --- /dev/null +++ b/app/views/kaminari/_next_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "Next" page + - available local variables + url: url to the next page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote %> + diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb new file mode 100644 index 000000000..91aa63a46 --- /dev/null +++ b/app/views/kaminari/_page.html.erb @@ -0,0 +1,13 @@ +<%# Link showing page number + - available local variables + page: a page object for "this" page + url: url to this page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote + <%= link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} +-%> + + <%= link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> + diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb new file mode 100644 index 000000000..04f03c02c --- /dev/null +++ b/app/views/kaminari/_paginator.html.erb @@ -0,0 +1,23 @@ +<%# The container tag + - available local variables + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote + paginator: the paginator that renders the pagination tags inside +-%> +<%= paginator.render do -%> +