forked from saurabh/personal-honor
50 lines
1.6 KiB
Ruby
50 lines
1.6 KiB
Ruby
|
class PersonalHonorsController < ApplicationController
|
||
|
def index
|
||
|
honors = Honor.all
|
||
|
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')
|
||
|
}
|
||
|
}
|
||
|
end
|
||
|
|
||
|
def show
|
||
|
params = OrbitHelper.params
|
||
|
honor = Honor.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
|