frontend controller done
This commit is contained in:
parent
3189a8cb69
commit
8f6fbe68a0
|
@ -1,4 +1,32 @@
|
||||||
class PersonalCertificatesController < ApplicationController
|
class PersonalCertificatesController < ApplicationController
|
||||||
def index
|
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
|
||||||
end
|
end
|
Loading…
Reference in New Issue