personal-diploma/app/helpers/admin/personal_diplomas_helper.rb

19 lines
609 B
Ruby
Raw Normal View History

2014-12-04 07:39:43 +00:00
module Admin::PersonalDiplomasHelper
def get_paper_list
user = current_user.nil? ? OrbitHelper.current_user : current_user
user_profile = user.member_profile
diplomas = Diploma.where(:member_profile_id => user_profile.id)
diplomas = diplomas.collect do |d|
{
"id" => d.id.to_s,
"edit_url" => "/#{I18n.locale.to_s}/admin/members/#{user_profile.to_param}/diplomas/#{d.to_param}/edit",
"delete_url" => "/#{I18n.locale.to_s}/admin/diplomas/#{d.id.to_s}",
"paper_title" => d.school_name,
"files" => []
}
end
diplomas
end
end