diff --git a/app/controllers/admin/patents_controller.rb b/app/controllers/admin/patents_controller.rb index 6ad2cff..e77fa69 100644 --- a/app/controllers/admin/patents_controller.rb +++ b/app/controllers/admin/patents_controller.rb @@ -157,6 +157,7 @@ class Admin::PatentsController < OrbitMemberController def get_settings @patent_types = PatentType.all + @author_types = PatentAuthorType.all end def set_plugin diff --git a/app/models/patent.rb b/app/models/patent.rb index f37df0e..b721d28 100644 --- a/app/models/patent.rb +++ b/app/models/patent.rb @@ -5,16 +5,21 @@ class Patent include Slug has_and_belongs_to_many :patent_types + has_and_belongs_to_many :patent_author_types belongs_to :member_profile field :patent_title, as: :slug_title, localize: true field :authors, localize: true field :patent_country, localize: true + field :patent_organization, localize: true field :year field :language field :keywords field :patent_no + field :progress_status + field :application_date, type: DateTime + field :end_date, type: DateTime field :publish_date , :type => Date field :url field :note @@ -94,7 +99,7 @@ class Patent when "patent_category" value = self.patent_types.collect{|patent_type| patent_type.title}.join(',') rescue "" when "language" - value = I18n.t(self.language) rescue "" + value = I18n.t(self.language) if !self.language.nil? rescue "" when "file" files = [] self.patent_files.each do |patent_file| diff --git a/app/models/patent_author_type.rb b/app/models/patent_author_type.rb new file mode 100644 index 0000000..b4b1a6a --- /dev/null +++ b/app/models/patent_author_type.rb @@ -0,0 +1,8 @@ +class PatentAuthorType + include Mongoid::Document + include Mongoid::Timestamps + + field :title, type: String, localize: true + + has_and_belongs_to_many :patents +end \ No newline at end of file diff --git a/app/views/admin/patents/_form.html.erb b/app/views/admin/patents/_form.html.erb index 2c4273f..b8214e8 100644 --- a/app/views/admin/patents/_form.html.erb +++ b/app/views/admin/patents/_form.html.erb @@ -66,6 +66,17 @@ + + +
+ +
+ <%= f.fields_for :patent_organization_translations do |f| %> + <%= f.text_field locale, placeholder: t("personal_patent.patent_organization"), value: (@patent.patent_organization_translations[locale] rescue nil) %> + <% end %> +
+
+ <% end %> @@ -168,6 +179,19 @@ + +
+ +
+ <% @author_types.each do |author_type| %> + <%= content_tag :label,:class => "checkbox inline" do -%> + <%= check_box_tag 'patent[patent_author_type_ids][]', author_type.id, @patent.patent_author_type_ids.include?(author_type.id)%> + <%= author_type.title %> + <% end %> + <% end %> +
+
+
@@ -176,6 +200,14 @@
+ +
+ +
+ <%= f.text_field :progress_status %> +
+
+
@@ -184,6 +216,22 @@
+ +
+ +
+ <%= f.datetime_picker :application_date, :no_label => true, :format=>"yyyy/MM", :value => @patent.application_date, :new_record => @patent.new_record? %> +
+
+ + +
+ +
+ <%= f.datetime_picker :end_date, :no_label => true, :format=>"yyyy/MM", :value => @patent.end_date, :new_record => @patent.new_record? %> +
+
+
diff --git a/config/locales/en.yml b/config/locales/en.yml index b413231..37d6213 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -10,6 +10,11 @@ en: patent_category : "Patent Category" publishers : "Publishers" authors : "Authors" + progress_status: "Progress Status" + application_date: "Application Date" + end_date: "End Date" + patent_organization: "Patent Organization" + author_type: "Author Type" tags : "Tags" year : "Year" language : "Language" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 4578795..c9dd38c 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -14,6 +14,11 @@ zh_tw: year : "年度" language : "語言" isbn : "ISSN(ISBN)" + progress_status: "申請進度" + application_date: "申請日期" + end_date: "終止日期" + patent_organization: "發照單位" + author_type: "作者順序" vol_no : "卷數" issue_no : "期數" form_to_start : "起"