diff --git a/app/controllers/personal_experiences_controller.rb b/app/controllers/personal_experiences_controller.rb index 987054e..feab8c8 100644 --- a/app/controllers/personal_experiences_controller.rb +++ b/app/controllers/personal_experiences_controller.rb @@ -31,14 +31,12 @@ class PersonalExperiencesController < ApplicationController plugin = Experience.where(:is_hidden=>false).find_by(uid: params[:uid]) fields_to_show = [ + "experience_type", "organizationt_title", + "duration", "department", "job_title", - "experience_type", - "duration", - "keywords", - "url", - "note" + "url" ] {"plugin_datas"=>plugin.get_plugin_data(fields_to_show)} diff --git a/app/models/experience.rb b/app/models/experience.rb index f686467..7862749 100644 --- a/app/models/experience.rb +++ b/app/models/experience.rb @@ -27,7 +27,7 @@ class Experience def duration if !self.start_date.nil? or !self.end_date.nil? - self.start_date.strftime('%Y.%m')+' ~ '+self.end_date.strftime('%Y.%m') + (self.start_date.strftime('%Y.%m') rescue "")+' ~ '+(self.end_date.strftime('%Y.%m') rescue I18n.t('personal_experience.up_to_today')) else "" end @@ -37,6 +37,51 @@ class Experience [self.organizationt_title,self.department,self.job_title].join(' ') end + def self.get_plugin_datas_to_member(datas) + + fields_to_show = [ + "organizationt_title", + "department", + "job_title", + "duration" + ] + + pd_title = fields_to_show.collect do |t| + { + "plugin_data_title" => I18n.t("personal_experience.#{t}") + } + end + + plugin_datas = datas.where(:is_hidden=>false).order_by(:end_date=>'desc', :start_date=>'desc').collect do |p| + + pd_data = [] + fields_to_show.collect do |t| + if t == "organizationt_title" + pd_data << { "data_title" => "#{p.send(t)}" } + elsif t == "duration" + + if !p.send('start_date').nil? or !p.send('end_date').nil? + date = (p.send('start_date').strftime('%Y.%m') rescue "")+' ~ '+(p.send('end_date').strftime('%Y.%m') rescue I18n.t('personal_experience.up_to_today')) + else + date = "" + end + + pd_data << { "data_title" => date } + else + pd_data << { "data_title" => p.send(t) } + end + end + + { + "pd_datas" => pd_data + } + + end + + return [pd_title,plugin_datas] + + end + def get_plugin_data(fields_to_show) plugin_datas = [] fields_to_show.each do |field| diff --git a/app/views/admin/experiences/_experience.html.erb b/app/views/admin/experiences/_experience.html.erb index 5059c1b..bd96ad3 100644 --- a/app/views/admin/experiences/_experience.html.erb +++ b/app/views/admin/experiences/_experience.html.erb @@ -12,5 +12,6 @@ <%= experience.department %> <%= experience.job_title %> + <%= experience.member_profile.name rescue "" %> <% end %> \ No newline at end of file diff --git a/app/views/admin/experiences/_form.html.erb b/app/views/admin/experiences/_form.html.erb index 5364b52..8c651da 100644 --- a/app/views/admin/experiences/_form.html.erb +++ b/app/views/admin/experiences/_form.html.erb @@ -3,6 +3,7 @@ <%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/fileupload" %> <%= stylesheet_link_tag "lib/main-list" %> + <%= stylesheet_link_tag "lib/main-form-col2" %> <% end %> <% content_for :page_specific_javascript do %> <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> @@ -13,108 +14,6 @@
- - - - - -
- - -
- -
- -
- <%= @member.name rescue ''%> - <%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %> -
-
- - -
- -
- <%= f.select :experience_type_id, @experience_types.collect {|t| [ t.title, t.id ]} %> -
-
- - -
- -
- <%= f.datetime_picker :start_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %> -
-
- - -
- -
- <%= f.datetime_picker :end_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %> -
-
- - -
- -
- <%= f.text_field :keywords %> -
-
- - -
- -
- -
-
- - -
- -
- <%= f.text_field :url , :class => "span5" %> -
-
- - -
- -
- <%= f.text_area :note, rows: 2, class: "input-block-level" %> -
-
- -
- - -
-
- -
- -
-
-
- -
-
+ + + + + +
+ + +
+ +
+ +
+ <%= @member.name rescue ''%> + <%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %> +
+
+ + +
+ +
+ <%= f.select :experience_type_id, @experience_types.collect {|t| [ t.title, t.id ]} %> +
+
+ + +
+ +
+ +
+
+ + +
+ +
+ <%= f.datetime_picker :start_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %> +
+
+ + +
+ +
+ <%= f.datetime_picker :end_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %> +
+
+ + +
+ +
+ <%= f.text_field :url , :class => "span5" %> +
+
+ + +
+ +
+ <%= f.text_field :keywords %> +
+
+ + +
+ +
+ <%= f.text_area :note, rows: 2, class: "input-block-level" %> +
+
+ +
+ + +
+
+ +
+ +
+
+
+ +
+ diff --git a/app/views/admin/experiences/index.html.erb b/app/views/admin/experiences/index.html.erb index 446fd37..3e589ed 100644 --- a/app/views/admin/experiences/index.html.erb +++ b/app/views/admin/experiences/index.html.erb @@ -5,6 +5,7 @@ <%= t('personal_experience.organizationt_title') %> <%= t('personal_experience.department') %> <%= t('personal_experience.job_title') %> + <%= t('users.name') %> diff --git a/config/locales/en.yml b/config/locales/en.yml index e18040b..1746c16 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -20,6 +20,7 @@ en: issue_no : "Issue.No" form_to_start : "From" form_to_end : "To" + up_to_today : "Up to today" duration: "Duration" total_pages : "Total Pages" keywords : "Keywords" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 1341b88..17b43c3 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -20,7 +20,8 @@ zh_tw: vol_no : "卷數" issue_no : "期數" form_to_start : "起" - form_to_end : "訖" + form_to_end : "迄" + up_to_today : "迄今" total_pages : "總頁數" keywords : "關鍵字" abstract : "摘要" @@ -30,7 +31,7 @@ zh_tw: level_type : "期刊類別" author_type : "作者類別" from : "起" - to : "訖" + to : "迄" file : "檔案" file_name : "檔案名稱" description : "描述"