sort and date fixed
This commit is contained in:
parent
e297a6485a
commit
b81faab887
|
@ -147,7 +147,7 @@ class Admin::ExperiencesController < OrbitMemberController
|
||||||
uid = path[-2].split("-").last
|
uid = path[-2].split("-").last
|
||||||
uid = uid.split("?").first
|
uid = uid.split("?").first
|
||||||
end
|
end
|
||||||
@experience = Experience.find_by(:uid => uid) rescue Experience.find("53c4fd3548345219f04c0000")
|
@experience = Experience.find_by(:uid => uid) rescue Experience.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_experience
|
def find_experience
|
||||||
|
|
|
@ -25,6 +25,8 @@ class Experience
|
||||||
|
|
||||||
before_validation :add_http
|
before_validation :add_http
|
||||||
|
|
||||||
|
scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:start_date=>'desc', :end_date => "asc") }
|
||||||
|
|
||||||
def duration
|
def duration
|
||||||
if !self.start_date.nil? or !self.end_date.nil?
|
if !self.start_date.nil? or !self.end_date.nil?
|
||||||
(self.start_date.strftime('%Y.%m') rescue "")+' ~ '+(self.end_date.strftime('%Y.%m') rescue I18n.t('personal_experience.up_to_today'))
|
(self.start_date.strftime('%Y.%m') rescue "")+' ~ '+(self.end_date.strftime('%Y.%m') rescue I18n.t('personal_experience.up_to_today'))
|
||||||
|
@ -40,10 +42,10 @@ class Experience
|
||||||
def self.get_plugin_datas_to_member(datas)
|
def self.get_plugin_datas_to_member(datas)
|
||||||
|
|
||||||
fields_to_show = [
|
fields_to_show = [
|
||||||
|
"experience_type",
|
||||||
"organizationt_title",
|
"organizationt_title",
|
||||||
"department",
|
"department",
|
||||||
"job_title",
|
"job_title",
|
||||||
"experience_type",
|
|
||||||
"duration"
|
"duration"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -53,7 +55,7 @@ class Experience
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
plugin_datas = datas.where(:is_hidden=>false).order_by(:end_date=>'desc', :start_date=>'desc').collect do |p|
|
plugin_datas = datas.sort_for_frontend.collect do |p|
|
||||||
|
|
||||||
pd_data = []
|
pd_data = []
|
||||||
fields_to_show.collect do |t|
|
fields_to_show.collect do |t|
|
||||||
|
@ -68,7 +70,7 @@ class Experience
|
||||||
end
|
end
|
||||||
pd_data << { "data_title" => date }
|
pd_data << { "data_title" => date }
|
||||||
elsif t == "experience_type"
|
elsif t == "experience_type"
|
||||||
pd_data << {"data_title" => p.experience_type.title}
|
pd_data << {"data_title" => (p.experience_type.title rescue "")}
|
||||||
else
|
else
|
||||||
pd_data << { "data_title" => p.send(t) }
|
pd_data << { "data_title" => p.send(t) }
|
||||||
end
|
end
|
||||||
|
@ -76,7 +78,7 @@ class Experience
|
||||||
|
|
||||||
{
|
{
|
||||||
"pd_datas" => pd_data,
|
"pd_datas" => pd_data,
|
||||||
"type-sort" => p.experience_type.sort_position
|
"type-sort" => (p.experience_type.sort_position rescue 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("personal_experience.start_date") %></label>
|
<label class="control-label muted"><%= t("personal_experience.start_date") %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.datetime_picker :start_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %>
|
<%= f.datetime_picker :start_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM", :value => @experience.start_date, :new_record => @experience.new_record? %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("personal_experience.end_date") %></label>
|
<label class="control-label muted"><%= t("personal_experience.end_date") %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.datetime_picker :end_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %>
|
<%= f.datetime_picker :end_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM", :value => @experience.end_date, :new_record => @experience.new_record? %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
<%= javascript_include_tag "personal_experience/jquery-ui.min" %>
|
<%= javascript_include_tag "lib/jquery-ui-sortable.min" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.element{
|
.element{
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills hide">
|
<ul class="nav nav-pills hide">
|
||||||
<% if has_access? %>
|
<% if has_access? %>
|
||||||
<li><%= link_to t('edit'), edit_admin_experience_path(experience) %></li>
|
<li><%= link_to t('edit'), '/admin/members/'+@member.to_param+'/experiences/'+experience.id+'/edit' %></li>
|
||||||
<li><%= link_to t(:delete_), admin_experience_path(id: experience.id, member_profile_id: @member.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
|
<li><%= link_to t(:delete_), admin_experience_path(id: experience.id, member_profile_id: @member.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue