Pagination

This commit is contained in:
manson 2014-07-18 14:32:13 +08:00
parent 120ee02f0c
commit 63284212e5
4 changed files with 9 additions and 9 deletions

View File

@ -5,7 +5,7 @@ class Admin::DiplomasController < OrbitMemberController
before_action :get_settings,:only => [:new, :edit, :setting]
def index
@diplomas = Diploma.all
@diplomas = Diploma.order_by(:end_date=>'desc',:start_date=>'desc').page(params[:page]).per(10)
end
def new

View File

@ -1,6 +1,6 @@
class PersonalDiplomasController < ApplicationController
def index
diplomas = Diploma.where(:is_hidden=>false).all
diplomas = Diploma.where(:is_hidden=>false).order_by(:end_date=>'desc', :start_date=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
diploma_list = diplomas.collect do |diploma|
{
"member" => diploma.member_profile.name,
@ -19,7 +19,8 @@ class PersonalDiplomasController < ApplicationController
"th_school_name" => t('personal_diploma.school_name'),
"th_degree" => t('personal_diploma.degree'),
"th_detail" => t('detail')
}
},
"total_pages" => diplomas.total_pages
}
end

View File

@ -8,14 +8,12 @@
</tr>
</thead>
<tbody id="tbody_diplomas" class="sort-holder">
<%= render :partial => 'diploma', :collection => @diplomas %>
<%= render 'diploma' %>
</tbody>
</table>
<!-- <div class="bottomnav clearfix">
<div class="action pull-right">
<%#= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_diploma_setting_path, :class => 'btn btn-primary pull-right' %>
</div>
<div class="bottomnav clearfix">
<div class="pagination pagination-centered">
<%= content_tag :div, paginate(@diplomas), class: "pagination pagination-centered" %>
</div>
</div> -->
</div>

View File

@ -14,6 +14,7 @@ module PersonalDiploma
frontend_enabled
icon_class_no_sidebar "icons-user"
data_count 1..10
end
end
end