From 27e16e1d9d6da1ca94ce416e1ec19813b59beb7e Mon Sep 17 00:00:00 2001 From: manson Date: Thu, 3 Jul 2014 12:53:14 +0800 Subject: [PATCH] Frontend --- .../personal_experiences_controller.rb | 58 +++++++++++++++++++ app/views/personal_experiences/index.html.erb | 1 + app/views/personal_experiences/show.html.erb | 1 + config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + lib/personal_experience/engine.rb | 5 +- 6 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 app/controllers/personal_experiences_controller.rb create mode 100644 app/views/personal_experiences/index.html.erb create mode 100644 app/views/personal_experiences/show.html.erb diff --git a/app/controllers/personal_experiences_controller.rb b/app/controllers/personal_experiences_controller.rb new file mode 100644 index 0000000..9df0a56 --- /dev/null +++ b/app/controllers/personal_experiences_controller.rb @@ -0,0 +1,58 @@ +class PersonalExperiencesController < ApplicationController + def index + experiences = Experience.all + experience_list = experiences.collect do |experience| + { + "member" => experience.member_profile.name, + "duration" => experience.duration, + "organizationt_title" => experience.organizationt_title, + "department" => experience.department, + "job_title" => experience.job_title, + "link_to_show" => OrbitHelper.url_to_show(experience.to_param) + } + end + { + "experiences" => experience_list, + "extras" => { + "widget-title" => t("module_name.personal_experience"), + "th_member" => t('users.name'), + "th_duration" => t('personal_experience.duration'), + "th_organizationt_title" => t('personal_experience.organizationt_title'), + "th_department" => t('personal_experience.department'), + "th_job_title" => t('personal_experience.job_title'), + "th_detail" => t('detail') + } + } + end + + def show + params = OrbitHelper.params + experience = Experience.find_by(uid: params[:uid]) + + { + "organizationt_title" => experience.organizationt_title, + "department" => experience.department, + "job_title" => experience.job_title, + "experience_type" => experience.experience_type.title, + "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") + } + end +end \ No newline at end of file diff --git a/app/views/personal_experiences/index.html.erb b/app/views/personal_experiences/index.html.erb new file mode 100644 index 0000000..648b75c --- /dev/null +++ b/app/views/personal_experiences/index.html.erb @@ -0,0 +1 @@ +<%= render_view %> \ No newline at end of file diff --git a/app/views/personal_experiences/show.html.erb b/app/views/personal_experiences/show.html.erb new file mode 100644 index 0000000..648b75c --- /dev/null +++ b/app/views/personal_experiences/show.html.erb @@ -0,0 +1 @@ +<%= render_view %> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 36d732a..5af4c4a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -19,6 +19,7 @@ en: issue_no : "Issue.No" form_to_start : "From" form_to_end : "To" + duration: "Duration" total_pages : "Total Pages" keywords : "Keywords" abstract : "Abstract" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index f08aa8c..8f53501 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -6,6 +6,7 @@ zh_tw: experience_category : 經歷類別 end_date : "結束日期" start_date : "開始日期" + duration: "期間" organizationt_title : "服務機關名稱" paper_title : "論文名稱" book_title : "期刊名稱" diff --git a/lib/personal_experience/engine.rb b/lib/personal_experience/engine.rb index 1975567..ba12643 100644 --- a/lib/personal_experience/engine.rb +++ b/lib/personal_experience/engine.rb @@ -4,12 +4,15 @@ module PersonalExperience OrbitApp.registration "PersonalExperience",:type=> 'ModuleApp' do module_label 'module_name.personal_experience' base_url File.expand_path File.dirname(__FILE__) - personal_plugin :enable => true, :sort_number => '45', :app_name=>"Experience", :intro_app_name=>"PersonalExperienceIntro",:path=>"/plugin/personal_experience/profile",:front_path=>"/profile",:admin_path=>"/admin/experiences",:i18n=>'module_name.personal_experience' + personal_plugin :enable => true, :sort_number => '45', :app_name=>"Experience", :intro_app_name=>"PersonalExperienceIntro",:path=>"/plugin/personal_experience/profile",:front_path=>"/profile",:admin_path=>"/admin/experiences",:i18n=>'module_name.personal_experience', :module_app_name=>'PersonalExperience' version "0.1" organization "Rulingcom" author "RD dep" intro "I am intro" update_info 'some update_info' + + frontend_enabled + icon_class_no_sidebar "icons-user" end end end