forked from saurabh/personal-journal
list for journal papers
This commit is contained in:
parent
36c626e1ec
commit
f38655a9d9
|
@ -4,7 +4,7 @@ class Desktop::JournalPapersController < DesktopAdminController
|
||||||
{
|
{
|
||||||
"title" => "List",
|
"title" => "List",
|
||||||
"layout" => "list",
|
"layout" => "list",
|
||||||
"data" => []
|
"data" => get_paper_list
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title" => "Add/Edit",
|
"title" => "Add/Edit",
|
||||||
|
@ -13,4 +13,29 @@ class Desktop::JournalPapersController < DesktopAdminController
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_paper_list
|
||||||
|
user = OrbitHelper.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
|
||||||
|
{
|
||||||
|
"paper_title" => j.paper_title,
|
||||||
|
"journal_title" => j.journal_title,
|
||||||
|
"keywords" => j.keywords,
|
||||||
|
"abstract" => j.abstract,
|
||||||
|
"files" => files
|
||||||
|
}
|
||||||
|
end
|
||||||
|
journals
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue