something fix

This commit is contained in:
spen 2015-01-09 15:46:18 +08:00
parent 34cef75438
commit e7aecbaec2
4 changed files with 137 additions and 99 deletions

View File

@ -28,12 +28,12 @@ class PersonalResearchesController < ApplicationController
params = OrbitHelper.params params = OrbitHelper.params
plugin = Research.where(:is_hidden=>false).find_by(uid: params[:uid]) plugin = Research.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show =[ fields_to_show =[
"year",
"publish_date",
"research_title", "research_title",
"authors", "authors",
"extracted_chapters", "extracted_chapters",
"year",
"language", "language",
"publish_date",
"keywords", "keywords",
"url", "url",
"note", "note",

View File

@ -38,6 +38,42 @@ class Research
plugin_datas plugin_datas
end end
def self.get_plugin_datas_to_member(datas)
fields_to_show = [
"year",
"research_title",
"publish_date",
"authors"
]
pd_title = fields_to_show.collect do |t|
{
"plugin_data_title" => I18n.t("personal_research.#{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 == "research_title"
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_research')}'>#{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 "language" when "language"

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,100 +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_research.year") %></label>
<div class="controls">
<%= select_year((@research.year ? @research.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'research[year]',:class => 'span1'} ) %>
</div>
</div>
<!-- publish_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_research.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publish_date, :no_label => true, :format=>"yyyy/MM" %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_research.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_research.language") %></label>
<div class="controls">
<select id="research" name="research[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @research.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_research.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_research.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 @research.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">
@ -189,6 +96,101 @@
</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_research.year") %></label>
<div class="controls">
<%= select_year((@research.year ? @research.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'research[year]',:class => 'span1'} ) %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_research.language") %></label>
<div class="controls">
<select id="research" name="research[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @research.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- publish_date -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_research.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_research.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_research.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_research.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 @research.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
</div> </div>
<!-- Form Actions --> <!-- Form Actions -->

View File

@ -6,7 +6,7 @@ zh_tw:
research_title : "名稱" research_title : "名稱"
extracted_chapters : "摘要" extracted_chapters : "摘要"
publishers : "Publishers" publishers : "Publishers"
authors : "作者" authors : "全部作者"
tags : "領域" tags : "領域"
year : "年度" year : "年度"
language : "語言" language : "語言"
@ -14,7 +14,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 : "摘要"
@ -25,7 +25,7 @@ zh_tw:
level_type : "期刊類別" level_type : "期刊類別"
author_type : "作者類別" author_type : "作者類別"
from : "起" from : "起"
to : "" to : ""
file : "檔案" file : "檔案"
file_name : "檔案名稱" file_name : "檔案名稱"
description : "描述" description : "描述"