diff --git a/app/controllers/personal_diplomas_controller.rb b/app/controllers/personal_diplomas_controller.rb
index 828cd61..146ec1d 100644
--- a/app/controllers/personal_diplomas_controller.rb
+++ b/app/controllers/personal_diplomas_controller.rb
@@ -35,9 +35,7 @@ class PersonalDiplomasController < ApplicationController
"country",
"department",
"degree",
- "url",
- "keywords",
- "note"
+ "url"
]
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
diff --git a/app/models/diploma.rb b/app/models/diploma.rb
index 982150f..c144327 100644
--- a/app/models/diploma.rb
+++ b/app/models/diploma.rb
@@ -27,7 +27,7 @@ class Diploma
def duration
if !self.start_date.nil? or !self.end_date.nil?
- (self.start_date.strftime('%Y.%m') rescue "")+' ~ '+(self.end_date.strftime('%Y.%m') rescue "")
+ (self.start_date.strftime('%Y.%m') rescue "")+' ~ '+(self.end_date.strftime('%Y.%m') rescue I18n.t('personal_diploma.up_to_today'))
else
""
end
@@ -37,6 +37,50 @@ class Diploma
[self.school_name,self.department,self.degree].join(' ')
end
+ def self.get_plugin_datas_to_member(datas)
+
+ fields_to_show = [
+ "school_name",
+ "country",
+ "department",
+ "degree",
+ "duration"
+ ]
+
+ pd_title = fields_to_show.collect do |t|
+ {
+ "plugin_data_title" => I18n.t("personal_diploma.#{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 == "school_name"
+ pd_data << { "data_title" => "#{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_diploma.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|
diff --git a/app/views/admin/diplomas/_diploma.html.erb b/app/views/admin/diplomas/_diploma.html.erb
index d130797..db83dfc 100644
--- a/app/views/admin/diplomas/_diploma.html.erb
+++ b/app/views/admin/diplomas/_diploma.html.erb
@@ -1,6 +1,5 @@
<% @diplomas.each do |diploma| %>
">
-
<% end %>
\ No newline at end of file
diff --git a/app/views/admin/diplomas/_form.html.erb b/app/views/admin/diplomas/_form.html.erb
index c6c44bd..d8ffc84 100644
--- a/app/views/admin/diplomas/_form.html.erb
+++ b/app/views/admin/diplomas/_form.html.erb
@@ -2,6 +2,7 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= 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" %>
@@ -12,103 +13,6 @@
<%= diploma.member_profile.name rescue "" %>
<%= diploma.duration %>
<%= link_to diploma.school_name, OrbitHelper.url_to_plugin_show(diploma.to_param,'personal_diploma'), target: "blank"%>
@@ -13,5 +12,6 @@
<%= diploma.department %>
<%= diploma.degree %>
+ <%= diploma.member_profile.name rescue "" %>
<%= t('users.name') %> | <%= t('personal_diploma.duration') %> | <%= t('personal_diploma.school_name') %> | <%= t('personal_diploma.department') %> | <%= t('personal_diploma.degree') %> | +<%= t('users.name') %> |
---|