personal-patent/app/controllers/personal_patents_controller.rb

48 lines
1.5 KiB
Ruby

class PersonalPatentsController < ApplicationController
def index
patents = Patent.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
patent_list = patents.collect do |patent|
{
"publication_date" => patent.publish_date,
"patent_title" => patent.patent_title,
"patent_no" => patent.patent_no,
"patent_country" => patent.patent_country,
"authors" => patent.member_profile.name,
"link_to_show" => OrbitHelper.url_to_show(patent.to_param)
}
end
{
"patents" => patent_list,
"extras" => {
"widget-title" => t("module_name.personal_patent"),
"th_publication_date" => t('personal_patent.publication_date'),
"th_patent_title" => t("personal_patent.patent_title"),
"th_patent_no" => t('personal_patent.patent_no'),
"th_patent_country" => t("personal_patent.patent_country"),
"th_authors" => t('users.name')
},
"total_pages" => patents.total_pages
}
end
def show
params = OrbitHelper.params
plugin = Patent.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [
"patent_title",
"patent_category",
"authors",
"year",
"language",
"keywords",
"patent_no",
"patent_country",
"publish_date",
"url",
"note",
"file"
]
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
end
end