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 title_is_paper_format = false
fields_to_show = page.custom_array_field rescue [] fields_to_show = page.custom_array_field rescue []
if fields_to_show.blank? 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 end
if params[:keywords].present? if params[:keywords].present?
projects = filter_keywords(projects,params[:selectbox],params[:keywords]) 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)}}} {'jps' => fields_to_show.map{|field| {"value"=> get_display_field(project,field, title_is_paper_format)}}}
end 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 = [] choice_show = []
headers = [] headers = []
fields_to_show.each do |fs| fields_to_show.each do |fs|
@ -62,7 +62,7 @@ class PersonalProjectsController < ApplicationController
def show def show
params = OrbitHelper.params params = OrbitHelper.params
plugin = Project.where(:is_hidden=>false).find_by(uid: params[:uid].to_s) 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)} {"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
end end
@ -120,10 +120,10 @@ class PersonalProjectsController < ApplicationController
end end
def get_fields_for_index def get_fields_for_index
@page = Page.find(params[:page_id]) rescue nil @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] } @fields_to_show = @fields_to_show.map { |fs| [t("personal_project.#{fs}"), fs] }
if @page.present? && @page.custom_string_field == 'table' 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 else
@default_fields_to_show = ["year", "project_title"] @default_fields_to_show = ["year", "project_title"]
end end

View File

@ -12,6 +12,7 @@ class Project
field :period_start_date, :type => Date, :default => Date.today field :period_start_date, :type => Date, :default => Date.today
field :period_end_date, :type => Date, :default => Date.today field :period_end_date, :type => Date, :default => Date.today
field :unit, :type => String, :default => "", :localize => true field :unit, :type => String, :default => "", :localize => true
field :jobs, :type => String, :default => "", :localize => true
field :participants, :type => String, :default => "", :localize => true field :participants, :type => String, :default => "", :localize => true

View File

@ -53,6 +53,15 @@
<div class="controls"> <div class="controls">
<%= f.fields_for :unit_translations do |f| %> <%= 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) %> <%= 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 %> <% end %>
</div> </div>
</div> </div>

View File

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

View File

@ -14,6 +14,9 @@ wb = xlsx_package.workbook
@site_in_use_locales.each do |locale| @site_in_use_locales.each do |locale|
row << t("personal_project.unit") + " - " + t(locale.to_s) row << t("personal_project.unit") + " - " + t(locale.to_s)
end 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| @site_in_use_locales.each do |locale|
row << t("personal_project.participants") + " - " + t(locale.to_s) row << t("personal_project.participants") + " - " + t(locale.to_s)
end end
@ -31,6 +34,9 @@ wb = xlsx_package.workbook
@site_in_use_locales.each do |locale| @site_in_use_locales.each do |locale|
row << project.unit_translations[locale.to_s] row << project.unit_translations[locale.to_s]
end end
@site_in_use_locales.each do |locale|
row << project.jobs_translations[locale.to_s]
end
@site_in_use_locales.each do |locale| @site_in_use_locales.each do |locale|
row << project.participants_translations[locale.to_s] row << project.participants_translations[locale.to_s]
end end

View File

@ -5,6 +5,7 @@
<%= thead('personal_project.project_title') %> <%= thead('personal_project.project_title') %>
<%= thead('personal_project.project_number') %> <%= thead('personal_project.project_number') %>
<%= thead('personal_project.member_profile') %> <%= thead('personal_project.member_profile') %>
<%= thead('personal_project.jobs') %>
<%= thead('personal_project.participants') %> <%= thead('personal_project.participants') %>
</tr> </tr>
</thead> </thead>

View File

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

View File

@ -26,6 +26,7 @@ en:
period_start_date: Start Date period_start_date: Start Date
period_end_date: End Date period_end_date: End Date
unit: Subsidy unit unit: Subsidy unit
jobs: Jobs
participants: Participants participants: Participants
member_profile: Project manager member_profile: Project manager

View File

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