forked from saurabh/personal-experience
something fix
This commit is contained in:
parent
5694ed3b7f
commit
840d2c0dca
|
@ -31,14 +31,12 @@ class PersonalExperiencesController < ApplicationController
|
|||
plugin = Experience.where(:is_hidden=>false).find_by(uid: params[:uid])
|
||||
|
||||
fields_to_show = [
|
||||
"experience_type",
|
||||
"organizationt_title",
|
||||
"duration",
|
||||
"department",
|
||||
"job_title",
|
||||
"experience_type",
|
||||
"duration",
|
||||
"keywords",
|
||||
"url",
|
||||
"note"
|
||||
"url"
|
||||
]
|
||||
|
||||
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
||||
|
|
|
@ -27,7 +27,7 @@ class Experience
|
|||
|
||||
def duration
|
||||
if !self.start_date.nil? or !self.end_date.nil?
|
||||
self.start_date.strftime('%Y.%m')+' ~ '+self.end_date.strftime('%Y.%m')
|
||||
(self.start_date.strftime('%Y.%m') rescue "")+' ~ '+(self.end_date.strftime('%Y.%m') rescue I18n.t('personal_experience.up_to_today'))
|
||||
else
|
||||
""
|
||||
end
|
||||
|
@ -37,6 +37,51 @@ class Experience
|
|||
[self.organizationt_title,self.department,self.job_title].join(' ')
|
||||
end
|
||||
|
||||
def self.get_plugin_datas_to_member(datas)
|
||||
|
||||
fields_to_show = [
|
||||
"organizationt_title",
|
||||
"department",
|
||||
"job_title",
|
||||
"duration"
|
||||
]
|
||||
|
||||
pd_title = fields_to_show.collect do |t|
|
||||
{
|
||||
"plugin_data_title" => I18n.t("personal_experience.#{t}")
|
||||
}
|
||||
end
|
||||
|
||||
plugin_datas = datas.where(:is_hidden=>false).order_by(:end_date=>'desc', :start_date=>'desc').collect do |p|
|
||||
|
||||
pd_data = []
|
||||
fields_to_show.collect do |t|
|
||||
if t == "organizationt_title"
|
||||
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_experience')}'>#{p.send(t)}" }
|
||||
elsif t == "duration"
|
||||
|
||||
if !p.send('start_date').nil? or !p.send('end_date').nil?
|
||||
date = (p.send('start_date').strftime('%Y.%m') rescue "")+' ~ '+(p.send('end_date').strftime('%Y.%m') rescue I18n.t('personal_experience.up_to_today'))
|
||||
else
|
||||
date = ""
|
||||
end
|
||||
|
||||
pd_data << { "data_title" => date }
|
||||
else
|
||||
pd_data << { "data_title" => p.send(t) }
|
||||
end
|
||||
end
|
||||
|
||||
{
|
||||
"pd_datas" => pd_data
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
return [pd_title,plugin_datas]
|
||||
|
||||
end
|
||||
|
||||
def get_plugin_data(fields_to_show)
|
||||
plugin_datas = []
|
||||
fields_to_show.each do |field|
|
||||
|
|
|
@ -12,5 +12,6 @@
|
|||
</td>
|
||||
<td><%= experience.department %></td>
|
||||
<td><%= experience.job_title %></td>
|
||||
<td><%= experience.member_profile.name rescue "" %></td>
|
||||
</tr>
|
||||
<% end %>
|
|
@ -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" %>
|
||||
|
@ -13,108 +14,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>
|
||||
|
||||
<!-- experience_category -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_experience.experience_category") %></label>
|
||||
<div class="controls">
|
||||
<%= f.select :experience_type_id, @experience_types.collect {|t| [ t.title, t.id ]} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- start_date -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_experience.start_date") %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :start_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- end_date -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_experience.end_date") %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :end_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- keywords -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_experience.keywords") %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :keywords %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- language -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_experience.language") %></label>
|
||||
<div class="controls">
|
||||
<select id="experience_language" name="experience[language]">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<option value="<%= locale %>" <%= @experience.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_experience.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_experience.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 @experience.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">
|
||||
|
@ -168,6 +67,108 @@
|
|||
|
||||
</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>
|
||||
|
||||
<!-- experience_category -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_experience.experience_category") %></label>
|
||||
<div class="controls">
|
||||
<%= f.select :experience_type_id, @experience_types.collect {|t| [ t.title, t.id ]} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- language -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_experience.language") %></label>
|
||||
<div class="controls">
|
||||
<select id="experience_language" name="experience[language]">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<option value="<%= locale %>" <%= @experience.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- start_date -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_experience.start_date") %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :start_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- end_date -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_experience.end_date") %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :end_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- url -->
|
||||
<div class="control-group big-group">
|
||||
<label class="control-label muted"><%= t("personal_experience.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_experience.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_experience.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 @experience.is_hidden? %>">
|
||||
<%= f.check_box :is_hidden %> <%= t(:hide) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<th class="span3"><%= t('personal_experience.organizationt_title') %></th>
|
||||
<th class="span3"><%= t('personal_experience.department') %></th>
|
||||
<th class="span3"><%= t('personal_experience.job_title') %></th>
|
||||
<th class="span1"><%= t('users.name') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_experiences" class="sort-holder">
|
||||
|
|
|
@ -20,6 +20,7 @@ en:
|
|||
issue_no : "Issue.No"
|
||||
form_to_start : "From"
|
||||
form_to_end : "To"
|
||||
up_to_today : "Up to today"
|
||||
duration: "Duration"
|
||||
total_pages : "Total Pages"
|
||||
keywords : "Keywords"
|
||||
|
|
|
@ -20,7 +20,8 @@ zh_tw:
|
|||
vol_no : "卷數"
|
||||
issue_no : "期數"
|
||||
form_to_start : "起"
|
||||
form_to_end : "訖"
|
||||
form_to_end : "迄"
|
||||
up_to_today : "迄今"
|
||||
total_pages : "總頁數"
|
||||
keywords : "關鍵字"
|
||||
abstract : "摘要"
|
||||
|
@ -30,7 +31,7 @@ zh_tw:
|
|||
level_type : "期刊類別"
|
||||
author_type : "作者類別"
|
||||
from : "起"
|
||||
to : "訖"
|
||||
to : "迄"
|
||||
file : "檔案"
|
||||
file_name : "檔案名稱"
|
||||
description : "描述"
|
||||
|
|
Loading…
Reference in New Issue