diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 6f4d1b0..e1206f7 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -5,7 +5,7 @@ class Admin::ProjectsController < OrbitMemberController before_action :get_settings,:only => [:new, :edit, :setting] def index - @projects = Project.all + @projects = Project.order_by(:period_start_date=>'desc',:year=>'desc').page(params[:page]).per(10) end def new diff --git a/app/controllers/personal_projects_controller.rb b/app/controllers/personal_projects_controller.rb index 6d7b8c6..1af1546 100644 --- a/app/controllers/personal_projects_controller.rb +++ b/app/controllers/personal_projects_controller.rb @@ -1,6 +1,6 @@ class PersonalProjectsController < ApplicationController def index - projects = Project.where(:is_hidden=>false).all + projects = Project.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) project_list = projects.collect do |project| { "duration" => project.duration, @@ -20,7 +20,8 @@ class PersonalProjectsController < ApplicationController "th_job_title" => t('personal_project.job_title'), "th_participator" => t("personal_project.participator"), "th_authors" => t('users.name') - } + }, + "total_pages" => projects.total_pages } end diff --git a/app/views/admin/projects/index.html.erb b/app/views/admin/projects/index.html.erb index 9c54e5f..2f4fc96 100644 --- a/app/views/admin/projects/index.html.erb +++ b/app/views/admin/projects/index.html.erb @@ -10,7 +10,7 @@
- <%= render :partial => 'project', :collection => @projects %> + <%= render 'project' %> @@ -19,5 +19,6 @@ <%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_project_setting_path, :class => 'btn btn-primary pull-right' %>