From 50ec5bbd62a569e1f2d8380dfe5c64fde75f5e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sat, 4 Mar 2023 12:43:45 +0800 Subject: [PATCH] fix error --- app/controllers/personal_journals_controller.rb | 13 +++++++++---- modules/personal_journal/index_by_author.html.erb | 11 +++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index adddfe0..d28f4ff 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -144,11 +144,16 @@ class PersonalJournalsController < ApplicationController def index_by_author(journal_papers) journal_papers_total_pages = journal_papers.total_pages - journal_papers_list = journal_papers.group_by{|jp| jp.member_profiles.collect{|v| v.name}.join(', ') rescue jp.authors}.collect do |name, jps| - jps_data = jps.collect do |jp| - {'title' => jp.create_link_tag_for_title} + journal_papers_list = journal_papers.group_by{|jp| jp.year}.collect do |year, jps| + jps_data = jps.group_by do |jp| + jp.member_profiles.collect{|v| v.name}.join(', ') rescue jp.authors + end.collect do |name, jps| + jps_data = jps.collect do |jp| + {'title' => jp.create_link_tag_for_title} + end + {'name' => name, 'jps' => jps_data} end - {'name' => name, 'jps' => jps_data} + {'year' => year, 'jps_list'=> jps_data} end { 'journal_papers' => journal_papers_list, diff --git a/modules/personal_journal/index_by_author.html.erb b/modules/personal_journal/index_by_author.html.erb index 806bd68..972a947 100644 --- a/modules/personal_journal/index_by_author.html.erb +++ b/modules/personal_journal/index_by_author.html.erb @@ -1,10 +1,13 @@

{{page-title}}

-

{{name}}

-
    -
  • {{title}}
  • -
+

{{year}}

+
+

{{name}}

+
    +
  • {{title}}
  • +
+
{{pagination_goes_here}} \ No newline at end of file