From 97de505179c61b56dd087d8de13c45f8cca7e9f4 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 6 Apr 2016 02:09:04 +0800 Subject: [PATCH] added country and award date --- app/controllers/personal_honors_controller.rb | 4 ++++ app/models/honor.rb | 2 ++ app/views/admin/honors/_form.html.erb | 17 +++++++++++++++++ config/locales/en.yml | 2 ++ config/locales/zh_tw.yml | 2 ++ 5 files changed, 27 insertions(+) diff --git a/app/controllers/personal_honors_controller.rb b/app/controllers/personal_honors_controller.rb index c452b27..ffa1dda 100644 --- a/app/controllers/personal_honors_controller.rb +++ b/app/controllers/personal_honors_controller.rb @@ -58,6 +58,8 @@ class PersonalHonorsController < ApplicationController "year", "honor_type", "award_name", + "award_date", + "country", "honoree", "awarding_unit", "keywords", @@ -75,6 +77,8 @@ class PersonalHonorsController < ApplicationController "award_name", "awarding_unit", "honor_type", + "award_date", + "country", "keywords", "url", "note", diff --git a/app/models/honor.rb b/app/models/honor.rb index 20a39d1..99446bf 100644 --- a/app/models/honor.rb +++ b/app/models/honor.rb @@ -10,11 +10,13 @@ class Honor field :year, type: Integer field :award_name, localize: true field :awarding_unit, localize: true + field :award_date, type: DateTime field :language field :keywords field :url field :note field :rss2_id + field :country, localize: true field :create_user_id, :type => BSON::ObjectId field :update_user_id, :type => BSON::ObjectId diff --git a/app/views/admin/honors/_form.html.erb b/app/views/admin/honors/_form.html.erb index 626ae15..3bbf982 100644 --- a/app/views/admin/honors/_form.html.erb +++ b/app/views/admin/honors/_form.html.erb @@ -51,6 +51,15 @@ +
+ +
+ <%= f.fields_for :country_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_honor.country"), value: (@honor.country_translations[locale] rescue nil) %> + <% end %> +
+
+ <% end %> @@ -104,6 +113,14 @@ + +
+ +
+ <%= f.datetime_picker :award_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD", :value => @honor.award_date, :new_record => @honor.new_record? %> +
+
+
diff --git a/config/locales/en.yml b/config/locales/en.yml index acab000..7fa499c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -21,6 +21,8 @@ en: issue_no : "Issue.No" form_to_start : "From" form_to_end : "To" + country: "Country" + award_date: "Award Date" total_pages : "Total Pages" keywords : "Keywords" abstract : "Abstract" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 66603ab..3906576 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -23,6 +23,8 @@ zh_tw: keywords : "關鍵字" abstract : "摘要" publication_date : "發表日期" + award_date: "獲獎日期" + country: "國別" url : "參考連結" note : "記事" level_type : "期刊類別"