2014-06-04 03:55:13 +00:00
|
|
|
module Admin::JournalPapersHelper
|
2014-07-03 14:39:01 +00:00
|
|
|
def page_for_journal_paper(journal_paper_object)
|
2014-06-25 06:20:22 +00:00
|
|
|
journal_paper_page = nil
|
2014-07-03 14:39:01 +00:00
|
|
|
pages = Page.where(:module=>"journal_paper")
|
2014-06-25 06:20:22 +00:00
|
|
|
|
|
|
|
journal_paper_page = pages.first if journal_paper_page.nil?
|
2014-07-03 14:39:01 +00:00
|
|
|
request.protocol+(request.host_with_port+journal_paper_page.url+'/'+journal_paper_object.to_param).gsub('//','/') rescue "/"
|
2014-06-25 06:20:22 +00:00
|
|
|
end
|
2014-11-26 11:39:19 +00:00
|
|
|
def get_paper_list
|
|
|
|
user = current_user.nil? ? OrbitHelper.current_user : current_user
|
|
|
|
user_profile = user.member_profile
|
|
|
|
journals = JournalPaper.where(:member_profile_id => user_profile.id)
|
|
|
|
journals = journals.collect do |j|
|
|
|
|
files = j.journal_paper_files.collect do |jpf|
|
|
|
|
{
|
|
|
|
"title" => jpf.title,
|
|
|
|
"description" => jpf.description,
|
|
|
|
"link" => jpf.journal_file.url,
|
|
|
|
"extension" => (jpf.journal_file.url.split(".").last rescue "")
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
{
|
|
|
|
"id" => j.id.to_s,
|
|
|
|
"edit_url" => "/#{I18n.locale.to_s}/admin/journal_papers/#{j.to_param}/edit",
|
|
|
|
"delete_url" => "/#{I18n.locale.to_s}/admin/journal_papers/#{j.id.to_s}",
|
|
|
|
"paper_title" => j.paper_title,
|
|
|
|
"journal_title" => j.journal_title,
|
|
|
|
"keywords" => j.keywords,
|
|
|
|
"abstract" => j.abstract,
|
|
|
|
"files" => files
|
|
|
|
}
|
|
|
|
end
|
|
|
|
journals
|
|
|
|
end
|
2014-06-04 03:55:13 +00:00
|
|
|
end
|