From 369e0317e043df24df6198aa424a8f23d210460a Mon Sep 17 00:00:00 2001 From: spen Date: Fri, 9 Jan 2015 15:41:08 +0800 Subject: [PATCH] something fix --- .../personal_patents_controller.rb | 10 +- app/models/patent.rb | 39 ++++ app/views/admin/patents/_form.html.erb | 221 +++++++++--------- config/locales/zh_tw.yml | 4 +- 4 files changed, 159 insertions(+), 115 deletions(-) diff --git a/app/controllers/personal_patents_controller.rb b/app/controllers/personal_patents_controller.rb index 63ce718..e6eb282 100644 --- a/app/controllers/personal_patents_controller.rb +++ b/app/controllers/personal_patents_controller.rb @@ -29,16 +29,16 @@ class PersonalPatentsController < ApplicationController params = OrbitHelper.params plugin = Patent.where(:is_hidden=>false).find_by(uid: params[:uid]) fields_to_show = [ - "patent_title", "patent_category", - "authors", "year", - "language", - "keywords", + "publish_date", + "patent_title", "patent_no", "patent_country", - "publish_date", + "authors", "url", + "language", + "keywords", "note", "file" ] diff --git a/app/models/patent.rb b/app/models/patent.rb index 5796a9a..800c4fc 100644 --- a/app/models/patent.rb +++ b/app/models/patent.rb @@ -39,10 +39,49 @@ class Patent plugin_datas end + def self.get_plugin_datas_to_member(datas) + + fields_to_show = [ + "publish_date", + "patent_title", + "patent_no", + "patent_country", + "authors" + ] + + pd_title = fields_to_show.collect do |t| + { + "plugin_data_title" => I18n.t("personal_patent.#{t}") + } + end + + plugin_datas = datas.where(:is_hidden=>false).order_by(:year=>'desc').collect do |p| + + pd_data = [] + fields_to_show.collect do |t| + if t == "patent_title" + pd_data << { "data_title" => "#{p.send(t)}" } + else + pd_data << { "data_title" => p.send(t) } + end + end + + { + "pd_datas" => pd_data + } + + end + + return [pd_title,plugin_datas] + + end + def get_plugin_field_data(field) case field when "patent_category" value = self.patent_types.collect{|patent_type| patent_type.title}.join(',') rescue "" + when "language" + value = I18n.t(self.language) rescue "" when "file" files = [] self.patent_files.each do |patent_file| diff --git a/app/views/admin/patents/_form.html.erb b/app/views/admin/patents/_form.html.erb index 4633a51..23e3812 100644 --- a/app/views/admin/patents/_form.html.erb +++ b/app/views/admin/patents/_form.html.erb @@ -3,6 +3,7 @@ <%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/fileupload" %> <%= stylesheet_link_tag "lib/main-list" %> + <%= stylesheet_link_tag "lib/main-form-col2" %> <% end %> <% content_for :page_specific_javascript do %> <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> @@ -15,114 +16,6 @@
- - - - - -
- - -
- -
- -
- <%= @member.name rescue ''%> - <%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %> -
-
- - -
- -
- <%= select_year((@patent.year ? @patent.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'patent[year]', :class => "span1"} ) %> -
-
- - -
- -
- <% @patent_types.each do |pt| %> - /> <%= pt.title %> - <% end %> -
-
- - -
- -
- <%= f.datetime_picker :publish_date, :no_label => true, :format=>"yyyy/MM" %> -
-
- - -
- -
- <%= f.text_field :patent_no %> -
-
- - -
- -
- <%= f.text_field :keywords %> -
-
- - -
- -
- <%= f.text_field :language ,class: "span5"%> -
-
- - -
- -
- <%= f.text_field :url , :class => "span5" %> -
-
- - -
- -
- <%= f.text_area :note, rows: 2, class: "input-block-level" %> -
-
- -
- - -
-
- -
- -
-
-
- -
-
+ + + + + +
+ + +
+ +
+ +
+ <%= @member.name rescue ''%> + <%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %> +
+
+ + +
+ +
+ <%= select_year((@patent.year ? @patent.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'patent[year]', :class => "span1"} ) %> +
+
+ + +
+ +
+ +
+
+ + +
+ +
+ <% @patent_types.each do |pt| %> + /> <%= pt.title %> + <% end %> +
+
+ + +
+ +
+ <%= f.text_field :patent_no %> +
+
+ + +
+ +
+ <%= f.datetime_picker :publish_date, :no_label => true, :format=>"yyyy/MM" %> +
+
+ + +
+ +
+ <%= f.text_field :url , :class => "span5" %> +
+
+ + +
+ +
+ <%= f.text_field :keywords %> +
+
+ + +
+ +
+ <%= f.text_area :note, rows: 2, class: "input-block-level" %> +
+
+ +
+ + +
+
+ +
+ +
+
+
+ +
+ diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 520b2a2..4578795 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -17,7 +17,7 @@ zh_tw: vol_no : "卷數" issue_no : "期數" form_to_start : "起" - form_to_end : "訖" + form_to_end : "迄" total_pages : "總頁數" keywords : "關鍵字" abstract : "摘要" @@ -28,7 +28,7 @@ zh_tw: level_type : "期刊類別" author_type : "作者類別" from : "起" - to : "訖" + to : "迄" file : "檔案" file_name : "檔案名稱" description : "描述"