personal-honor/app/controllers/personal_honors_controller.rb

51 lines
1.8 KiB
Ruby
Raw Normal View History

2014-07-03 04:53:38 +00:00
class PersonalHonorsController < ApplicationController
def index
2014-07-18 07:03:24 +00:00
honors = Honor.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
2014-07-03 04:53:38 +00:00
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')
2014-07-18 07:03:24 +00:00
},
"total_pages" => honors.total_pages
2014-07-03 04:53:38 +00:00
}
end
def show
params = OrbitHelper.params
2014-07-03 11:32:20 +00:00
honor = Honor.where(:is_hidden=>false).find_by(uid: params[:uid])
2014-07-03 04:53:38 +00:00
{
"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