Update frontend
This commit is contained in:
parent
48eb11cca9
commit
8aa42bd5a1
|
@ -28,32 +28,44 @@ class PersonalExperiencesController < ApplicationController
|
|||
|
||||
def show
|
||||
params = OrbitHelper.params
|
||||
experience = Experience.where(:is_hidden=>false).find_by(uid: params[:uid])
|
||||
plugin = Experience.where(:is_hidden=>false).find_by(uid: params[:uid])
|
||||
|
||||
fields_to_show = [
|
||||
"organizationt_title",
|
||||
"department",
|
||||
"job_title",
|
||||
"experience_type",
|
||||
"duration",
|
||||
"keywords",
|
||||
"url",
|
||||
"note"
|
||||
]
|
||||
|
||||
{
|
||||
"organizationt_title" => experience.organizationt_title,
|
||||
"department" => experience.department,
|
||||
"job_title" => experience.job_title,
|
||||
"experience_type" => (experience.experience_type.title rescue ""),
|
||||
"language" => t(experience.language),
|
||||
"start_date" => experience.start_date,
|
||||
"end_date" => experience.end_date,
|
||||
"duration" => experience.duration,
|
||||
"keywords" => experience.keywords,
|
||||
"url" => experience.url,
|
||||
"note" => experience.note,
|
||||
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
||||
# {
|
||||
# "organizationt_title" => experience.organizationt_title,
|
||||
# "department" => experience.department,
|
||||
# "job_title" => experience.job_title,
|
||||
# "experience_type" => (experience.experience_type.title rescue ""),
|
||||
# "language" => t(experience.language),
|
||||
# "start_date" => experience.start_date,
|
||||
# "end_date" => experience.end_date,
|
||||
# "duration" => experience.duration,
|
||||
# "keywords" => experience.keywords,
|
||||
# "url" => experience.url,
|
||||
# "note" => experience.note,
|
||||
|
||||
"th_organizationt_title" =>t("personal_experience.organizationt_title") ,
|
||||
"th_department" =>t("personal_experience.department") ,
|
||||
"th_job_title" =>t("personal_experience.job_title") ,
|
||||
"th_experience_type" =>t("personal_experience.experience_category") ,
|
||||
"th_language" =>t("personal_experience.language") ,
|
||||
"th_start_date" =>t("personal_experience.start_date") ,
|
||||
"th_end_date" =>t("personal_experience.end_date") ,
|
||||
"th_duration" =>t("personal_experience.duration") ,
|
||||
"th_keywords" =>t("personal_experience.keywords") ,
|
||||
"th_url" =>t("personal_experience.url") ,
|
||||
"th_note" =>t("personal_experience.note")
|
||||
}
|
||||
# "th_organizationt_title" =>t("personal_experience.organizationt_title") ,
|
||||
# "th_department" =>t("personal_experience.department") ,
|
||||
# "th_job_title" =>t("personal_experience.job_title") ,
|
||||
# "th_experience_type" =>t("personal_experience.experience_category") ,
|
||||
# "th_language" =>t("personal_experience.language") ,
|
||||
# "th_start_date" =>t("personal_experience.start_date") ,
|
||||
# "th_end_date" =>t("personal_experience.end_date") ,
|
||||
# "th_duration" =>t("personal_experience.duration") ,
|
||||
# "th_keywords" =>t("personal_experience.keywords") ,
|
||||
# "th_url" =>t("personal_experience.url") ,
|
||||
# "th_note" =>t("personal_experience.note")
|
||||
# }
|
||||
end
|
||||
end
|
|
@ -37,6 +37,37 @@ class Experience
|
|||
[self.organizationt_title,self.department,self.job_title].join(' ')
|
||||
end
|
||||
|
||||
def get_plugin_data(fields_to_show)
|
||||
plugin_datas = []
|
||||
fields_to_show.each do |field|
|
||||
plugin_data = self.get_plugin_field_data(field)
|
||||
next if plugin_data.blank? or plugin_data['value'].blank?
|
||||
plugin_datas << plugin_data
|
||||
end
|
||||
plugin_datas
|
||||
end
|
||||
|
||||
def get_plugin_field_data(field)
|
||||
case field
|
||||
when "language"
|
||||
value = I18n.t(self.language) rescue ""
|
||||
when "experience_type"
|
||||
value = self.experience_type.title rescue ""
|
||||
else
|
||||
value = self.send(field) rescue ""
|
||||
end
|
||||
|
||||
value = (value =~ /\A#{URI::regexp(['http', 'https'])}\z/) ? "<a href='#{value}' target='blank'>#{value}</a>" : value
|
||||
|
||||
{
|
||||
"key"=>field,
|
||||
"title_class"=>"experience-#{field.gsub('_','-')}-field",
|
||||
"value_class"=>"experience-#{field.gsub('_','-')}-value",
|
||||
"title"=>I18n.t('personal_experience.'+field),
|
||||
"value"=>value
|
||||
}
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def add_http
|
||||
|
|
|
@ -4,6 +4,7 @@ en:
|
|||
personal_experience:
|
||||
department : "Department"
|
||||
experience_category : "Experience Category"
|
||||
experience_type: "Experience Category"
|
||||
organizationt_title : "Organization Title"
|
||||
paper_title : "Paper Title"
|
||||
book_title : "Book Title"
|
||||
|
|
|
@ -4,6 +4,7 @@ zh_tw:
|
|||
personal_experience:
|
||||
department : "單位"
|
||||
experience_category : 經歷類別
|
||||
experience_type: 經歷類別
|
||||
end_date : "結束日期"
|
||||
start_date : "開始日期"
|
||||
duration: "期間"
|
||||
|
|
Loading…
Reference in New Issue