Merge remote-tracking branch 'remotes/origin/dev_zanle' into szzh

This commit is contained in:
alan 2015-01-31 10:46:29 +08:00
commit 7710af316d
12 changed files with 163 additions and 7 deletions

View File

@ -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 %>

View File

@ -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
-%>

View File

@ -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 %>

View File

@ -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 %>

View File

@ -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} %>

View File

@ -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 -%>
<div class="pagination">
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<% end -%>
<% end -%>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
</div>
<% end -%>

View File

@ -0,0 +1,11 @@
<%# Link to the "Previous" page
- available local variables
url: url to the previous 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?, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote %>

View File

@ -104,11 +104,11 @@
</div>
<% end %>
<div class="pagination">
<ul>
<%= paginate @project_pages %>
</ul>
</div>
<%= paginate @project_pages %>
<% if User.current.logged? %>
<p style="text-align:right;">

View File

@ -0,0 +1,32 @@
# Time 2015-01-30 17:04:12
# Author lizanle
# Description kaminari配置文件
# <%= paginate @users, :window => 2 %>
# 则展示页会像 5 6 7 8 9 当7是当前页的时候
# <%= paginate @users, :outer_window => 3 %>
# 分页展示会像 1 2 3 4 ...(snip)... 17 18 19 20 当总共有20个页面的时候
# <%= paginate @users, :left => 1, :right => 3 %>
# 分页展示会像 1 ...(snip)... 18 19 20 当总共有20个页面的时候
# <%= paginate @users, :param_name => :pagina %>
# 这样子会将每个链接传进去一个参数 :pagina
# <%= paginate @users, :params => {:controller => 'foo', :action => 'bar'} %>
# 这样子将会修改每个链接的控制器和动作. :controller and :action
# <%= paginate @users, :remote => true %>
# 这将会使每个链接使用ajax方式极其简单非常完美的工作。data-remote="true"
#更多知识详见 https://github.com/honwlee/kaminari
Kaminari.configure do |config|
# config.default_per_page = 25
# config.max_per_page = nil
# config.window = 4
# config.outer_window = 3
# config.left = 0
# config.right = 0
# config.page_method_name = :page
# config.param_name = :page
end

View File

@ -0,0 +1,22 @@
# Time 2015-01-30 17:02:41
# Author lizanle
# Description 打开redmine\ruby\lib\ruby\gems\1.9.1\gems\actionpack-3.2.13\lib\action_view\helpers\UrlHelper重写link_to_unless方法
# 如果是当前页则给当前页添加样式class=>'current-page'
module ActionView
# = Action View URL Helpers
module Helpers #:nodoc:
# Provides a set of methods for making links and getting URLs that
# depend on the routing subsystem (see ActionDispatch::Routing).
# This allows you to use the same format for links in views
# and controllers.
module UrlHelper
def link_to_unless(condition, name, options = {}, html_options = {}, &block)
if condition
link_to(name, options, html_options.merge(:class => 'current-page'))
else
link_to(name, options, html_options)
end
end
end
end
end

View File

@ -2926,7 +2926,7 @@ input[class~='m3p10'], .m3p10 {
.search_results {
color: red;
}
/*lizanle 分页样式*/
/*lizanle 分页样式
.pagination ul li a, .pagination ul li span{
background-color: #FFFFFF;
border-color: #DDDDDD;
@ -2951,3 +2951,4 @@ input[class~='m3p10'], .m3p10 {
list-style: none outside none;
}
*/

View File

@ -2259,3 +2259,16 @@ ul.messages-for-user-reply li {
.footer_text_link{
margin: 0px 5px;
}
/**kaminari 分頁當前頁樣式**/
div.pagination a.current-page {
/*color: rgb(153, 153, 153); add by huang*/
/*color:#e2f4ff;*/
cursor: default;
}
div.pagination a.current-page {
/*background-color: rgb(245, 245, 245); add by huang*/
background-color:#e2f4ff;
}
/**kaminari 分頁樣式**/