personal-certificate/app/controllers/psesonal_certificates_contr...

32 lines
1.0 KiB
Ruby
Raw Normal View History

2016-03-09 07:05:14 +00:00
class PersonalCertificatesController < ApplicationController
def index
2016-03-09 09:24:01 +00:00
certificates = Certificate.where(:is_hidden=>false).order_by(:created_at=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
certificates_list = certificates.collect do |certificate|
{
"title" => certificate.title,
"issued_by" => certificate.issued_by,
"link_to_show" => OrbitHelper.url_to_show(certificate.to_param)
}
end
{
"courses" => certificates_list,
"extras" => {
"widget-title" => t("module_name.personal_certificate"),
"th_title" => t('personal_certificate.title'),
"th_issued_by" => t("personal_certificate.issued_by")
},
"total_pages" => certificates.total_pages
}
end
def show
params = OrbitHelper.params
plugin = Certificate.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [
"title",
"issued_by"
]
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
2016-03-09 07:05:14 +00:00
end
end