73 lines
2.7 KiB
Ruby
73 lines
2.7 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
|
|
patent = Patent.where(:is_hidden=>false).find_by(uid: params[:uid])
|
|
|
|
files = patent.patent_files.map do |file|
|
|
{
|
|
"file_url" => file.file.url,
|
|
"file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title),
|
|
"file_ext" => File.extname(file.file.path).sub('.',''),
|
|
"file_description" => file.description
|
|
}
|
|
end
|
|
|
|
{
|
|
"files" => files,
|
|
|
|
"data" => {
|
|
"patent_title" => patent.patent_title,
|
|
"patent_type" => (patent.patent_type.title rescue ""),
|
|
"authors" => patent.authors,
|
|
"year" => patent.year,
|
|
"language" => (t(patent.language) rescue ""),
|
|
"keywords" => patent.keywords,
|
|
"patent_no" => patent.patent_no,
|
|
"patent_country" => patent.patent_country,
|
|
"publish_date" => (patent.publish_date.strftime("%Y.%m") rescue ""),
|
|
"url" => patent.url,
|
|
"note" => patent.note,
|
|
|
|
"th_patent_title" => t("personal_patent.patent_title"),
|
|
"th_authors" => t("personal_patent.authors"),
|
|
"th_year" => t("personal_patent.year"),
|
|
"th_language" => t("personal_patent.language"),
|
|
"th_keywords" => t("personal_patent.keywords"),
|
|
"th_patent_no" => t("personal_patent.patent_no"),
|
|
"th_patent_country" => t("personal_patent.patent_country"),
|
|
"th_publish_date" => t("personal_patent.publication_date"),
|
|
"th_url" => t("personal_patent.url"),
|
|
"th_note" => t("personal_patent.note"),
|
|
|
|
"th_patent_type" => t("personal_patent.patent_category"),
|
|
"th_files" => t(:file_)
|
|
}
|
|
}
|
|
end
|
|
end |