diff --git a/app/controllers/psesonal_certificates_controller.rb b/app/controllers/psesonal_certificates_controller.rb index ae8b27a..53f2ee2 100644 --- a/app/controllers/psesonal_certificates_controller.rb +++ b/app/controllers/psesonal_certificates_controller.rb @@ -1,4 +1,32 @@ 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 \ No newline at end of file