diff --git a/app/controllers/personal_projects_controller.rb b/app/controllers/personal_projects_controller.rb index 6bf0107..0603a83 100644 --- a/app/controllers/personal_projects_controller.rb +++ b/app/controllers/personal_projects_controller.rb @@ -7,7 +7,7 @@ class PersonalProjectsController < ApplicationController title_is_paper_format = false fields_to_show = page.custom_array_field rescue [] if fields_to_show.blank? - fields_to_show = ["year", "project_title", "project_number", "member_profile", "participants"] + fields_to_show = ["year", "project_title", "project_number", "member_profile", "jobs", "participants"] end if params[:keywords].present? projects = filter_keywords(projects,params[:selectbox],params[:keywords]) @@ -17,7 +17,7 @@ class PersonalProjectsController < ApplicationController {'jps' => fields_to_show.map{|field| {"value"=> get_display_field(project,field, title_is_paper_format)}}} end - extras = {"th-year" => I18n.t("personal_project.year"), "th-project_title" => I18n.t("personal_project.project_title"), "th-project_number" => I18n.t("personal_project.project_number"), "th-member_profile" => I18n.t("personal_project.member_profile"), "th-participants" => I18n.t("personal_project.participants")} + extras = {"th-year" => I18n.t("personal_project.year"), "th-project_title" => I18n.t("personal_project.project_title"), "th-project_number" => I18n.t("personal_project.project_number"), "th-member_profile" => I18n.t("personal_project.member_profile"), "th-jobs" => I18n.t("personal_project.jobs"), "th-participants" => I18n.t("personal_project.participants")} choice_show = [] headers = [] fields_to_show.each do |fs| @@ -62,7 +62,7 @@ class PersonalProjectsController < ApplicationController def show params = OrbitHelper.params plugin = Project.where(:is_hidden=>false).find_by(uid: params[:uid].to_s) - fields_to_show = ["year", "project_title", "project_number", "member_profile", "period_start_date", "period_end_date", "unit", "participants"] + fields_to_show = ["year", "project_title", "project_number", "member_profile", "period_start_date", "period_end_date", "unit", "jobs", "participants"] {"plugin_datas"=>plugin.get_plugin_data(fields_to_show)} end @@ -120,10 +120,10 @@ class PersonalProjectsController < ApplicationController end def get_fields_for_index @page = Page.find(params[:page_id]) rescue nil - @fields_to_show = ["year", "project_title", "project_number", "period_start_date", "period_end_date", "unit", "participants"] + @fields_to_show = ["year", "project_title", "project_number", "period_start_date", "period_end_date", "unit", "jobs", "participants"] @fields_to_show = @fields_to_show.map { |fs| [t("personal_project.#{fs}"), fs] } if @page.present? && @page.custom_string_field == 'table' - @default_fields_to_show = ["year", "project_title", "project_number", "member_profile", "participants"] + @default_fields_to_show = ["year", "project_title", "project_number", "member_profile", "jobs", "participants"] else @default_fields_to_show = ["year", "project_title"] end diff --git a/app/models/project.rb b/app/models/project.rb index 9dfdf96..7cd5e42 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -12,6 +12,7 @@ class Project field :period_start_date, :type => Date, :default => Date.today field :period_end_date, :type => Date, :default => Date.today field :unit, :type => String, :default => "", :localize => true + field :jobs, :type => String, :default => "", :localize => true field :participants, :type => String, :default => "", :localize => true diff --git a/app/views/admin/projects/_form.html.erb b/app/views/admin/projects/_form.html.erb index 23aa5b6..f227604 100644 --- a/app/views/admin/projects/_form.html.erb +++ b/app/views/admin/projects/_form.html.erb @@ -53,6 +53,15 @@
<%= f.fields_for :unit_translations do |f| %> <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_project.unit"), value: (@project.unit_translations[locale] rescue nil) %> +<% end %> +
+ + +
+ +
+ <%= f.fields_for :jobs_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_project.jobs"), value: (@project.jobs_translations[locale] rescue nil) %> <% end %>
diff --git a/app/views/admin/projects/_projects.html.erb b/app/views/admin/projects/_projects.html.erb index 451f748..66c1079 100644 --- a/app/views/admin/projects/_projects.html.erb +++ b/app/views/admin/projects/_projects.html.erb @@ -12,6 +12,7 @@ <%= project.project_number %> <%= project.display_field("member_profile").html_safe rescue "" %> + <%= project.jobs %> <%= project.participants %> <% end %> \ No newline at end of file diff --git a/app/views/admin/projects/download_excel.xlsx.axlsx b/app/views/admin/projects/download_excel.xlsx.axlsx index d12c10f..d2eb40a 100644 --- a/app/views/admin/projects/download_excel.xlsx.axlsx +++ b/app/views/admin/projects/download_excel.xlsx.axlsx @@ -14,6 +14,9 @@ wb = xlsx_package.workbook @site_in_use_locales.each do |locale| row << t("personal_project.unit") + " - " + t(locale.to_s) end + @site_in_use_locales.each do |locale| + row << t("personal_project.jobs") + " - " + t(locale.to_s) + end @site_in_use_locales.each do |locale| row << t("personal_project.participants") + " - " + t(locale.to_s) end @@ -31,6 +34,9 @@ wb = xlsx_package.workbook @site_in_use_locales.each do |locale| row << project.unit_translations[locale.to_s] end + @site_in_use_locales.each do |locale| + row << project.jobs_translations[locale.to_s] + end @site_in_use_locales.each do |locale| row << project.participants_translations[locale.to_s] end diff --git a/app/views/admin/projects/index.html.erb b/app/views/admin/projects/index.html.erb index 048ce10..95bd938 100644 --- a/app/views/admin/projects/index.html.erb +++ b/app/views/admin/projects/index.html.erb @@ -5,6 +5,7 @@ <%= thead('personal_project.project_title') %> <%= thead('personal_project.project_number') %> <%= thead('personal_project.member_profile') %> + <%= thead('personal_project.jobs') %> <%= thead('personal_project.participants') %> diff --git a/app/views/plugin/personal_project/_profile.html.erb b/app/views/plugin/personal_project/_profile.html.erb index 44e3c00..58b1d9d 100644 --- a/app/views/plugin/personal_project/_profile.html.erb +++ b/app/views/plugin/personal_project/_profile.html.erb @@ -31,6 +31,7 @@ <%= t('personal_project.year') %> <%= t('personal_project.project_title') %> <%= t('personal_project.project_number') %> + <%= t('personal_project.jobs') %> <%= t('personal_project.participants') %> @@ -53,6 +54,7 @@ <%= project.project_number %> + <%= project.jobs %> <%= project.participants %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index cc5f1c5..a93b5e8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -26,6 +26,7 @@ en: period_start_date: Start Date period_end_date: End Date unit: Subsidy unit + jobs: Jobs participants: Participants member_profile: Project manager \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index b04d191..7ca5e59 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -26,6 +26,7 @@ zh_tw: period_start_date: 計畫起日期 period_end_date: 計畫迄日期 unit: 補助單位 + jobs: 擔任之工作 participants: 所有參與者 member_profile: 計畫負責人 \ No newline at end of file