From b27d04042c7104c8331878e1fb64e9b199309268 Mon Sep 17 00:00:00 2001 From: spen Date: Fri, 9 Jan 2015 15:45:32 +0800 Subject: [PATCH] something fix --- app/controllers/personal_labs_controller.rb | 2 +- app/models/lab.rb | 35 ++++ app/views/admin/labs/_form.html.erb | 181 ++++++++++---------- app/views/admin/labs/_lab.html.erb | 1 + app/views/admin/labs/index.html.erb | 1 + config/locales/zh_tw.yml | 4 +- 6 files changed, 131 insertions(+), 93 deletions(-) diff --git a/app/controllers/personal_labs_controller.rb b/app/controllers/personal_labs_controller.rb index 13a2140..71e70de 100644 --- a/app/controllers/personal_labs_controller.rb +++ b/app/controllers/personal_labs_controller.rb @@ -28,13 +28,13 @@ class PersonalLabsController < ApplicationController params = OrbitHelper.params plugin = Lab.where(:is_hidden=>false).find_by(uid: params[:uid]) fields_to_show = [ + "year", "lab_title", "location", "participating_professor", "participating_student", "research_direction", "facility", - "year", "keywords", "extension_no", "url", diff --git a/app/models/lab.rb b/app/models/lab.rb index 51eebdd..ee6a969 100644 --- a/app/models/lab.rb +++ b/app/models/lab.rb @@ -39,6 +39,41 @@ class Lab plugin_datas end + def self.get_plugin_datas_to_member(datas) + + fields_to_show = [ + "year", + "lab_title", + "location" + ] + + pd_title = fields_to_show.collect do |t| + { + "plugin_data_title" => I18n.t("personal_lab.#{t}") + } + end + + plugin_datas = datas.where(:is_hidden=>false).order_by(:year=>'desc').collect do |p| + + pd_data = [] + fields_to_show.collect do |t| + if t == "lab_title" + pd_data << { "data_title" => "#{p.send(t)}" } + else + pd_data << { "data_title" => p.send(t) } + end + end + + { + "pd_datas" => pd_data + } + + end + + return [pd_title,plugin_datas] + + end + def get_plugin_field_data(field) case field when "language" diff --git a/app/views/admin/labs/_form.html.erb b/app/views/admin/labs/_form.html.erb index e05e98f..a12c742 100644 --- a/app/views/admin/labs/_form.html.erb +++ b/app/views/admin/labs/_form.html.erb @@ -13,6 +13,96 @@
+ + + + + +
+ + <% @site_in_use_locales.each_with_index do |locale, i| %> + +
"> + + +
+ +
+ <%= f.fields_for :lab_title_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.lab_title"), value: (@lab.lab_title_translations[locale] rescue nil) %> + <% end %> +
+
+ + +
+ +
+ <%= f.fields_for :location_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.location"), value: (@lab.location_translations[locale] rescue nil) %> + <% end %> +
+
+ + +
+ +
+ <%= f.fields_for :participating_professor_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_professor"), value: (@lab.participating_professor_translations[locale] rescue nil) %> + <% end %> +
+
+ + +
+ +
+ <%= f.fields_for :participating_student_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_student"), value: (@lab.participating_student_translations[locale] rescue nil) %> + <% end %> +
+
+ +
+ + <% end %> + + +
+ +
+ + + <% if @lab && !@lab.lab_files.blank? %> +
+ <% @lab.lab_files.each_with_index do |lab_file, i| %> + <%= f.fields_for :lab_files, lab_file do |f| %> + <%= render :partial => 'form_file', :object => lab_file, :locals => {:f => f, :i => i} %> + <% end %> + <% end %> +
+
+ <% end %> + + +
+
+

+ <%= hidden_field_tag 'plugin_file_field_count', @lab.lab_files.count %> + <%= t(:add) %> +

+
+
+ +
+
- - - - - - -
- - <% @site_in_use_locales.each_with_index do |locale, i| %> - -
"> - - -
- -
- <%= f.fields_for :lab_title_translations do |f| %> - <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.lab_title"), value: (@lab.lab_title_translations[locale] rescue nil) %> - <% end %> -
-
- - -
- -
- <%= f.fields_for :location_translations do |f| %> - <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.location"), value: (@lab.location_translations[locale] rescue nil) %> - <% end %> -
-
- - -
- -
- <%= f.fields_for :participating_professor_translations do |f| %> - <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_professor"), value: (@lab.participating_professor_translations[locale] rescue nil) %> - <% end %> -
-
- - -
- -
- <%= f.fields_for :participating_student_translations do |f| %> - <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_student"), value: (@lab.participating_student_translations[locale] rescue nil) %> - <% end %> -
-
- -
- - <% end %> - - -
- -
- - - <% if @lab && !@lab.lab_files.blank? %> -
- <% @lab.lab_files.each_with_index do |lab_file, i| %> - <%= f.fields_for :lab_files, lab_file do |f| %> - <%= render :partial => 'form_file', :object => lab_file, :locals => {:f => f, :i => i} %> - <% end %> - <% end %> -
-
- <% end %> - - -
-
-

- <%= hidden_field_tag 'plugin_file_field_count', @lab.lab_files.count %> - <%= t(:add) %> -

-
-
- -
+ diff --git a/app/views/admin/labs/_lab.html.erb b/app/views/admin/labs/_lab.html.erb index fcf83f8..01d4abc 100644 --- a/app/views/admin/labs/_lab.html.erb +++ b/app/views/admin/labs/_lab.html.erb @@ -11,5 +11,6 @@ <%= lab.location %> + <%= lab.member_profile.name rescue "" %> <% end %> \ No newline at end of file diff --git a/app/views/admin/labs/index.html.erb b/app/views/admin/labs/index.html.erb index 71ebcc5..8f037a1 100644 --- a/app/views/admin/labs/index.html.erb +++ b/app/views/admin/labs/index.html.erb @@ -4,6 +4,7 @@ <%= t('personal_lab.year') %> <%= t('module_name.personal_lab') %> <%= t('personal_lab.location') %> + <%= t('users.name') %> diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 0e4d6ea..51b127e 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -18,7 +18,7 @@ zh_tw: vol_no : "卷數" issue_no : "期數" form_to_start : "起" - form_to_end : "訖" + form_to_end : "迄" total_pages : "總頁數" keywords : "關鍵字" abstract : "摘要" @@ -28,7 +28,7 @@ zh_tw: level_type : "期刊類別" author_type : "作者類別" from : "起" - to : "訖" + to : "迄" file : "檔案" file_name : "檔案名稱" description : "描述"