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 @@ + + +