diff --git a/config/locales/en.yml b/config/locales/en.yml
index 7573e6d..d354e69 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -4,6 +4,7 @@ en:
restful_actions:
fields_setting: Fields Setting
personal_plugin_generator:
+ author_translation_name: Author translation name
personal_plugin_generator: Personal Plugin Generate
personal_plugin_name: Personal Plugin Name Translation
module_name: Module Name
@@ -19,6 +20,7 @@ en:
file: File
select: Select field
year: Year
+ year_month: Year Month
date: Date
time: Time
date_time: Date time
@@ -33,4 +35,5 @@ en:
slug_title: Slug title
please_choose_one_slug_title: Please choose one Slug title!
slug_title_can_only_choose_one: Slug title can only choose one!
- generate_plugin: Generate plugin
\ No newline at end of file
+ generate_plugin: Generate plugin
+ member: Member
\ No newline at end of file
diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml
index eaa4eee..c09be43 100644
--- a/config/locales/zh_tw.yml
+++ b/config/locales/zh_tw.yml
@@ -4,6 +4,7 @@ zh_tw:
restful_actions:
fields_setting: 欄位設定
personal_plugin_generator:
+ author_translation_name: 著作人翻譯名稱
personal_plugin_generator: 個人外掛生成
personal_plugin_name: 個人外掛翻譯名稱
module_name: 模組名稱
@@ -19,6 +20,7 @@ zh_tw:
file: 檔案
select: 選項欄位
year: 年份
+ year_month: 年月
date: 日期
time: 時間
date_time: 日期與時間
@@ -33,4 +35,5 @@ zh_tw:
slug_title: 頭銜標題
please_choose_one_slug_title: 請至少選擇一個頭銜標題!
slug_title_can_only_choose_one: 頭銜標題只能選擇一個!
- generate_plugin: 生成個人外掛
\ No newline at end of file
+ generate_plugin: 生成個人外掛
+ member: 會員
\ No newline at end of file
diff --git a/template_generator/app/controllers/admin/plugin_template_relateds_controller.rb b/template_generator/app/controllers/admin/plugin_template_relateds_controller.rb
index a75f892..3b68d12 100644
--- a/template_generator/app/controllers/admin/plugin_template_relateds_controller.rb
+++ b/template_generator/app/controllers/admin/plugin_template_relateds_controller.rb
@@ -5,7 +5,7 @@ class Admin::PluginTemplateRelatedsController < OrbitMemberController
def new
@plugin_template_related = PluginTemplateRelated.new
- @url = admin_course_semesters_path
+ @url = admin_plugin_template_relateds_path
end
def edit
@@ -21,7 +21,7 @@ class Admin::PluginTemplateRelatedsController < OrbitMemberController
def update
plugin_template_related = PluginTemplateRelated.find(params[:id]) rescue nil
if !plugin_template_related.nil?
- plugin_template_related.update_attributes(course_semester_params)
+ plugin_template_related.update_attributes(plugin_template_related_params)
end
@plugin_template_relateds = PluginTemplateRelated.all
end
diff --git a/template_generator/app/controllers/admin/plugin_templates_controller.rb b/template_generator/app/controllers/admin/plugin_templates_controller.rb
index 2c69b49..ca73d31 100644
--- a/template_generator/app/controllers/admin/plugin_templates_controller.rb
+++ b/template_generator/app/controllers/admin/plugin_templates_controller.rb
@@ -121,6 +121,6 @@ class Admin::PluginTemplatesController < OrbitMemberController
uid = path[-2].split("-").last
uid = uid.split("?").first
end
- @plugin_template = PluginTemplate.find_by(:uid => uid) rescue PluginTemplate.find(params[:id])
+ @plugin_template = PluginTemplate.find_by(:uid => uid) rescue PluginTemplate.find(params[:id])
end
end
\ No newline at end of file
diff --git a/template_generator/app/controllers/personal_plugin_templates_controller.rb b/template_generator/app/controllers/personal_plugin_templates_controller.rb
index 059bf01..abb4f6e 100644
--- a/template_generator/app/controllers/personal_plugin_templates_controller.rb
+++ b/template_generator/app/controllers/personal_plugin_templates_controller.rb
@@ -5,11 +5,12 @@ class PersonalPluginTemplatesController < ApplicationController
member = plugin_template.member_profile
fields_to_show = col_name_to_show_in_index_page
- fields_hash = fields_to_show.map{|field| [field, get_display_field(field)]}.to_h
+ fields_hash = fields_to_show.map{|field| [field, get_display_field(plugin_template,field)]}.to_h
path = OrbitHelper.url_to_plugin_show(member.to_param, 'member') rescue '#'
fields_hash["authors"] = "
#{member.name}"
- fields_hash["link_to_show"] = OrbitHelper.url_to_show(course.to_param)
+ fields_hash["link_to_show"] = OrbitHelper.url_to_show(plugin_template.to_param)
+ fields_hash
end
extras = extra_translate_title
@@ -29,8 +30,8 @@ class PersonalPluginTemplatesController < ApplicationController
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
end
- def get_display_field(field)
- value_case_codes
+ def get_display_field(plugin_template,field)
+ display_field_code
return value
end
end
diff --git a/template_generator/app/models/plugin_template.rb b/template_generator/app/models/plugin_template.rb
index 39cd5a5..276c1e8 100644
--- a/template_generator/app/models/plugin_template.rb
+++ b/template_generator/app/models/plugin_template.rb
@@ -1,24 +1,27 @@
class PluginTemplate
- include Mongoid::Document
- include Mongoid::Timestamps
- include OrbitModel::Status
- include MemberHelper
- include Slug
+ include Mongoid::Document
+ include Mongoid::Timestamps
+ include OrbitModel::Status
+ include MemberHelper
+ include Slug
col_fields
- plugin_template_related_files_fields
+ plugin_template_related_files_fields
- <% parse_again_start %>
- belongs_to :plugin_template_related
- <% parse_again_end %>
+<% parse_again_start %>
+ belongs_to :plugin_template_related
+<% parse_again_end %>
- belongs_to :member_profile
+ belongs_to :member_profile
- scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(plugin_template_sort_hash) }
+ scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(plugin_template_sort_hash) }
- def self.get_plugin_datas_to_member(datas)
+<% parse_again_start %>
+ member_methods_define
+<% parse_again_end %>
+ def self.get_plugin_datas_to_member(datas)
fields_to_show = col_name_to_show
@@ -29,11 +32,13 @@ class PluginTemplate
fields_to_show.each do |t|
if (self.fields[t].type.to_s == "String" || self.fields[t].type.to_s == "Object" rescue false)
fields_to_remove << t if (datas.where(t.to_sym.ne => nil, t.to_sym.ne => "").count == 0 rescue false)
- else
+ elsif (self.relations.include?(t.pluralize) rescue false)
+ fields_to_remove << t if (datas.where(t.pluralize.to_sym.ne=>[]).count == 0 rescue false)
+ else
fields_to_remove << t if (datas.where(t.to_sym.ne => nil).count == 0 rescue false)
end
pd_title << {
- "plugin_data_title" => I18n.t("plugin_template.#{t}")
+ "plugin_data_title" => I18n.t("personal_plugin_template.#{t}")
} if !fields_to_remove.include?(t)
end
@@ -43,7 +48,7 @@ class PluginTemplate
pd_data = []
fields_to_show.collect do |t|
- pd_data << { "data_title" => display_field(t) }
+ pd_data << { "data_title" => p.display_field(t) }
end
{
@@ -58,7 +63,7 @@ class PluginTemplate
end
- def get_plugin_data(fields_to_show)
+ def get_plugin_data(fields_to_show)
plugin_datas = []
fields_to_show.each do |field|
plugin_data = self.get_plugin_field_data(field) rescue nil
@@ -66,9 +71,10 @@ class PluginTemplate
plugin_datas << plugin_data
end
plugin_datas
- end
+ end
def get_plugin_field_data(field)
+ plugin_template = self
value_case_codes
value = (value =~ /\A#{URI::regexp(['http', 'https'])}\z/) ? "
#{value}" : value
@@ -83,6 +89,7 @@ class PluginTemplate
end
def display_field(field)
+ plugin_template = self
display_field_code
end
diff --git a/template_generator/app/views/admin/plugin_template_relateds/_form.html.erb b/template_generator/app/views/admin/plugin_template_relateds/_form.html.erb
index 07b442c..c3b05ac 100644
--- a/template_generator/app/views/admin/plugin_template_relateds/_form.html.erb
+++ b/template_generator/app/views/admin/plugin_template_relateds/_form.html.erb
@@ -1,20 +1,38 @@
-<%= form_for(@course_semester, :html =>{:class=>"form-horizontal", :style=>"margin: 0;"}, :remote => true, :url => @url ) do |f| %>
+<%= form_for(@plugin_template_related, :html =>{:class=>"form-horizontal", :style=>"margin: 0;"}, :remote => true, :url => @url ) do |f| %>
- <%= f.fields_for :title_translations do |f| %>
- <% @site_in_use_locales.each do |locale| %>
-
- <%= label_tag t(locale), t(locale), :class => 'control-label' %>
-
- <%= f.text_field locale, :value => (@course_semester.title_translations[locale] rescue nil) %>
+<% parse_again_start %>
+
+
+
+
+ <% @site_in_use_locales.each_with_index do |locale,i| %>
+
" id="related_locale_fields_<%=locale%>">
+ related_locale_fields_input_fields
+
+ <% end %>
+
+
- <% end %>
- <% end %>
+
+<% parse_again_end %>
+<% parse_again_start %>
+
+
+
+
+ related_none_locale_fields_input_fields
+
+
+<% parse_again_end %>