forked from saurabh/personal-project
29 lines
964 B
Ruby
29 lines
964 B
Ruby
module Admin::PersonalProjectsHelper
|
|
|
|
def get_paper_list
|
|
user = current_user.nil? ? OrbitHelper.current_user : current_user
|
|
user_profile = user.member_profile
|
|
projects = Project.where(:member_profile_id => user_profile.id)
|
|
projects = projects.collect do |p|
|
|
files = p.project_files.collect do |pf|
|
|
{
|
|
"title" => pf.title,
|
|
"description" => pf.description,
|
|
"link" => pf.file.url,
|
|
"extension" => (pf.file.url.split(".").last rescue "")
|
|
}
|
|
end
|
|
|
|
{
|
|
"id" => p.id.to_s,
|
|
"edit_url" => "/#{I18n.locale.to_s}/admin/members/#{user_profile.to_param}/projects/#{p.to_param}/edit",
|
|
"delete_url" => "/#{I18n.locale.to_s}/admin/projects/#{p.id.to_s}",
|
|
"paper_title" => p.project_title,
|
|
"keywords" => p.keywords,
|
|
"abstract" => p.abstract,
|
|
"files" => files
|
|
}
|
|
end
|
|
projects
|
|
end
|
|
end |