forked from saurabh/personal-conference
30 lines
1.1 KiB
Ruby
30 lines
1.1 KiB
Ruby
module Admin::PersonalConferencesHelper
|
|
|
|
def get_paper_list
|
|
user = current_user.nil? ? OrbitHelper.current_user : current_user
|
|
user_profile = user.member_profile
|
|
conferences = WritingConference.where(:member_profile_id => user_profile.id)
|
|
conferences = conferences.collect do |c|
|
|
files = c.writing_conference_files.collect do |wcf|
|
|
{
|
|
"title" => wcf.title,
|
|
"description" => wcf.description,
|
|
"link" => wcf.file.url,
|
|
"extension" => (wcf.file.url.split(".").last rescue "")
|
|
}
|
|
end
|
|
|
|
{
|
|
"id" => c.id.to_s,
|
|
"edit_url" => "/#{I18n.locale.to_s}/admin/members/#{user_profile.to_param}/writing_conferences/#{c.to_param}/edit",
|
|
"delete_url" => "/#{I18n.locale.to_s}/admin/writing_conferences/#{c.id.to_s}",
|
|
"paper_title" => c.paper_title,
|
|
"conference_title" => c.conference_title,
|
|
"keywords" => c.keywords,
|
|
"abstract" => c.abstract,
|
|
"files" => files
|
|
}
|
|
end
|
|
conferences
|
|
end
|
|
end |