diff --git a/app/controllers/admin/experiences_controller.rb b/app/controllers/admin/experiences_controller.rb index 10eb579..1c70e29 100644 --- a/app/controllers/admin/experiences_controller.rb +++ b/app/controllers/admin/experiences_controller.rb @@ -5,7 +5,7 @@ class Admin::ExperiencesController < OrbitMemberController before_action :get_settings,:only => [:new, :edit, :setting] def index - @experiences = Experience.all + @experiences = Experience.order_by(:end_date=>'desc',:start_date=>'desc').page(params[:page]).per(10) end def new diff --git a/app/controllers/personal_experiences_controller.rb b/app/controllers/personal_experiences_controller.rb index ec9fcfb..272f154 100644 --- a/app/controllers/personal_experiences_controller.rb +++ b/app/controllers/personal_experiences_controller.rb @@ -1,6 +1,6 @@ class PersonalExperiencesController < ApplicationController def index - experiences = Experience.where(:is_hidden=>false).all + experiences = Experience.where(:is_hidden=>false).order_by(:end_date=>'desc',:start_date=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) experience_list = experiences.collect do |experience| { "member" => experience.member_profile.name, @@ -21,7 +21,8 @@ class PersonalExperiencesController < ApplicationController "th_department" => t('personal_experience.department'), "th_job_title" => t('personal_experience.job_title'), "th_detail" => t('detail') - } + }, + "total_pages" => experiences.total_pages } end diff --git a/app/views/admin/experiences/index.html.erb b/app/views/admin/experiences/index.html.erb index c8179a8..446fd37 100644 --- a/app/views/admin/experiences/index.html.erb +++ b/app/views/admin/experiences/index.html.erb @@ -8,7 +8,7 @@
- <%= render :partial => 'experience', :collection => @experiences %> + <%= render 'experience' %> @@ -17,5 +17,6 @@ <%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_experience_setting_path, :class => 'btn btn-primary pull-right' %>