Update journal_papers_controller.rb

This commit is contained in:
chiu 2019-10-31 23:55:56 +08:00
parent c99b57caed
commit 7dbd78bcb3
1 changed files with 17 additions and 3 deletions

View File

@ -32,7 +32,7 @@ class Admin::JournalPapersController < OrbitMemberController
#end #end
if params['mode']!='simple' if params['mode']!='simple'
@journals.each do |key,value| @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| value.each do |key1,value1|
if value1.length==1 if value1.length==1
value.except! key1 value.except! key1
@ -128,7 +128,7 @@ class Admin::JournalPapersController < OrbitMemberController
end end
def edit def edit
@member = Array(MemberProfile.find(@journal_paper.member_profile_id)) @member = get_member(@journal_paper)
if params[:desktop] if params[:desktop]
render :layout => false render :layout => false
end end
@ -224,7 +224,21 @@ class Admin::JournalPapersController < OrbitMemberController
end end
private 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 def set_journal_paper
path = request.path.split('/') path = request.path.split('/')
if path.last.include? '-' if path.last.include? '-'