From b10d4153a161621a127322d6c8ac625ae1958b81 Mon Sep 17 00:00:00 2001 From: manson Date: Mon, 11 Aug 2014 19:18:02 +0800 Subject: [PATCH] Update fields and fix bugs --- .../admin/writing_conferences_controller.rb | 2 +- app/controllers/personal_conferences_controller.rb | 2 ++ app/models/writing_conference.rb | 9 +++++++++ app/views/admin/writing_conferences/_form.html.erb | 14 +++++++++++--- config/locales/en.yml | 2 ++ config/locales/zh_tw.yml | 6 ++++-- 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/writing_conferences_controller.rb b/app/controllers/admin/writing_conferences_controller.rb index 7c66ae9..2ee51f0 100644 --- a/app/controllers/admin/writing_conferences_controller.rb +++ b/app/controllers/admin/writing_conferences_controller.rb @@ -24,8 +24,8 @@ class Admin::WritingConferencesController < OrbitMemberController end def edit - @member = MemberProfile.find_by(:uid=>params['uid']) rescue nil @writing_conference = WritingConference.find(params[:id]) + @member = @writing_conference.member_profile end def update diff --git a/app/controllers/personal_conferences_controller.rb b/app/controllers/personal_conferences_controller.rb index d434385..56f7af4 100644 --- a/app/controllers/personal_conferences_controller.rb +++ b/app/controllers/personal_conferences_controller.rb @@ -30,7 +30,9 @@ class PersonalConferencesController < ApplicationController "conference_title", "paper_level", "paper_type", + "author_name", "authors", + "number_of_authors", "author_type", "year", "language", diff --git a/app/models/writing_conference.rb b/app/models/writing_conference.rb index 2ba0a1d..8884881 100644 --- a/app/models/writing_conference.rb +++ b/app/models/writing_conference.rb @@ -25,6 +25,7 @@ class WritingConference field :update_user_id, :type => BSON::ObjectId field :isbn field :isi_number + field :number_of_authors field :rss2_id belongs_to :member_profile @@ -73,6 +74,14 @@ class WritingConference value = self.conference_author_types.collect{|type| type.title}.join(',') rescue "" when "paper_type" value = self.conference_paper_types.collect{|type| type.title}.join(',') rescue "" + when "author_name" + value = [] + ([I18n.locale]+(Site.first.in_use_locales-[I18n.locale])).each do |locale| + if self.member_profile.first_name_translations[locale] || self.member_profile.last_name_translations[locale] + value << "#{self.member_profile.first_name_translations[locale]} #{self.member_profile.last_name_translations[locale]}" + end + end + value = value.join(" / ") when "publication_date" value = self.publication_date.to_date.strftime("%Y-%m-%d") rescue "" when "language" diff --git a/app/views/admin/writing_conferences/_form.html.erb b/app/views/admin/writing_conferences/_form.html.erb index 23be3c4..3e58320 100644 --- a/app/views/admin/writing_conferences/_form.html.erb +++ b/app/views/admin/writing_conferences/_form.html.erb @@ -91,11 +91,19 @@ + +
+ +
+ <%= f.text_field :number_of_authors, :class=>'span1' %> +
+
+
- <%= f.datetime_picker :period_start_date, :no_label => true, :format=>"yyyy/MM/dd" %> + <%= f.datetime_picker :period_start_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
@@ -103,7 +111,7 @@
- <%= f.datetime_picker :period_end_date, :no_label => true, :format=>"yyyy/MM/dd" %> + <%= f.datetime_picker :period_end_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
@@ -111,7 +119,7 @@
- <%= f.datetime_picker :publication_date, :no_label => true, :format=>"yyyy/MM/dd" %> + <%= f.datetime_picker :publication_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index b852ee4..c5b7b38 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -17,6 +17,8 @@ en: location : "Location" sponsor : "Sponsor" authors : "Authors" + author_name: "Author Name" + number_of_authors: "Number Of Authors" tags : "Tags" keywords : "Keywords" isbn: "ISSN (ISBN)" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 8cf6014..05c705e 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -10,12 +10,14 @@ zh_tw: paper_level: "論文等級" conference_title : "會議名稱" conference_time: "會議時間" - period_start_date : "起" - period_end_date : "訖" + period_start_date : "會議開始時間" + period_end_date : "會議結束時間" duration: "期間" location : "地點" sponsor : "主辦單位" authors : "全部作者" + author_name: "作者姓名" + number_of_authors: "著作人數" tags : "領域" keywords : "關鍵字" isbn: "ISSN (ISBN)"