forked from saurabh/personal-lab
Pagination
This commit is contained in:
parent
27eb2857d0
commit
53465b9831
|
@ -5,7 +5,7 @@ class Admin::LabsController < OrbitMemberController
|
|||
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||
|
||||
def index
|
||||
@labs = Lab.all
|
||||
@labs = Lab.order_by(:year=>'desc').page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class PersonalLabsController < ApplicationController
|
||||
def index
|
||||
labs = Lab.where(:is_hidden=>false).all
|
||||
labs = Lab.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
lab_list = labs.collect do |lab|
|
||||
{
|
||||
"year" => lab.year,
|
||||
|
@ -19,7 +19,8 @@ class PersonalLabsController < ApplicationController
|
|||
"th_location" => t('personal_lab.location'),
|
||||
"th_member" => t('users.name'),
|
||||
"th_detail" => t('detail')
|
||||
}
|
||||
},
|
||||
"total_pages" => labs.total_pages
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_labs" class="sort-holder">
|
||||
<%= render :partial => 'lab', :collection => @labs %>
|
||||
<%= render 'lab' %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="pagination pagination-centered">
|
||||
<%= content_tag :div, paginate(@labs), class: "pagination pagination-centered" %>
|
||||
</div>
|
||||
</div>
|
|
@ -14,6 +14,7 @@ module PersonalLab
|
|||
|
||||
frontend_enabled
|
||||
icon_class_no_sidebar "icons-user"
|
||||
data_count 1..10
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue