academic_advising/app/controllers/personal_honors_controller.rb

51 lines
1.8 KiB
Ruby

class PersonalHonorsController < ApplicationController
def index
honors = Honor.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
honor_list = honors.collect do |honor|
{
"year" => honor.year,
"award_name" => honor.award_name,
"awarding_unit" => honor.awarding_unit,
"award_winner" => honor.member_profile.name,
"link_to_show" => OrbitHelper.url_to_show(honor.to_param)
}
end
{
"honors" => honor_list,
"extras" => {
"widget-title" => t("module_name.personal_honor"),
"th_year" => t('personal_honor.year'),
"th_award_name" => t('personal_honor.award_name'),
"th_awarding_unit" => t('personal_honor.awarding_unit'),
"th_award_winner" => t('personal_honor.award_winner'),
"th_detail" => t('detail')
},
"total_pages" => honors.total_pages
}
end
def show
params = OrbitHelper.params
honor = Honor.where(:is_hidden=>false).find_by(uid: params[:uid])
{
"year" => honor.year,
"honor_type" => honor.honor_type.title,
"award_name" => honor.award_name,
"awarding_unit" => honor.awarding_unit,
"language" => t(honor.language),
"keywords" => honor.keywords,
"url" => honor.url,
"note" => honor.note,
"th_year" => t("personal_honor.year"),
"th_honor_type" => t("personal_honor.honor_category"),
"th_award_name" => t("personal_honor.award_name"),
"th_awarding_unit" => t("personal_honor.awarding_unit"),
"th_language" => t("personal_honor.language"),
"th_keywords" => t("personal_honor.keywords"),
"th_url" => t("personal_honor.url"),
"th_note" => t("personal_honor.note")
}
end
end