personal-patent/app/controllers/personal_patents_controller.rb

48 lines
1.5 KiB
Ruby
Raw Normal View History

2014-07-04 03:48:33 +00:00
class PersonalPatentsController < ApplicationController
def index
2014-07-18 07:05:27 +00:00
patents = Patent.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
2014-07-04 03:48:33 +00:00
patent_list = patents.collect do |patent|
{
2014-07-04 03:55:31 +00:00
"publication_date" => patent.publish_date,
2014-07-04 03:48:33 +00:00
"patent_title" => patent.patent_title,
"patent_no" => patent.patent_no,
"patent_country" => patent.patent_country,
2014-10-03 06:16:14 +00:00
"authors" => (patent.member_profile.name rescue ""),
2014-07-04 03:48:33 +00:00
"link_to_show" => OrbitHelper.url_to_show(patent.to_param)
}
end
{
"patents" => patent_list,
"extras" => {
2014-07-04 03:55:31 +00:00
"widget-title" => t("module_name.personal_patent"),
2014-07-04 03:48:33 +00:00
"th_publication_date" => t('personal_patent.publication_date'),
2014-07-04 03:55:31 +00:00
"th_patent_title" => t("personal_patent.patent_title"),
2014-07-04 03:48:33 +00:00
"th_patent_no" => t('personal_patent.patent_no'),
2014-07-04 03:55:31 +00:00
"th_patent_country" => t("personal_patent.patent_country"),
"th_authors" => t('users.name')
2014-07-18 07:05:27 +00:00
},
"total_pages" => patents.total_pages
2014-07-04 03:48:33 +00:00
}
end
def show
params = OrbitHelper.params
2014-08-01 11:48:52 +00:00
plugin = Patent.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [
"patent_title",
2014-08-11 12:08:29 +00:00
"patent_category",
2014-08-01 11:48:52 +00:00
"authors",
"year",
"language",
"keywords",
"patent_no",
"patent_country",
"publish_date",
"url",
"note",
"file"
]
2014-07-04 03:48:33 +00:00
2014-08-01 11:48:52 +00:00
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
2014-07-04 03:48:33 +00:00
end
end