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| %> "> <%= research.year %> - <%= research.publish_date.strftime("%Y.%m") %> + <%= research.publish_date.strftime("%Y.%m") rescue "" %> <%= link_to research.research_title, OrbitHelper.url_to_plugin_show(research.to_param,'personal_research'), target: "blank"%>
diff --git a/app/views/admin/researchs/index.html.erb b/app/views/admin/researchs/index.html.erb index 6bf58a7..db2ef16 100644 --- a/app/views/admin/researchs/index.html.erb +++ b/app/views/admin/researchs/index.html.erb @@ -8,6 +8,15 @@ - <%= render :partial => 'research', :collection => @researchs %> + <%= render 'research' %> - \ No newline at end of file + + +
+
+ <%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_writing_conference_setting_path, :class => 'btn btn-primary pull-right' %> +
+ +
\ No newline at end of file diff --git a/lib/personal_research/engine.rb b/lib/personal_research/engine.rb index 4b97c44..5c9df52 100644 --- a/lib/personal_research/engine.rb +++ b/lib/personal_research/engine.rb @@ -13,6 +13,7 @@ module PersonalResearch frontend_enabled icon_class_no_sidebar "icons-user" + data_count 1..10 end end end