something fix

This commit is contained in:
spen 2015-01-09 15:44:32 +08:00
parent 446bf1ac8a
commit bd3677f2c6
4 changed files with 134 additions and 99 deletions

View File

@ -28,11 +28,11 @@ class PersonalHonorsController < ApplicationController
params = OrbitHelper.params params = OrbitHelper.params
plugin = Honor.where(:is_hidden=>false).find_by(uid: params[:uid]) plugin = Honor.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [ fields_to_show = [
"year",
"honor_type",
"award_name", "award_name",
"honoree", "honoree",
"awarding_unit", "awarding_unit",
"year",
"honor_type",
"keywords", "keywords",
"url", "url",
"note" "note"

View File

@ -36,6 +36,41 @@ class Honor
plugin_datas plugin_datas
end end
def self.get_plugin_datas_to_member(datas)
fields_to_show = [
"year",
"award_name",
"awarding_unit"
]
pd_title = fields_to_show.collect do |t|
{
"plugin_data_title" => I18n.t("personal_honor.#{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 == "award_name"
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_honor')}'>#{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 "honoree" when "honoree"

View File

@ -2,6 +2,7 @@
<% content_for :page_specific_css do %> <% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/main-forms" %>
<%= 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/file-type" %> <%= javascript_include_tag "lib/file-type" %>
@ -11,101 +12,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>
<!-- personal_honor -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.year") %></label>
<div class="controls">
<%= select_year((@honor.year ? @honor.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'honor[year]', :class => "span1"} ) %>
</div>
</div>
<!-- honor_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.honor_category") %></label>
<div class="controls">
<%= f.select :honor_type_id, @honor_types.collect {|t| [ t.title, t.id ]} %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.language") %></label>
<div class="controls">
<select id="honor_language" name="honor[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @honor.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.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 @honor.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">
@ -148,6 +54,100 @@
</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>
<!-- personal_honor -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.year") %></label>
<div class="controls">
<%= select_year((@honor.year ? @honor.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'honor[year]', :class => "span1"} ) %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.language") %></label>
<div class="controls">
<select id="honor_language" name="honor[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @honor.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- honor_type -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_honor.honor_category") %></label>
<div class="controls">
<%= f.select :honor_type_id, @honor_types.collect {|t| [ t.title, t.id ]} %>
</div>
</div>
<!-- url -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_honor.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_honor.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_honor.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 @honor.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
</div> </div>
<!-- Form Actions --> <!-- Form Actions -->

View File

@ -18,7 +18,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 : "描述"