something fix

This commit is contained in:
spen 2015-01-09 15:41:08 +08:00
parent fb7371f5f8
commit 369e0317e0
4 changed files with 159 additions and 115 deletions

View File

@ -29,16 +29,16 @@ class PersonalPatentsController < ApplicationController
params = OrbitHelper.params params = OrbitHelper.params
plugin = Patent.where(:is_hidden=>false).find_by(uid: params[:uid]) plugin = Patent.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [ fields_to_show = [
"patent_title",
"patent_category", "patent_category",
"authors",
"year", "year",
"language", "publish_date",
"keywords", "patent_title",
"patent_no", "patent_no",
"patent_country", "patent_country",
"publish_date", "authors",
"url", "url",
"language",
"keywords",
"note", "note",
"file" "file"
] ]

View File

@ -39,10 +39,49 @@ class Patent
plugin_datas plugin_datas
end 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" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_patent')}'>#{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) def get_plugin_field_data(field)
case field case field
when "patent_category" when "patent_category"
value = self.patent_types.collect{|patent_type| patent_type.title}.join(',') rescue "" value = self.patent_types.collect{|patent_type| patent_type.title}.join(',') rescue ""
when "language"
value = I18n.t(self.language) rescue ""
when "file" when "file"
files = [] files = []
self.patent_files.each do |patent_file| self.patent_files.each do |patent_file|

View File

@ -3,6 +3,7 @@
<%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %> <%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %> <%= stylesheet_link_tag "lib/main-list" %>
<%= stylesheet_link_tag "lib/main-form-col2" %>
<% end %> <% end %>
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
@ -15,114 +16,6 @@
<!-- Input Area --> <!-- Input Area -->
<div class="input-area"> <div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= @member.name rescue ''%>
<%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %>
</div>
</div>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.year") %></label>
<div class="controls">
<%= select_year((@patent.year ? @patent.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'patent[year]', :class => "span1"} ) %>
</div>
</div>
<!-- patent_category -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.patent_category") %></label>
<div class="controls">
<% @patent_types.each do |pt| %>
<input type="checkbox" name="patent[patent_type_ids][]" value="<%= pt.id.to_s %>" <%= (@patent.patent_type_ids.include?pt.id) ? "checked=checked" : "" %> /> <%= pt.title %>
<% end %>
</div>
</div>
<!-- publish_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publish_date, :no_label => true, :format=>"yyyy/MM" %>
</div>
</div>
<!-- patent_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.patent_no") %></label>
<div class="controls">
<%= f.text_field :patent_no %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.language") %></label>
<div class="controls">
<%= f.text_field :language ,class: "span5"%>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span5" %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<div class="tab-pane fade" id="status">
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @patent.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
<!-- Language Tabs --> <!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div> <div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav"> <ul class="nav nav-pills language-nav">
@ -203,6 +96,118 @@
</div> </div>
</div> </div>
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= @member.name rescue ''%>
<%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %>
</div>
</div>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.year") %></label>
<div class="controls">
<%= select_year((@patent.year ? @patent.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'patent[year]', :class => "span1"} ) %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.language") %></label>
<div class="controls">
<select id="patent_language" name="patent[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @patent.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- patent_category -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_patent.patent_category") %></label>
<div class="controls">
<% @patent_types.each do |pt| %>
<input type="checkbox" name="patent[patent_type_ids][]" value="<%= pt.id.to_s %>" <%= (@patent.patent_type_ids.include?pt.id) ? "checked=checked" : "" %> /> <%= pt.title %>
<% end %>
</div>
</div>
<!-- patent_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.patent_no") %></label>
<div class="controls">
<%= f.text_field :patent_no %>
</div>
</div>
<!-- publish_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publish_date, :no_label => true, :format=>"yyyy/MM" %>
</div>
</div>
<!-- url -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_patent.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span5" %>
</div>
</div>
<!-- keywords -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_patent.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- note -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_patent.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<div class="tab-pane fade" id="status">
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @patent.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
</div> </div>
<!-- Form Actions --> <!-- Form Actions -->

View File

@ -17,7 +17,7 @@ zh_tw:
vol_no : "卷數" vol_no : "卷數"
issue_no : "期數" issue_no : "期數"
form_to_start : "起" form_to_start : "起"
form_to_end : "" form_to_end : ""
total_pages : "總頁數" total_pages : "總頁數"
keywords : "關鍵字" keywords : "關鍵字"
abstract : "摘要" abstract : "摘要"
@ -28,7 +28,7 @@ zh_tw:
level_type : "期刊類別" level_type : "期刊類別"
author_type : "作者類別" author_type : "作者類別"
from : "起" from : "起"
to : "" to : ""
file : "檔案" file : "檔案"
file_name : "檔案名稱" file_name : "檔案名稱"
description : "描述" description : "描述"