something fix

This commit is contained in:
spen 2015-01-09 15:32:31 +08:00
parent b195e043e6
commit feacd017ef
5 changed files with 225 additions and 214 deletions

View File

@ -27,25 +27,26 @@ class PersonalConferencesController < ApplicationController
plugin = WritingConference.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [
"paper_title",
"conference_title",
"paper_level",
"paper_type",
"year",
"author_name",
"authors",
"number_of_authors",
"author_type",
"year",
"language",
"isi_number",
"paper_title",
"conference_title",
"location",
"period_start_date",
"period_end_date",
"url",
"isbn",
"note",
"location",
"paper_type",
"paper_level",
"sponsor",
"file"
"author_type",
"number_of_authors",
"abstract",
"url",
"file",
"publication_date",
"isbn",
"isi_number" ,
"language"
]
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}

View File

@ -4,6 +4,7 @@ class WritingConference
include OrbitModel::Status
include OrbitTag::Taggable
include MemberHelper
include Slug
field :paper_title, as: :slug_title, localize: true
@ -42,17 +43,23 @@ class WritingConference
def create_link
title = []
title << self.member_profile.name if self.member_profile_id.present?
title << self.authors if self.authors.present?
if !self.publication_date.nil?
pd = self.publication_date.strftime("%Y-%m-%d").split('-')
title << pd[0]
end
title << self.paper_title if self.paper_title.present?
title << self.conference_title if self.conference_title.present?
title << self.location if self.location.present?
paper_types = ( !self.conference_paper_types.blank? ? self.conference_paper_types.collect{|x| x.title}.join(', ') : "")
paper_levels = ( !self.conference_paper_levels.blank? ? "(#{self.conference_paper_levels.collect{|x| x.title}.join(', ')})" : "")
title << paper_types + paper_levels
title << "#{period_start_date}-#{period_end_date}" if (self.period_start_date.present? && self.period_end_date.present?)
# if !self.publication_date.nil?
# pd = self.publication_date.strftime("%Y-%m-%d").split('-')
# title << pd[0]
# end
title << self.year
title.join(', ')
end
@ -84,6 +91,8 @@ class WritingConference
value = value.join(" / ")
when "publication_date"
value = self.publication_date.to_date.strftime("%Y-%m-%d") rescue ""
when "abstract"
value = nl2br(self.abstract)
when "language"
value = I18n.t(self.language) rescue ""
when "file"

View File

@ -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,193 +16,6 @@
<!-- 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_conference.year") %></label>
<div class="controls">
<%= select_year((@writing_conference.year ? @writing_conference.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_conference[year]',:class => 'span1'} ) %>
</div>
</div>
<!-- paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.paper_type") %></label>
<div class="controls">
<% @paper_types.each do |paper_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[conference_paper_type_ids][]', paper_type.id, @writing_conference.conference_paper_type_ids.include?(paper_type.id)%>
<%= paper_type.title %>
<%= hidden_field_tag 'writing_conference[conference_paper_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- paper_level -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.paper_level") %></label>
<div class="controls">
<% @paper_levels.each do |paper_level| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[conference_paper_level_ids][]', paper_level.id, @writing_conference.conference_paper_level_ids.include?(paper_level.id)%>
<%= paper_level.title %>
<%= hidden_field_tag 'writing_conference[conference_paper_level_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[conference_author_type_ids][]', author_type.id, @writing_conference.conference_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<%= hidden_field_tag 'writing_conference[conference_author_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- number_of_authors -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.number_of_authors") %></label>
<div class="controls">
<%= f.text_field :number_of_authors, :class=>'span1' %>
</div>
</div>
<!-- period_start_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.period_start_date") %></label>
<div class="controls">
<%= f.datetime_picker :period_start_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- period_end_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.period_end_date") %></label>
<div class="controls">
<%= f.datetime_picker :period_end_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publication_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.language") %></label>
<div class="controls">
<select id="writing_conference_language" name="writing_conference[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @writing_conference.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- ISBN -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.isbn") %></label>
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<!-- ISI Numebr -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.isi_number") %></label>
<div class="controls">
<%= f.text_field :isi_number %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.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_conference.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords, :class => "span6" %>
</div>
</div>
<!-- abstract -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.abstract") %></label>
<div class="controls">
<%= f.text_area :abstract, rows: 2, class: "input-block-level" %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.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">
<!-- 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 @writing_conference.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
@ -303,6 +117,193 @@
</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_conference.year") %></label>
<div class="controls">
<%= select_year((@writing_conference.year ? @writing_conference.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_conference[year]',:class => 'span1'} ) %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.language") %></label>
<div class="controls">
<select id="writing_conference_language" name="writing_conference[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @writing_conference.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- period_start_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.period_start_date") %></label>
<div class="controls">
<%= f.datetime_picker :period_start_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- period_end_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.period_end_date") %></label>
<div class="controls">
<%= f.datetime_picker :period_end_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- paper_level -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.paper_level") %></label>
<div class="controls">
<% @paper_levels.each do |paper_level| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[conference_paper_level_ids][]', paper_level.id, @writing_conference.conference_paper_level_ids.include?(paper_level.id)%>
<%= paper_level.title %>
<%= hidden_field_tag 'writing_conference[conference_paper_level_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.paper_type") %></label>
<div class="controls">
<% @paper_types.each do |paper_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[conference_paper_type_ids][]', paper_type.id, @writing_conference.conference_paper_type_ids.include?(paper_type.id)%>
<%= paper_type.title %>
<%= hidden_field_tag 'writing_conference[conference_paper_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[conference_author_type_ids][]', author_type.id, @writing_conference.conference_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<%= hidden_field_tag 'writing_conference[conference_author_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- number_of_authors -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.number_of_authors") %></label>
<div class="controls">
<%= f.text_field :number_of_authors, :class=>'span1' %>
</div>
</div>
<!-- ISBN -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.isbn") %></label>
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publication_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- ISI Numebr -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.isi_number") %></label>
<div class="controls">
<%= f.text_field :isi_number %>
</div>
</div>
<!-- url -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_conference.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_conference.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords, :class => "span6" %>
</div>
</div>
<!-- abstract -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_conference.abstract") %></label>
<div class="controls">
<%= f.text_area :abstract, rows: 2, class: "input-block-level" %>
</div>
</div>
<!-- note -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_conference.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">
<!-- 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 @writing_conference.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
</div>
<!-- Form Actions -->

View File

@ -2,7 +2,7 @@
<tr id="<%= dom_id writing_conference %>" class="<%= writing_conference.is_hidden ? "checkHide" : "" %>">
<td><%= writing_conference.year %></td>
<td>
<%= link_to writing_conference.paper_title, OrbitHelper.url_to_plugin_show(writing_conference.to_param,'personal_conference'), target: "blank"%>
<%= link_to writing_conference.create_link, OrbitHelper.url_to_plugin_show(writing_conference.to_param,'personal_conference'), target: "blank"%>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('edit'), edit_admin_writing_conference_path(writing_conference) %></li>

View File

@ -26,7 +26,7 @@ zh_tw:
# form_to_start : "From"
# form_to_end : "To"
# from : "起"
# to : ""
# to : ""
abstract : "摘要"
publication_date : "發表日期"
url : "參考連結"