This commit is contained in:
rulingcom 2024-01-29 22:16:41 +08:00
parent 21e6525601
commit c1ef92d3fc
9 changed files with 27 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -53,6 +53,15 @@
<div class="controls">
<%= 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 %>
</div>
</div>
<!-- jobs -->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_project.jobs") %></label>
<div class="controls">
<%= 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 %>
</div>
</div>

View File

@ -12,6 +12,7 @@
</td>
<td> <%= project.project_number %> </td>
<td> <%= project.display_field("member_profile").html_safe rescue "" %> </td>
<td> <%= project.jobs %> </td>
<td> <%= project.participants %> </td>
</tr>
<% end %>

View File

@ -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

View File

@ -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') %>
</tr>
</thead>

View File

@ -31,6 +31,7 @@
<th><%= t('personal_project.year') %></th>
<th><%= t('personal_project.project_title') %></th>
<th><%= t('personal_project.project_number') %></th>
<th><%= t('personal_project.jobs') %></th>
<th><%= t('personal_project.participants') %></th>
</tr>
</thead>
@ -53,6 +54,7 @@
</div>
</td>
<td><%= project.project_number %></td>
<td><%= project.jobs %></td>
<td><%= project.participants %></td>
</tr>
<% end %>

View File

@ -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

View File

@ -26,6 +26,7 @@ zh_tw:
period_start_date: 計畫起日期
period_end_date: 計畫迄日期
unit: 補助單位
jobs: 擔任之工作
participants: 所有參與者
member_profile: 計畫負責人