diff --git a/app/controllers/admin/journal_papers_controller.rb b/app/controllers/admin/journal_papers_controller.rb index de6d0b2..a4cd576 100644 --- a/app/controllers/admin/journal_papers_controller.rb +++ b/app/controllers/admin/journal_papers_controller.rb @@ -32,7 +32,7 @@ class Admin::JournalPapersController < OrbitMemberController #end if params['mode']!='simple' @journals.each do |key,value| - value = value.group_by{|v| [v[:level_type],v[:author_type],v[:paper_type],v[:publication_date]]} + value = value.group_by{|v| [get_level_type(v),get_author_type(v),get_paper_type(v),get_publication_date(v)]} value.each do |key1,value1| if value1.length==1 value.except! key1 @@ -128,7 +128,7 @@ class Admin::JournalPapersController < OrbitMemberController end def edit - @member = Array(MemberProfile.find(@journal_paper.member_profile_id)) + @member = get_member(@journal_paper) if params[:desktop] render :layout => false end @@ -224,7 +224,21 @@ class Admin::JournalPapersController < OrbitMemberController end private - + def get_member(journal) + Array(MemberProfile.find(journal.member_profile_id)) + end + def get_level_type(journal) + !journal.journal_levels.blank? ? "(#{journal.journal_levels.collect(&:title).join(', ')})" : nil + end + def get_author_type(journal) + journal.journal_paper_author_types.collect(&:title).join(', ') rescue '' + end + def get_paper_type(journal) + journal.journal_paper_type.title rescue '' + end + def get_publication_date(journal) + journal.publication_date.strftime('%Y/%m/%d') rescue '' + end def set_journal_paper path = request.path.split('/') if path.last.include? '-'