32 lines
1.0 KiB
Ruby
32 lines
1.0 KiB
Ruby
class PersonalCertificatesController < ApplicationController
|
|
def index
|
|
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)}
|
|
end
|
|
end |