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]
|
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@labs = Lab.all
|
@labs = Lab.order_by(:year=>'desc').page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class PersonalLabsController < ApplicationController
|
class PersonalLabsController < ApplicationController
|
||||||
def index
|
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|
|
lab_list = labs.collect do |lab|
|
||||||
{
|
{
|
||||||
"year" => lab.year,
|
"year" => lab.year,
|
||||||
|
@ -19,7 +19,8 @@ class PersonalLabsController < ApplicationController
|
||||||
"th_location" => t('personal_lab.location'),
|
"th_location" => t('personal_lab.location'),
|
||||||
"th_member" => t('users.name'),
|
"th_member" => t('users.name'),
|
||||||
"th_detail" => t('detail')
|
"th_detail" => t('detail')
|
||||||
}
|
},
|
||||||
|
"total_pages" => labs.total_pages
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,12 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="tbody_labs" class="sort-holder">
|
<tbody id="tbody_labs" class="sort-holder">
|
||||||
<%= render :partial => 'lab', :collection => @labs %>
|
<%= render 'lab' %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="bottomnav clearfix">
|
<div class="bottomnav clearfix">
|
||||||
<div class="pagination pagination-centered">
|
<div class="pagination pagination-centered">
|
||||||
|
<%= content_tag :div, paginate(@labs), class: "pagination pagination-centered" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -14,6 +14,7 @@ module PersonalLab
|
||||||
|
|
||||||
frontend_enabled
|
frontend_enabled
|
||||||
icon_class_no_sidebar "icons-user"
|
icon_class_no_sidebar "icons-user"
|
||||||
|
data_count 1..10
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue