diff --git a/app/controllers/admin/honors_controller.rb b/app/controllers/admin/honors_controller.rb index 9af5f76..0c500e8 100644 --- a/app/controllers/admin/honors_controller.rb +++ b/app/controllers/admin/honors_controller.rb @@ -5,7 +5,7 @@ class Admin::HonorsController < OrbitMemberController before_action :get_settings,:only => [:new, :edit, :setting] def index - @honors = Honor.all + @honors = Honor.order_by(:year=>'desc').page(params[:page]).per(10) end def new diff --git a/app/controllers/personal_honors_controller.rb b/app/controllers/personal_honors_controller.rb index 2fc0739..b0ef06c 100644 --- a/app/controllers/personal_honors_controller.rb +++ b/app/controllers/personal_honors_controller.rb @@ -1,6 +1,6 @@ class PersonalHonorsController < ApplicationController def index - honors = Honor.where(:is_hidden=>false).all + honors = Honor.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) honor_list = honors.collect do |honor| { "year" => honor.year, @@ -19,7 +19,8 @@ class PersonalHonorsController < ApplicationController "th_awarding_unit" => t('personal_honor.awarding_unit'), "th_award_winner" => t('personal_honor.award_winner'), "th_detail" => t('detail') - } + }, + "total_pages" => honors.total_pages } end diff --git a/app/views/admin/honors/index.html.erb b/app/views/admin/honors/index.html.erb index ef60eac..4ba2370 100644 --- a/app/views/admin/honors/index.html.erb +++ b/app/views/admin/honors/index.html.erb @@ -8,7 +8,7 @@
- <%= render :partial => 'honor', :collection => @honors %> + <%= render 'honor' %> @@ -17,5 +17,6 @@ <%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_honor_setting_path, :class => 'btn btn-primary pull-right' %>