something fix

This commit is contained in:
spen 2015-01-09 15:45:32 +08:00
parent ea0ead04fc
commit b27d04042c
6 changed files with 131 additions and 93 deletions

View File

@ -28,13 +28,13 @@ class PersonalLabsController < ApplicationController
params = OrbitHelper.params
plugin = Lab.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [
"year",
"lab_title",
"location",
"participating_professor",
"participating_student",
"research_direction",
"facility",
"year",
"keywords",
"extension_no",
"url",

View File

@ -39,6 +39,41 @@ class Lab
plugin_datas
end
def self.get_plugin_datas_to_member(datas)
fields_to_show = [
"year",
"lab_title",
"location"
]
pd_title = fields_to_show.collect do |t|
{
"plugin_data_title" => I18n.t("personal_lab.#{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 == "lab_title"
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_lab')}'>#{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 "language"

View File

@ -13,6 +13,96 @@
<!-- Input Area -->
<div class="input-area">
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- lab_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.lab_title") %></label>
<div class="controls">
<%= f.fields_for :lab_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.lab_title"), value: (@lab.lab_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- location-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.location") %></label>
<div class="controls">
<%= f.fields_for :location_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.location"), value: (@lab.location_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- participating_professor-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.participating_professor") %></label>
<div class="controls">
<%= f.fields_for :participating_professor_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_professor"), value: (@lab.participating_professor_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- participating_student-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.participating_student") %></label>
<div class="controls">
<%= f.fields_for :participating_student_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_student"), value: (@lab.participating_student_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if @lab && !@lab.lab_files.blank? %>
<div class="exist">
<% @lab.lab_files.each_with_index do |lab_file, i| %>
<%= f.fields_for :lab_files, lab_file do |f| %>
<%= render :partial => 'form_file', :object => lab_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'plugin_file_field_count', @lab.lab_files.count %>
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
</div>
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
@ -110,96 +200,7 @@
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- lab_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.lab_title") %></label>
<div class="controls">
<%= f.fields_for :lab_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.lab_title"), value: (@lab.lab_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- location-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.location") %></label>
<div class="controls">
<%= f.fields_for :location_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.location"), value: (@lab.location_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- participating_professor-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.participating_professor") %></label>
<div class="controls">
<%= f.fields_for :participating_professor_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_professor"), value: (@lab.participating_professor_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- participating_student-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.participating_student") %></label>
<div class="controls">
<%= f.fields_for :participating_student_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_student"), value: (@lab.participating_student_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if @lab && !@lab.lab_files.blank? %>
<div class="exist">
<% @lab.lab_files.each_with_index do |lab_file, i| %>
<%= f.fields_for :lab_files, lab_file do |f| %>
<%= render :partial => 'form_file', :object => lab_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'plugin_file_field_count', @lab.lab_files.count %>
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
</div>
</div>
<!-- Form Actions -->

View File

@ -11,5 +11,6 @@
</div>
</td>
<td><%= lab.location %></td>
<td><%= lab.member_profile.name rescue "" %></td>
</tr>
<% end %>

View File

@ -4,6 +4,7 @@
<th class="span1"><%= t('personal_lab.year') %></th>
<th class="span3"><%= t('module_name.personal_lab') %></th>
<th class="span1"><%= t('personal_lab.location') %></th>
<th class="span1"><%= t('users.name') %></th>
</tr>
</thead>
<tbody id="tbody_labs" class="sort-holder">

View File

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