diff --git a/app/controllers/admin/researchs_controller.rb b/app/controllers/admin/researchs_controller.rb index 1e25597..dec41b4 100644 --- a/app/controllers/admin/researchs_controller.rb +++ b/app/controllers/admin/researchs_controller.rb @@ -5,7 +5,7 @@ class Admin::ResearchsController < OrbitMemberController before_action :get_settings,:only => [:new, :edit, :setting] def index - @researchs = Research.all + @researchs = Research.order_by(:year=>'desc').page(params[:page]).per(10) end def new diff --git a/app/controllers/personal_researches_controller.rb b/app/controllers/personal_researches_controller.rb index efc91cf..6f53fe2 100644 --- a/app/controllers/personal_researches_controller.rb +++ b/app/controllers/personal_researches_controller.rb @@ -1,11 +1,11 @@ class PersonalResearchesController < ApplicationController def index - researchs = Research.where(:is_hidden=>false).all + researchs = Research.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) research_list = researchs.collect do |research| { "member" => research.member_profile.name, "year" => research.year, - "publication_date" => research.publish_date.strftime("%Y.%m"), + "publication_date" => (research.publish_date.strftime("%Y.%m") rescue ""), "research_title" => research.research_title, "link_to_show" => OrbitHelper.url_to_show(research.to_param) } @@ -19,7 +19,8 @@ class PersonalResearchesController < ApplicationController "th_publication_date" => t('personal_research.publication_date'), "th_research_title" => t('personal_research.research_title'), "th_detail" => t('detail') - } + }, + "total_pages" => researchs.total_pages } end @@ -44,7 +45,7 @@ class PersonalResearchesController < ApplicationController "extracted_chapters" => research.extracted_chapters, "year" => research.year, "language" => t(research.language), - "publish_date" => research.publish_date.strftime("%Y.%m"), + "publish_date" => (research.publish_date.strftime("%Y.%m") rescue ""), "keywords" => research.keywords, "url" => research.url, "note" => research.note, diff --git a/app/views/admin/researchs/_research.html.erb b/app/views/admin/researchs/_research.html.erb index 2f1c540..315161a 100644 --- a/app/views/admin/researchs/_research.html.erb +++ b/app/views/admin/researchs/_research.html.erb @@ -1,7 +1,7 @@ <% @researchs.each do |research| %>