added fields for uch

This commit is contained in:
Harry Bomrah 2016-04-06 17:58:50 +08:00
parent 5514d2fa1f
commit ddf161dc6e
6 changed files with 73 additions and 1 deletions

View File

@ -157,6 +157,7 @@ class Admin::PatentsController < OrbitMemberController
def get_settings
@patent_types = PatentType.all
@author_types = PatentAuthorType.all
end
def set_plugin

View File

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

View File

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

View File

@ -66,6 +66,17 @@
</div>
</div>
<!-- organization-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_patent.patent_organization") %></label>
<div class="controls">
<%= 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 %>
</div>
</div>
</div>
<% end %>
@ -168,6 +179,19 @@
</div>
</div>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.author_type") %></label>
<div class="controls">
<% @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 %>
</div>
</div>
<!-- patent_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.patent_no") %></label>
@ -176,6 +200,14 @@
</div>
</div>
<!-- patent progress -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.progress_status") %></label>
<div class="controls">
<%= f.text_field :progress_status %>
</div>
</div>
<!-- publish_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.publication_date") %></label>
@ -184,6 +216,22 @@
</div>
</div>
<!-- application date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.application_date") %></label>
<div class="controls">
<%= f.datetime_picker :application_date, :no_label => true, :format=>"yyyy/MM", :value => @patent.application_date, :new_record => @patent.new_record? %>
</div>
</div>
<!-- end date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.end_date") %></label>
<div class="controls">
<%= f.datetime_picker :end_date, :no_label => true, :format=>"yyyy/MM", :value => @patent.end_date, :new_record => @patent.new_record? %>
</div>
</div>
<!-- url -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_patent.url") %></label>

View File

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

View File

@ -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 : "起"