Add analysis and export.
This commit is contained in:
parent
fea246f017
commit
92eb18951c
|
@ -43,19 +43,18 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
cp_template_dir_path = "#{Rails.root}/tmp/#{@personal_plugin_field.module_name}/"
|
cp_template_dir_path = "#{Rails.root}/tmp/#{@personal_plugin_field.module_name}/"
|
||||||
FileUtils.rm_rf(cp_template_dir_path)
|
FileUtils.rm_rf(cp_template_dir_path)
|
||||||
FileUtils.cp_r(template_dir_path,cp_template_dir_path)
|
FileUtils.cp_r(template_dir_path,cp_template_dir_path)
|
||||||
|
|
||||||
dirs = Dir.glob("#{cp_template_dir_path}*/")
|
dirs = Dir.glob("#{cp_template_dir_path}*/")
|
||||||
files = Dir.glob("#{cp_template_dir_path}*").select { |fn| File.file?(fn) }
|
files = Dir.glob("#{cp_template_dir_path}*").select { |fn| File.file?(fn) }
|
||||||
|
begin
|
||||||
in_use_locales = Site.first.in_use_locales
|
in_use_locales = Site.first.in_use_locales
|
||||||
|
primary_modal_fields = @personal_plugin_field.primary_modal_fields.select{|f| (f[:field_name].present? rescue false)}
|
||||||
yml_files = Dir.glob("#{cp_template_dir_path}config/locales/*.yml")
|
yml_files = Dir.glob("#{cp_template_dir_path}config/locales/*.yml")
|
||||||
yml_files.each do |yml_file|
|
yml_files.each do |yml_file|
|
||||||
locale = yml_file.split("/").last.split(".yml").first
|
locale = yml_file.split("/").last.split(".yml").first
|
||||||
yml_text = File.read(yml_file)
|
yml_text = File.read(yml_file)
|
||||||
translate_hash = {}
|
translate_hash = {}
|
||||||
@personal_plugin_field.primary_modal_fields.each do |field_value|
|
primary_modal_fields.each do |field_value|
|
||||||
if field_value[:field_name] && (field_value[:translation_name][locale].present? rescue false)
|
if (field_value[:translation_name][locale].present? rescue false)
|
||||||
translate_hash[field_value[:field_name]] = field_value[:translation_name][locale]
|
translate_hash[field_value[:field_name]] = field_value[:translation_name][locale]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -88,10 +87,14 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@blank_text = " "
|
@blank_text = " "
|
||||||
slug_title = @personal_plugin_field.primary_modal_fields.select{|field_value| field_value[:slug_title] == "1" rescue false}.first[:field_name].to_s rescue ""
|
slug_title = primary_modal_fields.select{|field_value| field_value[:slug_title] == "1" rescue false}.first[:field_name].to_s rescue ""
|
||||||
plugin_template_related_files = @personal_plugin_field.primary_modal_fields.select{|field_value| field_value[:field_type] == "file" rescue false}.map{|v| v[:field_name]}
|
plugin_template_related_files = primary_modal_fields.select{|field_value| field_value[:field_type] == "file" rescue false}.map{|v| v[:field_name]}
|
||||||
|
plugin_template_related_links = primary_modal_fields.select{|field_value| field_value[:field_type] == "link" rescue false}.map{|v| v[:field_name]}
|
||||||
|
plugin_template_related_members = primary_modal_fields.select{|field_value| field_value[:field_type] == "member" rescue false}.map{|v| v[:field_name]}
|
||||||
plugin_template_related_files_text = plugin_template_related_files.to_s
|
plugin_template_related_files_text = plugin_template_related_files.to_s
|
||||||
plugin_template_related_files_fields = plugin_template_related_files.map{|field_name|
|
plugin_template_related_links_text = plugin_template_related_links.to_s
|
||||||
|
fields = plugin_template_related_files + plugin_template_related_links
|
||||||
|
plugin_template_related_files_fields = fields.map{|field_name|
|
||||||
"has_many :#{field_name.pluralize}, :dependent => :destroy, :autosave => true\r\n" +
|
"has_many :#{field_name.pluralize}, :dependent => :destroy, :autosave => true\r\n" +
|
||||||
"accepts_nested_attributes_for :#{field_name.pluralize}, :allow_destroy => true"
|
"accepts_nested_attributes_for :#{field_name.pluralize}, :allow_destroy => true"
|
||||||
}.join("\r\n")
|
}.join("\r\n")
|
||||||
|
@ -99,15 +102,17 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
backend_index_fields = @personal_plugin_field.backend_fields["index"] rescue []
|
backend_index_fields = @personal_plugin_field.backend_fields["index"] rescue []
|
||||||
backend_index_fields_contents = backend_index_fields.map do |field_name|
|
backend_index_fields_contents = backend_index_fields.map do |field_name|
|
||||||
if field_name == slug_title
|
if field_name == slug_title
|
||||||
"<%= link_to #{plugin_template}.#{field_name}, page_for_#{plugin_template}(#{plugin_template}), target: \"blank\" %>\r\n" +
|
"\r\n <%= link_to #{plugin_template}.#{field_name}, page_for_#{plugin_template}(#{plugin_template}), target: \"blank\" %>\r\n" +
|
||||||
"<div class=\"quick-edit\">"+
|
" <div class=\"quick-edit\">\r\n"+
|
||||||
" <ul class=\"nav nav-pills hide\">"+
|
" <ul class=\"nav nav-pills hide\">\r\n"+
|
||||||
" <li><%= link_to t('edit'), edit_admin_#{plugin_template}_path(#{plugin_template},:page => params[:page]) %></li>"+
|
" <li><%= link_to t('edit'), edit_admin_#{plugin_template}_path(#{plugin_template},:page => params[:page]) %></li>\r\n"+
|
||||||
" <li><%= link_to t(:delete_), admin_#{plugin_template}_path(id: #{plugin_template}.id, :page => params[:page]), method: :delete, data: { confirm: 'Are you sure?' } %></li>"+
|
" <li><%= link_to t(:delete_), admin_#{plugin_template}_path(id: #{plugin_template}.id, :page => params[:page]), method: :delete, data: { confirm: 'Are you sure?' } %></li>\r\n"+
|
||||||
"</ul>"+
|
" </ul>\r\n"+
|
||||||
" </div>\r\n "
|
" </div>\r\n "
|
||||||
elsif field_name.include?(".")
|
elsif field_name.include?(".")
|
||||||
"<%= #{plugin_template}.#{field_name} rescue \"\" %>"
|
"<%= #{plugin_template}.#{field_name} rescue \"\" %>"
|
||||||
|
elsif fields.include?(field_name) || plugin_template_related_members.include?(field_name) #file or link or member
|
||||||
|
"<%= #{plugin_template}.display_field(\"#{field_name}\").html_safe rescue \"\" %>"
|
||||||
else
|
else
|
||||||
"<%= #{plugin_template}.#{field_name} %>"
|
"<%= #{plugin_template}.#{field_name} %>"
|
||||||
end
|
end
|
||||||
|
@ -118,7 +123,7 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
extra_translate_title = col_name_to_show_in_index_page.map{|field_name| #在個人外掛前台index頁面的欄位翻譯名稱hash
|
extra_translate_title = col_name_to_show_in_index_page.map{|field_name| #在個人外掛前台index頁面的欄位翻譯名稱hash
|
||||||
["th-#{field_name}","I18n.t(\"#{@personal_plugin_field.module_name}.#{field_name}\")"]
|
["th-#{field_name}","I18n.t(\"#{@personal_plugin_field.module_name}.#{field_name}\")"]
|
||||||
}
|
}
|
||||||
col_fields = get_fields_text(@personal_plugin_field.primary_modal_fields)
|
col_fields = get_fields_text(primary_modal_fields)
|
||||||
col_related_fields = @personal_plugin_field.related_modal_fields.map{|field_values| get_fields_text(field_values)}
|
col_related_fields = @personal_plugin_field.related_modal_fields.map{|field_values| get_fields_text(field_values)}
|
||||||
plugin_template_related = @personal_plugin_field.related_modal_name.select{|n| n.present?}
|
plugin_template_related = @personal_plugin_field.related_modal_name.select{|n| n.present?}
|
||||||
plugin_template_related_main_field = @personal_plugin_field.related_modal_fields.map{|field_values|
|
plugin_template_related_main_field = @personal_plugin_field.related_modal_fields.map{|field_values|
|
||||||
|
@ -128,7 +133,7 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
slug_titles.map{|field_value| field_value[:field_name]}.select{|t| t.present?}.first
|
slug_titles.map{|field_value| field_value[:field_name]}.select{|t| t.present?}.first
|
||||||
}
|
}
|
||||||
locale_fields , none_locale_fields , locale_fields_input_fields,none_locale_fields_input_fields = get_input_fields(@personal_plugin_field.primary_modal_fields)
|
locale_fields , none_locale_fields , locale_fields_input_fields,none_locale_fields_input_fields = get_input_fields(primary_modal_fields)
|
||||||
related_locale_fields = []
|
related_locale_fields = []
|
||||||
related_none_locale_fields = []
|
related_none_locale_fields = []
|
||||||
related_locale_fields_input_fields = []
|
related_locale_fields_input_fields = []
|
||||||
|
@ -144,7 +149,7 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
backend_profile_fields = backend_index_fields
|
backend_profile_fields = backend_index_fields
|
||||||
backend_profile_fields_contents = backend_index_fields_contents
|
backend_profile_fields_contents = backend_index_fields_contents
|
||||||
datetime_field_types_hash = {"year_month"=>"%Y/%m","date"=>"%Y/%m/%d","time"=>"%H:%M","date_time"=>"%Y/%m/%d %H:%M"}
|
datetime_field_types_hash = {"year_month"=>"%Y/%m","date"=>"%Y/%m/%d","time"=>"%H:%M","date_time"=>"%Y/%m/%d %H:%M"}
|
||||||
datetime_fields = @personal_plugin_field.primary_modal_fields.select{|field_value| datetime_field_types_hash.keys.include?(field_value[:field_type])}.map{|field_value|
|
datetime_fields = primary_modal_fields.select{|field_value| datetime_field_types_hash.keys.include?(field_value[:field_type])}.map{|field_value|
|
||||||
[field_value[:field_name],datetime_field_types_hash[field_value[:field_type]]]
|
[field_value[:field_name],datetime_field_types_hash[field_value[:field_type]]]
|
||||||
}.to_h
|
}.to_h
|
||||||
value_case_codes = ["value = #{plugin_template}.send(field) rescue \"\"",
|
value_case_codes = ["value = #{plugin_template}.send(field) rescue \"\"",
|
||||||
|
@ -153,6 +158,8 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
"#{@blank_text}field.split(\".\").each{|f| value = value.send(f) rescue nil }",
|
"#{@blank_text}field.split(\".\").each{|f| value = value.send(f) rescue nil }",
|
||||||
"end",
|
"end",
|
||||||
"file_fields = #{plugin_template_related_files}",
|
"file_fields = #{plugin_template_related_files}",
|
||||||
|
"link_fields = #{plugin_template_related_links}",
|
||||||
|
"member_fields = #{plugin_template_related_members}",
|
||||||
"if file_fields.include?(field)",
|
"if file_fields.include?(field)",
|
||||||
"#{@blank_text}files = #{plugin_template}.send(field.pluralize)",
|
"#{@blank_text}files = #{plugin_template}.send(field.pluralize)",
|
||||||
"#{@blank_text}value = files.map do |file|",
|
"#{@blank_text}value = files.map do |file|",
|
||||||
|
@ -161,6 +168,22 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
"#{@blank_text * 2}\"<li><a href='\#{url}'' target='_blank'>\#{title}</li>\"",
|
"#{@blank_text * 2}\"<li><a href='\#{url}'' target='_blank'>\#{title}</li>\"",
|
||||||
"#{@blank_text}end",
|
"#{@blank_text}end",
|
||||||
"#{@blank_text}value = value.join(\"\")",
|
"#{@blank_text}value = value.join(\"\")",
|
||||||
|
"elsif link_fields.include?(field)",
|
||||||
|
"#{@blank_text}links = #{plugin_template}.send(field.pluralize)",
|
||||||
|
"#{@blank_text}value = links.map do |link|",
|
||||||
|
"#{@blank_text * 2}url = link.url",
|
||||||
|
"#{@blank_text * 2}title = (link.title.blank? ? url : link.title)",
|
||||||
|
"#{@blank_text * 2}\"<li><a href='\#{url}'' target='_blank'>\#{title}</li>\"",
|
||||||
|
"#{@blank_text}end",
|
||||||
|
"#{@blank_text}value = value.join(\"\")",
|
||||||
|
"elsif member_fields.include?(field)",
|
||||||
|
"#{@blank_text}members = #{plugin_template}.send(field.pluralize)",
|
||||||
|
"#{@blank_text}value = members.map{|m|",
|
||||||
|
"#{@blank_text*2}path = OrbitHelper.url_to_plugin_show(m.to_param, 'member') rescue '#'",
|
||||||
|
"#{@blank_text*2}((text_only rescue false) ? m.name : \"<a href='\#{path}'>\#{m.name}</a>\")",
|
||||||
|
"#{@blank_text}}",
|
||||||
|
"#{@blank_text}join_text = (text_only rescue false) ? \",\" : \"<br>\"",
|
||||||
|
"#{@blank_text}value = value.join(join_text)",
|
||||||
"end",
|
"end",
|
||||||
"strftime_hash = #{datetime_fields}",
|
"strftime_hash = #{datetime_fields}",
|
||||||
"if strftime_hash.keys.include?(field)",
|
"if strftime_hash.keys.include?(field)",
|
||||||
|
@ -178,12 +201,32 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
related_modal_name = @personal_plugin_field.related_modal_name[i]
|
related_modal_name = @personal_plugin_field.related_modal_name[i]
|
||||||
field_names.map{|field_name| "<%= #{related_modal_name}.#{field_name} %>"}
|
field_names.map{|field_name| "<%= #{related_modal_name}.#{field_name} %>"}
|
||||||
}
|
}
|
||||||
member_methods_define = @personal_plugin_field.primary_modal_fields.select{|f| f[:field_type] == "member" && f[:field_name].present?}.map{|field_value|
|
member_methods_define = primary_modal_fields.select{|f| f[:field_type] == "member"}.map{|field_value|
|
||||||
["def #{field_value[:field_name].pluralize}",
|
["def #{field_value[:field_name].pluralize}",
|
||||||
" MemberProfile.find(self.#{field_value[:field_name].singularize}_ids) rescue []",
|
" MemberProfile.find(self.#{field_value[:field_name].singularize}_ids) rescue []",
|
||||||
"end"]
|
"end"]
|
||||||
}.flatten
|
}.flatten
|
||||||
@match_pattern = {"personal_plugin_template" => @personal_plugin_field.module_name,
|
analysis_field_name = @personal_plugin_field.backend_fields[:analysis][0] rescue ""
|
||||||
|
analysis_field_name = "year" if analysis_field_name.blank?
|
||||||
|
analysis_field_input_fields = ""
|
||||||
|
personal_plugin_template = @personal_plugin_field.module_name
|
||||||
|
iterate_step_text = "1.minute"
|
||||||
|
if analysis_field_name.present?
|
||||||
|
field_type = primary_modal_fields.select{|f| f[:field_name] == analysis_field_name}.first[:field_type] rescue "date_time"
|
||||||
|
|
||||||
|
analysis_field_input_fields = ["start","end"].map{|f|
|
||||||
|
"<span><%=t(\"#{personal_plugin_template}.extend_translate.#{f}_#{field_type}\")%></span>" +
|
||||||
|
generate_input_field(field_type,"#{analysis_field_name}_#{f}" ).gsub("<%= f.","<%= ").gsub(", :new_record => @#{plugin_template}.new_record?","")
|
||||||
|
}.join("")
|
||||||
|
if field_type == "date" || field_type == "date_time"
|
||||||
|
iterate_step_text = "1.day"
|
||||||
|
elsif field_type == "year"
|
||||||
|
iterate_step_text = "1"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
time_fields = primary_modal_fields.select{|f| f[:field_type] == "time"}.map{|f| f[:field_name]}
|
||||||
|
before_save_codes = ""#time_fields.map{|f| "self.#{f} = parse_time(self.#{f}.strftime('%H:%M'))"}.join("\r\n")
|
||||||
|
@match_pattern = {"personal_plugin_template" => personal_plugin_template,
|
||||||
"plugin_template" => plugin_template,
|
"plugin_template" => plugin_template,
|
||||||
"plugin_template_related" => plugin_template_related,
|
"plugin_template_related" => plugin_template_related,
|
||||||
"plugin_template_related_files_fields" => plugin_template_related_files_fields,
|
"plugin_template_related_files_fields" => plugin_template_related_files_fields,
|
||||||
|
@ -194,12 +237,14 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
"col_fields" => col_fields,
|
"col_fields" => col_fields,
|
||||||
"col_related_fields" => col_related_fields,
|
"col_related_fields" => col_related_fields,
|
||||||
"plugin_template_file" => plugin_template_related_files,
|
"plugin_template_file" => plugin_template_related_files,
|
||||||
|
"plugin_template_link" => plugin_template_related_links,
|
||||||
"plugin_template_sort_hash" => "nil",
|
"plugin_template_sort_hash" => "nil",
|
||||||
"col_name_to_show_in_index_page_arr" => col_name_to_show_in_index_page,
|
"col_name_to_show_in_index_page_arr" => col_name_to_show_in_index_page,
|
||||||
"related_backend_index_fields" => related_backend_index_fields,
|
"related_backend_index_fields" => related_backend_index_fields,
|
||||||
"related_backend_index_fields_contents" => related_backend_index_fields_contents,
|
"related_backend_index_fields_contents" => related_backend_index_fields_contents,
|
||||||
"backend_index_fields" => backend_index_fields,
|
"backend_index_fields" => backend_index_fields,
|
||||||
"backend_index_fields_contents" => backend_index_fields_contents,
|
"backend_index_fields_contents" => backend_index_fields_contents,
|
||||||
|
"plugin_template_related_links_text" => plugin_template_related_links_text,
|
||||||
"plugin_template_related_files_text" => plugin_template_related_files_text,
|
"plugin_template_related_files_text" => plugin_template_related_files_text,
|
||||||
"locale_fields" => locale_fields,
|
"locale_fields" => locale_fields,
|
||||||
"none_locale_fields" => none_locale_fields,
|
"none_locale_fields" => none_locale_fields,
|
||||||
|
@ -214,7 +259,12 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
"backend_profile_fields_contents" => backend_profile_fields_contents,
|
"backend_profile_fields_contents" => backend_profile_fields_contents,
|
||||||
"value_case_codes" => value_case_codes,
|
"value_case_codes" => value_case_codes,
|
||||||
"display_field_code" => display_field_code,
|
"display_field_code" => display_field_code,
|
||||||
"member_methods_define" => member_methods_define
|
"member_methods_define" => member_methods_define,
|
||||||
|
"analysis_field_name" => analysis_field_name,
|
||||||
|
"analysis_field_input_fields" => analysis_field_input_fields,
|
||||||
|
"before_save_codes" => before_save_codes,
|
||||||
|
"time_fields_text" => time_fields.to_s,
|
||||||
|
"iterate_step_text" => iterate_step_text
|
||||||
}
|
}
|
||||||
max_length = @match_pattern.keys.map{|k| k.length}.max
|
max_length = @match_pattern.keys.map{|k| k.length}.max
|
||||||
@match_pattern = @match_pattern.sort_by{|k,v| (v.class != Array) ? (max_length - k.length) : -k.length}
|
@match_pattern = @match_pattern.sort_by{|k,v| (v.class != Array) ? (max_length - k.length) : -k.length}
|
||||||
|
@ -225,6 +275,12 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
#end
|
#end
|
||||||
copy_templates("#{cp_template_dir_path}modules/#{@personal_plugin_field.module_name}/")
|
copy_templates("#{cp_template_dir_path}modules/#{@personal_plugin_field.module_name}/")
|
||||||
render :html => @logs#@match_pattern#@logs.join("<br>").html_safe#@match_pattern
|
render :html => @logs#@match_pattern#@logs.join("<br>").html_safe#@match_pattern
|
||||||
|
rescue => e
|
||||||
|
@match_pattern = {"parse_again_start"=>"","parse_again_end"=>"","col_name_translate_yaml"=>""}
|
||||||
|
replace_files(files)
|
||||||
|
replace_dirs(dirs,false)
|
||||||
|
render :html => e.backtrace.join("<br>")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def copy_templates(source)
|
def copy_templates(source)
|
||||||
templates = Dir.glob('app/templates/*/').select{|f| File.basename(f) != 'mobile'}
|
templates = Dir.glob('app/templates/*/').select{|f| File.basename(f) != 'mobile'}
|
||||||
|
@ -242,7 +298,7 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
field_name = field_value[:field_name]
|
field_name = field_value[:field_name]
|
||||||
field_type = field_value[:field_type]
|
field_type = field_value[:field_type]
|
||||||
next if field_name.blank?
|
next if field_name.blank?
|
||||||
next if field_type == "file"
|
next if field_type == "file" || field_type == "link"
|
||||||
if (field_value[:localize] == "1" rescue false)
|
if (field_value[:localize] == "1" rescue false)
|
||||||
locale_fields << field_name
|
locale_fields << field_name
|
||||||
input_field = generate_input_field(field_type,field_name,true,extra_field_name,plugin_template)
|
input_field = generate_input_field(field_type,field_name,true,extra_field_name,plugin_template)
|
||||||
|
@ -261,7 +317,7 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
plugin_template = @personal_plugin_field.primary_modal_name if plugin_template.nil?
|
plugin_template = @personal_plugin_field.primary_modal_name if plugin_template.nil?
|
||||||
input_field = ""
|
input_field = ""
|
||||||
field_value_text = "@#{plugin_template}.#{field_name}"
|
field_value_text = "@#{plugin_template}.#{field_name}"
|
||||||
field_name_text = ":#{field_name}"
|
field_name_text = "\"#{field_name}\""
|
||||||
field_name_text = "locale" if localize
|
field_name_text = "locale" if localize
|
||||||
placeholder = "#{personal_plugin_template}.#{field_name}"
|
placeholder = "#{personal_plugin_template}.#{field_name}"
|
||||||
placeholder = "#{personal_plugin_template}.#{extra_field_name}.#{field_name}" if extra_field_name
|
placeholder = "#{personal_plugin_template}.#{extra_field_name}.#{field_name}" if extra_field_name
|
||||||
|
@ -298,17 +354,20 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
def get_fields_text(field_values)
|
def get_fields_text(field_values)
|
||||||
fields_text = field_values.map do |field_value|
|
fields_text = field_values.map do |field_value|
|
||||||
next if field_value[:field_type] == "file" || field_value[:field_name].blank?
|
next if field_value[:field_type] == "file" || field_value[:field_type] == "link" || field_value[:field_name].blank?
|
||||||
type = "String"
|
type = "String"
|
||||||
default = "\"\""
|
default = "\"\""
|
||||||
field_name = field_value[:field_name]
|
field_name = field_value[:field_name]
|
||||||
case field_value[:field_type]
|
case field_value[:field_type]
|
||||||
|
when "year"
|
||||||
|
type = "Integer"
|
||||||
|
default = "DateTime.now.year"
|
||||||
when "date"
|
when "date"
|
||||||
type = "Date"
|
type = "Date"
|
||||||
default = "Date.parse(DateTime.now.to_s)"
|
default = "Date.parse(DateTime.now.to_s)"
|
||||||
when "time"
|
when "time"
|
||||||
type = "Time"
|
type = "String"
|
||||||
default = "Time.now"
|
default = "\"\""
|
||||||
when "date_time"
|
when "date_time"
|
||||||
type = "DateTime"
|
type = "DateTime"
|
||||||
default = "DateTime.now"
|
default = "DateTime.now"
|
||||||
|
@ -432,7 +491,7 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
new_text = new_text.gsub(/<% parse_again_start %>((?:(?!<% parse_again_start %>).)+)<% parse_again_end %>/m) do |ff|
|
new_text = new_text.gsub(/parse_again_start((?:(?!parse_again_start).)+)parse_again_end/m) do |ff|
|
||||||
parse_content = $1 #last match
|
parse_content = $1 #last match
|
||||||
result = ff
|
result = ff
|
||||||
if include_key($1,k)
|
if include_key($1,k)
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% field_types = ["text_field","text_editor","file","select","year","year_month","date","time","date_time","member"].map{|field| [thead_field(field),field]}
|
<% field_types = ["text_field","text_editor","file","link","year","year_month","date","time","date_time","member"].map{|field| [thead_field(field),field]}
|
||||||
field_types1 = field_types.select{|a| a[1] != "file" && a[1] != "member"}
|
field_types1 = field_types.select{|a| a[1] != "file" && a[1] != "member"}
|
||||||
%>
|
%>
|
||||||
<div class="tab-content language-area">
|
<div class="tab-content language-area">
|
||||||
|
@ -228,7 +228,7 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
$("form").submit(function(){
|
$(".main-forms").submit(function(){
|
||||||
if($("#primary_modal_plane .slug_title:checked").length == 0){
|
if($("#primary_modal_plane .slug_title:checked").length == 0){
|
||||||
alert("<%=thead_field('please_choose_one_slug_title')%>");
|
alert("<%=thead_field('please_choose_one_slug_title')%>");
|
||||||
}else if($("#primary_modal_plane .slug_title:checked").length > 1){
|
}else if($("#primary_modal_plane .slug_title:checked").length > 1){
|
||||||
|
|
|
@ -1,18 +1,24 @@
|
||||||
|
<div>
|
||||||
<% object = f.object
|
<% object = f.object
|
||||||
%>
|
%>
|
||||||
<h5><%=thead_field(page_name)%></h5>
|
<h5><%=thead_field(page_name)%></h5>
|
||||||
<table class="table table-bordered">
|
<button type="button" class="select_all btn"><%=t("select_all")%></button>
|
||||||
|
<button type="button" class="de_select_all btn"><%=t("de_select_all")%></button>
|
||||||
|
<table class="table table-bordered" id="<%="#{root_name}_#{page_name}"%>">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<% object.primary_modal_fields.each do |field_value| %>
|
<% object.primary_modal_fields.each do |field_value| %>
|
||||||
|
<% next if (!access_field_types.include?(field_value[:field_type]) rescue false) %>
|
||||||
<th><%="#{field_value[:translation_name][I18n.locale] rescue ""}-#{field_value[:field_name]}"%></th>
|
<th><%="#{field_value[:translation_name][I18n.locale] rescue ""}-#{field_value[:field_name]}"%></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if page_name != "analysis" %>
|
||||||
<% f.object.related_modal_name.each_with_index do |related_modal_name,i| %>
|
<% f.object.related_modal_name.each_with_index do |related_modal_name,i| %>
|
||||||
<% field_values = f.object.related_modal_fields[i].to_a %>
|
<% field_values = f.object.related_modal_fields[i].to_a %>
|
||||||
<% field_values.each do |field_value| %>
|
<% field_values.each do |field_value| %>
|
||||||
<th><%="#{related_modal_name}-#{field_value[:translation_name][I18n.locale] rescue ""}-#{field_value[:field_name]}"%></th>
|
<th><%="#{related_modal_name}-#{field_value[:translation_name][I18n.locale] rescue ""}-#{field_value[:field_name]}"%></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -20,10 +26,12 @@
|
||||||
<%= f.fields_for root_name do |f| %>
|
<%= f.fields_for root_name do |f| %>
|
||||||
<%= f.fields_for page_name do |f| %>
|
<%= f.fields_for page_name do |f| %>
|
||||||
<% object.primary_modal_fields.each do |field_value| %>
|
<% object.primary_modal_fields.each do |field_value| %>
|
||||||
|
<% next if (!access_field_types.include?(field_value[:field_type]) rescue false) %>
|
||||||
<td>
|
<td>
|
||||||
<%= check_box_tag "#{f.object_name}[]", field_value[:field_name] , (object.send(root_name)[page_name].include?(field_value[:field_name]) rescue false),:id=>nil %>
|
<%= check_box_tag "#{f.object_name}[]", field_value[:field_name] , (object.send(root_name)[page_name].include?(field_value[:field_name]) rescue false),:id=>nil %>
|
||||||
</td>
|
</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if page_name != "analysis" %>
|
||||||
<% object.related_modal_name.each_with_index do |related_modal_name,i| %>
|
<% object.related_modal_name.each_with_index do |related_modal_name,i| %>
|
||||||
<% field_values = object.related_modal_fields[i].to_a %>
|
<% field_values = object.related_modal_fields[i].to_a %>
|
||||||
<% field_values.each do |field_value| %>
|
<% field_values.each do |field_value| %>
|
||||||
|
@ -34,6 +42,8 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
|
@ -25,6 +25,7 @@
|
||||||
<h4><%= thead_field('backend_page') %></h4>
|
<h4><%= thead_field('backend_page') %></h4>
|
||||||
<div id="backend_page">
|
<div id="backend_page">
|
||||||
<%= render :partial => 'render_fields_check_table',locals: {:f=>f,:root_name=>'backend_fields',:page_name=>'index'} %>
|
<%= render :partial => 'render_fields_check_table',locals: {:f=>f,:root_name=>'backend_fields',:page_name=>'index'} %>
|
||||||
|
<%= render :partial => 'render_fields_check_table',locals: {:f=>f,:root_name=>'backend_fields',:page_name=>'analysis',:access_field_types=>["date","date_time","year","year_month","time"]} %>
|
||||||
</div>
|
</div>
|
||||||
<h4><%= thead_field('frontend_page') %></h4>
|
<h4><%= thead_field('frontend_page') %></h4>
|
||||||
<div id="frontend_page">
|
<div id="frontend_page">
|
||||||
|
@ -42,3 +43,30 @@
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(".select_all").click(function(){
|
||||||
|
$(this).parent().find("table input").prop("checked",true);
|
||||||
|
})
|
||||||
|
$(".de_select_all").click(function(){
|
||||||
|
$(this).parent().find("table input").prop("checked",false);
|
||||||
|
})
|
||||||
|
if($("#backend_fields_analysis input").length > 0){
|
||||||
|
$(".main-forms").submit(function(){
|
||||||
|
if($("#backend_fields_analysis input:checked").length == 0){
|
||||||
|
alert("<%=thead_field('please_choose_one_analysis_field')%>");
|
||||||
|
}else if($("#backend_fields_analysis input:checked").length > 1){
|
||||||
|
alert("<%=thead_field('analysis_field_can_only_choose_one')%>");
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$('#backend_fields_analysis').css( 'border', '2px solid red');
|
||||||
|
window.location.href = "#backend_fields_analysis";
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
$('#backend_fields_analysis input').click(function(){
|
||||||
|
if($('#backend_fields_analysis input:checked').length == 1){
|
||||||
|
$('#backend_fields_analysis').css( 'border','');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -35,5 +35,9 @@ en:
|
||||||
slug_title: Slug title
|
slug_title: Slug title
|
||||||
please_choose_one_slug_title: Please choose one Slug title!
|
please_choose_one_slug_title: Please choose one Slug title!
|
||||||
slug_title_can_only_choose_one: Slug title can only choose one!
|
slug_title_can_only_choose_one: Slug title can only choose one!
|
||||||
|
please_choose_one_analysis_field: Please choose one analysis field!
|
||||||
|
analysis_field_can_only_choose_one: Analysis field can only choose one!
|
||||||
generate_plugin: Generate plugin
|
generate_plugin: Generate plugin
|
||||||
member: Member
|
member: Member
|
||||||
|
link: Link
|
||||||
|
analysis: Analysis Page
|
|
@ -35,5 +35,9 @@ zh_tw:
|
||||||
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: 頭銜標題只能選擇一個!
|
||||||
|
please_choose_one_analysis_field: 請至少選擇一個分析欄位!
|
||||||
|
analysis_field_can_only_choose_one: 分析欄位只能選擇一個!
|
||||||
generate_plugin: 生成個人外掛
|
generate_plugin: 生成個人外掛
|
||||||
member: 會員
|
member: 會員
|
||||||
|
link: 連結
|
||||||
|
analysis: 分析頁面
|
|
@ -24,21 +24,25 @@ class Admin::PluginTemplatesController < OrbitMemberController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
end
|
end
|
||||||
|
def analysis
|
||||||
|
end
|
||||||
def analysis_report
|
def analysis_report
|
||||||
role = params[:role_id]
|
role = params[:role_id]
|
||||||
year_start = params[:year_start].to_i
|
analysis_field_name_start = params[:analysis_field_name_start]
|
||||||
year_end = params[:year_end].to_i
|
analysis_field_name_end = params[:analysis_field_name_end]
|
||||||
graph_by = params[:graph_by]
|
graph_by = params[:graph_by]
|
||||||
|
|
||||||
@data = get_chart_data(year_start,year_end,role,params[:graph_by])
|
@data = get_chart_data(analysis_field_name_start,analysis_field_name_end,role,params[:graph_by],params[:time_zone])
|
||||||
|
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
def download_excel
|
def download_excel
|
||||||
year_start = params[:year_start].to_i
|
analysis_field_name_start = params[:analysis_field_name_start]
|
||||||
year_end = params[:year_end].to_i
|
analysis_field_name_end = params[:analysis_field_name_end]
|
||||||
@data = get_data_for_excel(year_start,year_end)
|
@data = get_data_for_excel(analysis_field_name_start,analysis_field_name_end,params[:time_zone])
|
||||||
|
@protocol = (request.referer.blank? ? "http" : URI(request.referer).scheme)
|
||||||
|
@host_url = "#{@protocol}://#{request.host_with_port}"
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.xlsx {
|
format.xlsx {
|
||||||
response.headers['Content-Disposition'] = 'attachment; filename="plugin_templates.xlsx"'
|
response.headers['Content-Disposition'] = 'attachment; filename="plugin_templates.xlsx"'
|
||||||
|
@ -103,9 +107,9 @@ class Admin::PluginTemplatesController < OrbitMemberController
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_settings
|
def get_settings
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
@plugin_template_relateds = PluginTemplateRelated.all
|
@plugin_template_relateds = PluginTemplateRelated.all
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_plugin
|
def set_plugin
|
||||||
|
|
|
@ -1,28 +1,58 @@
|
||||||
module Admin::PluginTemplatesHelper
|
module Admin::PluginTemplatesHelper
|
||||||
|
include OrbitFormHelper
|
||||||
|
alias :org_datetime_picker :datetime_picker
|
||||||
|
def datetime_picker(*arg,**args)
|
||||||
|
org_datetime_picker(arg,args)
|
||||||
|
end
|
||||||
|
def time_iterate(start_time, end_time, step, &block)
|
||||||
|
begin
|
||||||
|
yield(start_time)
|
||||||
|
end while (start_time += step) <= end_time
|
||||||
|
end
|
||||||
|
def parse_time(time_str,timezone="+08:00")
|
||||||
|
DateTime.parse("0000-01-01 " + time_str + timezone)
|
||||||
|
end
|
||||||
def page_for_plugin_template(plugin_template_object)
|
def page_for_plugin_template(plugin_template_object)
|
||||||
page = Page.where(:module=>"personal_plugin_template").first
|
page = Page.where(:module=>"personal_plugin_template").first
|
||||||
("/#{I18n.locale}"+page.url+'/'+plugin_template_object.to_param).gsub('//','/') rescue "#"
|
("/#{I18n.locale}"+page.url+'/'+plugin_template_object.to_param).gsub('//','/') rescue "#"
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_data_for_excel(year_start,year_end)
|
def get_data_for_excel(analysis_field_name_start,analysis_field_name_end,timezone)
|
||||||
|
analysis_field_name_start = parse_date_time_field("analysis_field_name",analysis_field_name_start,timezone)
|
||||||
|
analysis_field_name_end = parse_date_time_field("analysis_field_name",analysis_field_name_end,timezone)
|
||||||
data = []
|
data = []
|
||||||
roles = Role.where(:disabled => false, :title.ne => "", :title.ne => nil).asc(:key)
|
roles = Role.where(:disabled => false, :title.ne => "", :title.ne => nil).asc(:key)
|
||||||
roles.each do |role|
|
roles.each do |role|
|
||||||
d = {}
|
d = {}
|
||||||
d["name"] = role.title
|
d["name"] = role.title
|
||||||
mps = role.member_profile_ids
|
mps = role.member_profile_ids
|
||||||
d["data"] = PluginTemplate.where(:year.gte => year_start, :year.lte => year_end, :member_profile_id.in => mps) rescue []
|
d["data"] = PluginTemplate.where(:analysis_field_name.gte => analysis_field_name_start, :analysis_field_name.lte => analysis_field_name_end, :member_profile_id.in => mps) rescue []
|
||||||
data << d
|
data << d
|
||||||
end
|
end
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_chart_data(year_start,year_end,role,type)
|
def get_chart_data(analysis_field_name_start,analysis_field_name_end,role,type,timezone)
|
||||||
|
analysis_field_name_start = parse_date_time_field("analysis_field_name",analysis_field_name_start,timezone)
|
||||||
|
analysis_field_name_end = parse_date_time_field("analysis_field_name",analysis_field_name_end,timezone)
|
||||||
|
main_field_name = ""
|
||||||
|
time_fields = time_fields_text
|
||||||
|
max_iterate = 20
|
||||||
|
iterate_step = iterate_step_text
|
||||||
|
iterate_count = ((analysis_field_name_end - analysis_field_name_start) / iterate_step * 1.day.second).ceil
|
||||||
|
if iterate_count > max_iterate
|
||||||
|
iterate_step = (iterate_step * (iterate_count / max_iterate.to_f).ceil).second
|
||||||
|
end
|
||||||
case type
|
case type
|
||||||
when "semester"
|
when "default"
|
||||||
jls = CourseSemester.all
|
jls = []
|
||||||
when "category"
|
parse_again_start
|
||||||
jls = CourseCategory.all
|
when "plugin_template_related"
|
||||||
|
jls = PluginTemplateRelated.all
|
||||||
|
main_field_name = "plugin_template_related_main_field"
|
||||||
|
parse_again_end
|
||||||
|
else
|
||||||
|
jls = []
|
||||||
end
|
end
|
||||||
|
|
||||||
finaldata = []
|
finaldata = []
|
||||||
|
@ -33,31 +63,69 @@ module Admin::PluginTemplatesHelper
|
||||||
end
|
end
|
||||||
jls.each do |jl|
|
jls.each do |jl|
|
||||||
data = {}
|
data = {}
|
||||||
data["name"] = jl.title
|
data["name"] = jl.send(main_field_name) rescue "N/A"
|
||||||
data["data"] = {}
|
data["data"] = {}
|
||||||
(year_start..year_end).each do |year|
|
time_iterate(analysis_field_name_start,analysis_field_name_end,iterate_step) do |analysis_field_name|
|
||||||
# d1 = DateTime.new(year,1,1,0,0)
|
next_analysis_field_name = analysis_field_name + iterate_step
|
||||||
# d2 = DateTime.new(year,12,31,23,59)
|
current_analysis_field_name = analysis_field_name
|
||||||
t = jl.courses.where(:year.gte => year, :year.lte => year, :member_profile_id.in => mps).count rescue 0
|
current_analysis_field_name = analysis_field_name.strftime("%H:%M") if time_fields.include?("analysis_field_name")
|
||||||
data["data"][year.to_s] = t
|
next_analysis_field_name = next_analysis_field_name.strftime("%H:%M") if time_fields.include?("analysis_field_name")
|
||||||
|
t = jl.plugin_templates.where(:analysis_field_name.gte => current_analysis_field_name, :analysis_field_name.lt => next_analysis_field_name, :member_profile_id.in => mps).count rescue 0
|
||||||
|
if current_analysis_field_name.class == DateTime
|
||||||
|
current_analysis_field_name = display_date_time(current_analysis_field_name,timezone,iterate_step)
|
||||||
|
end
|
||||||
|
data["data"][current_analysis_field_name.to_s] = t
|
||||||
end
|
end
|
||||||
finaldata << data
|
finaldata << data
|
||||||
end
|
end
|
||||||
data = {"name" => "N/A", "data" => {}}
|
data = {"name" => "N/A", "data" => {}}
|
||||||
(year_start..year_end).each do |year|
|
time_iterate(analysis_field_name_start,analysis_field_name_end,iterate_step) do |analysis_field_name|
|
||||||
# d1 = DateTime.new(year,1,1,0,0)
|
next_analysis_field_name = analysis_field_name + iterate_step
|
||||||
# d2 = DateTime.new(year,12,31,23,59)
|
current_analysis_field_name = analysis_field_name
|
||||||
|
current_analysis_field_name = analysis_field_name.strftime("%H:%M") if time_fields.include?("analysis_field_name")
|
||||||
|
next_analysis_field_name = next_analysis_field_name.strftime("%H:%M") if time_fields.include?("analysis_field_name")
|
||||||
case type
|
case type
|
||||||
when "semester"
|
when "default"
|
||||||
t = Course.where(:year.gte => year, :year.lte => year, :member_profile_id.in => mps, :course_semester_id => nil).count rescue 0
|
t = PluginTemplate.where(:analysis_field_name.gte => current_analysis_field_name, :analysis_field_name.lt => next_analysis_field_name, :member_profile_id.in => mps).count rescue 0
|
||||||
when "category"
|
parse_again_start
|
||||||
t = Course.where(:year.gte => year, :year.lte => year, :member_profile_id.in => mps, :course_category_id => nil).count rescue 0
|
when "plugin_template_related"
|
||||||
|
t = PluginTemplate.where(:analysis_field_name.gte => current_analysis_field_name, :analysis_field_name.lt => next_analysis_field_name, :member_profile_id.in => mps, :plugin_template_related_id => nil).count rescue 0
|
||||||
|
parse_again_end
|
||||||
|
else
|
||||||
|
t = PluginTemplate.where(:analysis_field_name.gte => current_analysis_field_name, :analysis_field_name.lt => next_analysis_field_name, :member_profile_id.in => mps).count rescue 0
|
||||||
end
|
end
|
||||||
|
current_analysis_field_name = current_analysis_field_name.new_offset(timezone) if current_analysis_field_name.class == DateTime
|
||||||
data["data"][year.to_s] = t
|
if current_analysis_field_name.class == DateTime
|
||||||
|
current_analysis_field_name = display_date_time(current_analysis_field_name,timezone,iterate_step)
|
||||||
|
end
|
||||||
|
data["data"][current_analysis_field_name.to_s] = t
|
||||||
end
|
end
|
||||||
finaldata << data
|
finaldata << data
|
||||||
finaldata
|
finaldata
|
||||||
end
|
end
|
||||||
|
def parse_date_time_field(field,value,timezone="+08:00")
|
||||||
|
time_fields = time_fields_text
|
||||||
|
if time_fields.include?(field)
|
||||||
|
parse_time(value,timezone)
|
||||||
|
elsif PluginTemplate.fields[field].type == Integer
|
||||||
|
value.to_i
|
||||||
|
elsif PluginTemplate.fields[field].type == Date
|
||||||
|
Date.parse(value)
|
||||||
|
else
|
||||||
|
DateTime.parse(value+timezone).utc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
def display_date_time(date_time,timezone,iterate_step)
|
||||||
|
date_time = date_time.new_offset(timezone)
|
||||||
|
if iterate_step > 1.year
|
||||||
|
date_time = date_time.strftime("%Y")
|
||||||
|
elsif iterate_step > 1.month
|
||||||
|
date_time = date_time.strftime("%Y/%m")
|
||||||
|
elsif iterate_step > 1.day
|
||||||
|
date_time = date_time.strftime("%Y/%m/%d")
|
||||||
|
else
|
||||||
|
date_time = date_time.strftime("%Y/%m/%d %H:%M")
|
||||||
|
end
|
||||||
|
return date_time
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -10,17 +10,24 @@ class PluginTemplate
|
||||||
|
|
||||||
plugin_template_related_files_fields
|
plugin_template_related_files_fields
|
||||||
|
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
belongs_to :plugin_template_related
|
belongs_to :plugin_template_related
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
|
|
||||||
|
field :rss2_id
|
||||||
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) }
|
||||||
|
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
member_methods_define
|
member_methods_define
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
|
before_save do
|
||||||
|
before_save_codes
|
||||||
|
end
|
||||||
|
def parse_time(time_str)
|
||||||
|
DateTime.parse("0000-01-01 " + time_str)
|
||||||
|
end
|
||||||
def self.get_plugin_datas_to_member(datas)
|
def self.get_plugin_datas_to_member(datas)
|
||||||
|
|
||||||
fields_to_show = col_name_to_show
|
fields_to_show = col_name_to_show
|
||||||
|
@ -88,7 +95,7 @@ class PluginTemplate
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_field(field)
|
def display_field(field,text_only=false)
|
||||||
plugin_template = self
|
plugin_template = self
|
||||||
display_field_code
|
display_field_code
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
require 'uri'
|
||||||
|
|
||||||
|
class PluginTemplateLink
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :url
|
||||||
|
field :title, localize: true
|
||||||
|
|
||||||
|
belongs_to :plugin_template
|
||||||
|
|
||||||
|
before_validation :add_http
|
||||||
|
|
||||||
|
#validates :url, :presence => true, :format => /\A(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?\Z/i
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def add_http
|
||||||
|
unless self.url[/^http:\/\//] || self.url[/^https:\/\//]
|
||||||
|
self.url = 'http://' + self.url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -5,7 +5,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("personal_plugin_template.plugin_template_related.related_locale_fields") %></label>
|
<label class="control-label muted"><%= t("personal_plugin_template.plugin_template_related.related_locale_fields") %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
@ -23,8 +23,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<!-- related_none_locale_fields -->
|
<!-- related_none_locale_fields -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("personal_plugin_template.plugin_template_related.related_none_locale_fields") %></label>
|
<label class="control-label muted"><%= t("personal_plugin_template.plugin_template_related.related_none_locale_fields") %></label>
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
related_none_locale_fields_input_fields
|
related_none_locale_fields_input_fields
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||||
|
|
||||||
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<!-- locale_fields -->
|
<!-- locale_fields -->
|
||||||
<div class="control-group input-title">
|
<div class="control-group input-title">
|
||||||
<label class="control-label muted"><%= t("personal_plugin_template.locale_fields") %></label>
|
<label class="control-label muted"><%= t("personal_plugin_template.locale_fields") %></label>
|
||||||
|
@ -48,7 +48,44 @@
|
||||||
locale_fields_input_fields
|
locale_fields_input_fields
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<!-- Link -->
|
||||||
|
<%
|
||||||
|
links_hash = {}
|
||||||
|
plugin_template_related_links_text.each do |link|
|
||||||
|
hash = {}
|
||||||
|
hash["html"] = add_attribute("form_link", f, link.pluralize.to_sym)
|
||||||
|
hash["count"] = @plugin_template.send(link.pluralize).count rescue 0
|
||||||
|
links_hash[link] = hash
|
||||||
|
%>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t("personal_plugin_template.#{link}") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
|
||||||
|
<!-- Exist -->
|
||||||
|
<% if !@plugin_template.new_record? && hash["count"] > 0 %>
|
||||||
|
<div class="exist">
|
||||||
|
<% @plugin_template.send(link.pluralize).each_with_index do |obj, i| %>
|
||||||
|
<% if !obj.new_record? %>
|
||||||
|
<%= f.fields_for link.pluralize.to_sym, obj do |f| %>
|
||||||
|
<%= render :partial => "form_link", :object => obj, :locals => {:f => f, :i => i} %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<!-- Add -->
|
||||||
|
<div class="add-target" for="<%= link %>">
|
||||||
|
</div>
|
||||||
|
<p class="add-btn">
|
||||||
|
<a class="add_link trigger btn btn-small btn-primary" for="<%= link %>"><i class="icons-plus"></i> <%= t(:add) %></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!-- File -->
|
<!-- File -->
|
||||||
|
@ -127,7 +164,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<!-- none_locale_fields -->
|
<!-- none_locale_fields -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("personal_plugin_template.none_locale_fields") %></label>
|
<label class="control-label muted"><%= t("personal_plugin_template.none_locale_fields") %></label>
|
||||||
|
@ -135,16 +172,16 @@
|
||||||
none_locale_fields_input_fields
|
none_locale_fields_input_fields
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<!-- plugin_template_related -->
|
<!-- plugin_template_related -->
|
||||||
<div class="control-group big-group">
|
<div class="control-group big-group">
|
||||||
<label class="control-label muted"><%= t("personal_plugin_template.plugin_template_related.plugin_template_related_main_field") %></label>
|
<label class="control-label muted"><%= t("personal_plugin_template.plugin_template_related.plugin_template_related_main_field") %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.select :plugin_template_related_id, PluginTemplateRelated.all.collect {|t| [ t.plugin_template_related_main_field, t.id ]} %>
|
<%= f.select :plugin_template_related_id, PluginTemplateRelated.all.collect {|t| [ t.plugin_template_related_main_field, t.id ]}, { include_blank: true } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
</div>
|
</div>
|
||||||
<!-- Status Module -->
|
<!-- Status Module -->
|
||||||
<div class="tab-pane fade" id="status">
|
<div class="tab-pane fade" id="status">
|
||||||
|
@ -180,6 +217,18 @@
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var links = <%= links_hash.to_json.html_safe %>;
|
||||||
|
$("a.add_link").on("click",function(){
|
||||||
|
var type = $(this).attr("for"),
|
||||||
|
html = links[type].html,
|
||||||
|
count = parseInt(links[type].count),
|
||||||
|
replaceReg = new RegExp("new_" + type + "s","g");
|
||||||
|
html = html.replace(replaceReg,count);
|
||||||
|
$(".add-target[for=" + type + "]").append(html);
|
||||||
|
count++;
|
||||||
|
links[type].count = count;
|
||||||
|
return false;
|
||||||
|
})
|
||||||
$(document).on('click', '.delete_file', function(){
|
$(document).on('click', '.delete_file', function(){
|
||||||
$(this).parents('.input-prepend').remove();
|
$(this).parents('.input-prepend').remove();
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<div class="input-prepend input-append start-line">
|
||||||
|
<span class="add-on icons-link" title="<%= t(:url) %>"></span>
|
||||||
|
<%= f.text_field :url, class: "input-large", placeholder: t(:url) %>
|
||||||
|
<span class="add-on icons-pencil" title="<%= t(:url_alt) %>"></span>
|
||||||
|
<span class="tab-content">
|
||||||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||||
|
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
|
||||||
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
|
<%= f.text_field locale, :class => "input-large", placeholder: t(:url_alt), :value => (form_link.title_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<% if form_link.new_record? %>
|
||||||
|
<span class="delete_link add-on btn" title="<%= t(:delete_) %>">
|
||||||
|
<a class="icon-trash"></a>
|
||||||
|
</span>
|
||||||
|
<% else %>
|
||||||
|
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
|
||||||
|
<%= f.hidden_field :id %>
|
||||||
|
<a class="icon-remove"></a>
|
||||||
|
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
|
@ -1,17 +1,17 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<th><%= t("personal_plugin_template.plugin_template_related.related_backend_index_fields") %></th>
|
<th><%= t("personal_plugin_template.plugin_template_related.related_backend_index_fields") %></th>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
<th><%= t(:action) %></th>
|
<th><%= t(:action) %></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @plugin_template_relateds.each do |plugin_template_related| %>
|
<% @plugin_template_relateds.each do |plugin_template_related| %>
|
||||||
<tr id="<%= dom_id plugin_template_related %>">
|
<tr id="<%= dom_id plugin_template_related %>">
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<td>related_backend_index_fields_contents</td>
|
<td>related_backend_index_fields_contents</td>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
<td class="span2">
|
<td class="span2">
|
||||||
<a href="<%= edit_admin_plugin_template_related_path(plugin_template_related) %>#plugin_template_related_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
|
<a href="<%= edit_admin_plugin_template_related_path(plugin_template_related) %>#plugin_template_related_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
|
||||||
<%= link_to t(:delete_), admin_plugin_template_related_path(plugin_template_related), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
|
<%= link_to t(:delete_), admin_plugin_template_related_path(plugin_template_related), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<% @plugin_templates.each do |plugin_template| %>
|
<% @plugin_templates.each do |plugin_template| %>
|
||||||
<tr id="<%= dom_id plugin_template %>" class="with_action">
|
<tr id="<%= dom_id plugin_template %>" class="with_action">
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<td> backend_index_fields_contents </td>
|
<td> backend_index_fields_contents </td>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
|
@ -32,24 +32,26 @@
|
||||||
<%= javascript_include_tag "justgage.1.0.1.min" %>
|
<%= javascript_include_tag "justgage.1.0.1.min" %>
|
||||||
<%= javascript_include_tag "raphael.2.1.0.min" %>
|
<%= javascript_include_tag "raphael.2.1.0.min" %>
|
||||||
<%= javascript_include_tag "validator" %>
|
<%= javascript_include_tag "validator" %>
|
||||||
|
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||||
|
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div id="analysis-area">
|
<div id="analysis-area">
|
||||||
<div class="analysis-form">
|
<div class="analysis-form">
|
||||||
<form id="analysis-form" action="" class="form-horizontal main-forms">
|
<form id="analysis-form" action="" class="form-horizontal main-forms">
|
||||||
<div class="input-area">
|
<div class="input-area">
|
||||||
<div class="control-group input-title">
|
<div class="control-group input-title">
|
||||||
<label class="control-label muted"><%= t("personal_course.year") %> : </label>
|
<label class="control-label muted"><%= t("personal_plugin_template.analysis_field_name") %> : </label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= select_year(DateTime.now.year - 5, {:start_year => DateTime.now.year, :end_year => 1950}, {:name => 'start_year', :class => "span1"} ) %>
|
analysis_field_input_fields
|
||||||
-
|
|
||||||
<%= select_year(DateTime.now.year, {:start_year => DateTime.now.year, :end_year => 1950}, {:name => 'end_year', :class => "span1"} ) %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group input-title">
|
<div class="control-group input-title">
|
||||||
<label class="control-label muted"><%= t("personal_course.graph_by") %> : </label>
|
<label class="control-label muted"><%= t("personal_plugin_template.graph_by") %> : </label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= t("personal_course.course_semester") %> <input type="radio" name="graph_by" class="graph-type" value="semester">
|
parse_again_start
|
||||||
<%= t("personal_course.course_category") %> <input data-fv-validation="required;" data-fv-messages="Please select atleast one.;" type="radio" name="graph_by" class="graph-type" value="category">
|
<%= t("personal_plugin_template.plugin_template_related.plugin_template_related_main_field") %>
|
||||||
|
<input type="radio" name="graph_by" class="graph-type" value="plugin_template_related">
|
||||||
|
parse_again_end
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -71,13 +73,19 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var now = new Date();
|
||||||
|
var late_hour = -(Math.floor(now.getTimezoneOffset() / 60));
|
||||||
|
var minute = -(now.getTimezoneOffset() % 60);
|
||||||
|
var sign = (late_hour < 0) ? "-" : "+";
|
||||||
|
var time_zone_string = sign + ("00" + Math.abs(late_hour)).slice(-2) + ":"+ ("00" + Math.abs(minute)).slice(-2);
|
||||||
var form = new FormValidator($("#analysis-form")),
|
var form = new FormValidator($("#analysis-form")),
|
||||||
roleArea = $("#analysis-area .analysis-show-area"),
|
roleArea = $("#analysis-area .analysis-show-area"),
|
||||||
totalRoles = roleArea.find(".role").length;
|
totalRoles = roleArea.find(".role").length;
|
||||||
form.form.on("submit",function(){return false;})
|
form.form.on("submit",function(){return false;})
|
||||||
|
|
||||||
$("#generate_excel").on("click",function(){
|
$("#generate_excel").on("click",function(){
|
||||||
window.location.href = "/admin/courses/download_excel.xlsx?" + "year_start=" + form.form.find("select[name=start_year]").val() + "&year_end=" + form.form.find("select[name=end_year]").val();
|
window.location.href = "/admin/plugin_templates/download_excel.xlsx?" + "analysis_field_name_start=" + form.form.find("[name=analysis_field_name_start]").val() + "&analysis_field_name_end=" + form.form.find("[name=analysis_field_name_end]").val() + "&time_zone=" +
|
||||||
|
time_zone_string;
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -92,8 +100,8 @@
|
||||||
var generateCharts = function(index){
|
var generateCharts = function(index){
|
||||||
var role = roleArea.find(".role").eq(index);
|
var role = roleArea.find(".role").eq(index);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "/admin/courses/analysis_report",
|
url : "/admin/plugin_templates/analysis_report",
|
||||||
data : {"role_id" : role.data("role-id"), "year_start" : form.form.find("select[name=start_year]").val(), "year_end" : form.form.find("select[name=end_year]").val(), "graph_by" : form.form.find("input[name=graph_by]:checked").val()},
|
data : {"role_id" : role.data("role-id"), "analysis_field_name_start" : form.form.find("[name=analysis_field_name_start]").val(), "analysis_field_name_end" : form.form.find("[name=analysis_field_name_end]").val(), "graph_by" : form.form.find("input[name=graph_by]:checked").val(),"time_zone": time_zone_string},
|
||||||
type : "get",
|
type : "get",
|
||||||
dataType : "html"
|
dataType : "html"
|
||||||
}).done(function(html){
|
}).done(function(html){
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<%= column_chart @data, :id => params[:role_id], :height => "350px", :xtitle => "Year", :ytitle => "Total number" %>
|
<%= column_chart @data, :id => params[:role_id], :height => "350px", :xtitle => "#{I18n.t("personal_plugin_template.analysis_field_name")}", :ytitle => "#{I18n.t("personal_plugin_template.extend_translate.total_number")}" %>
|
|
@ -7,32 +7,65 @@ wb = xlsx_package.workbook
|
||||||
|
|
||||||
heading = sheet.styles.add_style(:b => true, :locked => true)
|
heading = sheet.styles.add_style(:b => true, :locked => true)
|
||||||
|
|
||||||
row = ["Name"]
|
row = [t("personal_plugin_template.author_name_translation")]
|
||||||
|
parse_again_start
|
||||||
@site_in_use_locales.each do |locale|
|
@site_in_use_locales.each do |locale|
|
||||||
row << t("personal_course.title") + " - " + t(locale.to_s)
|
row << t("personal_plugin_template.locale_fields") + " - " + t(locale.to_s)
|
||||||
|
end
|
||||||
|
parse_again_end
|
||||||
|
parse_again_start
|
||||||
|
row << t("personal_plugin_template.none_locale_fields")
|
||||||
|
parse_again_end
|
||||||
|
parse_again_start
|
||||||
|
row << t("personal_plugin_template.plugin_template_related.plugin_template_related_main_field")
|
||||||
|
parse_again_end
|
||||||
|
parse_again_start
|
||||||
|
row << t("personal_plugin_template.plugin_template_file")
|
||||||
|
@site_in_use_locales.each do |locale|
|
||||||
|
row << t("personal_plugin_template.plugin_template_file") + " " + t("description") + " - " + t(locale.to_s)
|
||||||
end
|
end
|
||||||
@site_in_use_locales.each do |locale|
|
@site_in_use_locales.each do |locale|
|
||||||
row << t("personal_course.objective") + " - " + t(locale.to_s)
|
row << t("personal_plugin_template.plugin_template_file") + " " + t("alternative") + " - " + t(locale.to_s)
|
||||||
end
|
end
|
||||||
|
parse_again_end
|
||||||
|
parse_again_start
|
||||||
row << t("personal_course.year")
|
row << t("personal_plugin_template.plugin_template_link")
|
||||||
row << t("personal_course.course_semester")
|
@site_in_use_locales.each do |locale|
|
||||||
row << t("personal_course.course_category")
|
row << t("personal_plugin_template.plugin_template_link") + " " + t("url_alt") + " - " + t(locale.to_s)
|
||||||
|
end
|
||||||
|
parse_again_end
|
||||||
sheet.add_row row, :style => heading
|
sheet.add_row row, :style => heading
|
||||||
|
|
||||||
data.each do |course|
|
data.each do |plugin_template|
|
||||||
row = [course.member_profile.name]
|
row = [(plugin_template.member_profile.name rescue "")]
|
||||||
|
parse_again_start
|
||||||
@site_in_use_locales.each do |locale|
|
@site_in_use_locales.each do |locale|
|
||||||
row << course.title_translations[locale.to_s]
|
row << plugin_template.locale_fields_translations[locale.to_s]
|
||||||
|
end
|
||||||
|
parse_again_end
|
||||||
|
parse_again_start
|
||||||
|
row << plugin_template.display_field("none_locale_fields",true)
|
||||||
|
parse_again_end
|
||||||
|
parse_again_start
|
||||||
|
row << (plugin_template.plugin_template_related.plugin_template_related_main_field rescue "")
|
||||||
|
parse_again_end
|
||||||
|
parse_again_start
|
||||||
|
plugin_template_files = plugin_template.plugin_template_files.asc(:created_at)
|
||||||
|
row << plugin_template_files.collect{|f| (@host_url + f.file.url rescue nil)}.join(";")
|
||||||
|
@site_in_use_locales.each do |locale|
|
||||||
|
row << plugin_template_files.collect{|l| l.description_translations[locale]}.join(";")
|
||||||
end
|
end
|
||||||
@site_in_use_locales.each do |locale|
|
@site_in_use_locales.each do |locale|
|
||||||
row << course.objective_translations[locale.to_s]
|
row << plugin_template_files.collect{|l| l.title_translations[locale]}.join(";")
|
||||||
end
|
end
|
||||||
row << course.year
|
parse_again_end
|
||||||
row << course.course_semester.title rescue ""
|
parse_again_start
|
||||||
row << course.course_category.title rescue ""
|
plugin_template_links = plugin_template.plugin_template_links.asc(:created_at)
|
||||||
|
row << plugin_template_links.collect{|l| l.url}.join(";")
|
||||||
|
@site_in_use_locales.each do |locale|
|
||||||
|
row << plugin_template_links.collect{|l| l.title_translations[locale]}.join(";")
|
||||||
|
end
|
||||||
|
parse_again_end
|
||||||
sheet.add_row row
|
sheet.add_row row
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<table class="table main-list">
|
<table class="table main-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<th><%= t('personal_plugin_template.backend_index_fields') %></th>
|
<th><%= t('personal_plugin_template.backend_index_fields') %></th>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="tbody_writing_journals" class="sort-holder">
|
<tbody id="tbody_writing_journals" class="sort-holder">
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<div class="element span4">
|
<div class="element span4">
|
||||||
<div class="detail w-a h-a">
|
<div class="detail w-a h-a">
|
||||||
<p class="totle">
|
<p class="totle">
|
||||||
|
@ -46,10 +46,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<div>
|
<div>
|
||||||
<div style="display:none;" class="modal" id="plugin_template_related_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
<div style="display:none;" class="modal" id="plugin_template_related_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,4 +69,4 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
|
@ -28,9 +28,9 @@
|
||||||
<% if has_access? %>
|
<% if has_access? %>
|
||||||
<th><input type="checkbox" /></th>
|
<th><input type="checkbox" /></th>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<th><%= t('personal_plugin_template.backend_profile_fields') %></th>
|
<th><%= t('personal_plugin_template.backend_profile_fields') %></th>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -41,9 +41,9 @@
|
||||||
<%= check_box_tag 'to_change[]', plugin_template.id.to_s, false, :class => "list-check" %>
|
<%= check_box_tag 'to_change[]', plugin_template.id.to_s, false, :class => "list-check" %>
|
||||||
</td>
|
</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<td>backend_profile_fields_contents</td>
|
<td>backend_profile_fields_contents</td>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -4,4 +4,17 @@ en:
|
||||||
plugin_templates: personal_plugin_template_translate
|
plugin_templates: personal_plugin_template_translate
|
||||||
plugin_template: personal_plugin_template_translate
|
plugin_template: personal_plugin_template_translate
|
||||||
personal_plugin_template:
|
personal_plugin_template:
|
||||||
|
extend_translate:
|
||||||
|
start_time: Start time
|
||||||
|
end_time: End time
|
||||||
|
start_date: Start date
|
||||||
|
end_date: End date
|
||||||
|
start_date_time: Start date & time
|
||||||
|
end_date_time: End date & time
|
||||||
|
start_year: Start year
|
||||||
|
end_year: End year
|
||||||
|
start_year_month: Start year/month
|
||||||
|
end_year_month: End year/month
|
||||||
|
total_number: Total number
|
||||||
|
graph_by: "Graph By"
|
||||||
col_name_translate_yaml
|
col_name_translate_yaml
|
|
@ -4,4 +4,17 @@ zh_tw:
|
||||||
plugin_templates: personal_plugin_template_translate
|
plugin_templates: personal_plugin_template_translate
|
||||||
plugin_template: personal_plugin_template_translate
|
plugin_template: personal_plugin_template_translate
|
||||||
personal_plugin_template:
|
personal_plugin_template:
|
||||||
|
extend_translate:
|
||||||
|
start_time: 開始時間
|
||||||
|
end_time: 結束時間
|
||||||
|
start_date: 開始日期
|
||||||
|
end_date: 結束日期
|
||||||
|
start_date_time: 開始日期時間
|
||||||
|
end_date_time: 結束日期時間
|
||||||
|
start_year: 開始年分
|
||||||
|
end_year: 結束年分
|
||||||
|
start_year_month: 開始年月
|
||||||
|
end_year_month: 結束年月
|
||||||
|
total_number: 總數量
|
||||||
|
graph_by: "Graph By"
|
||||||
col_name_translate_yaml
|
col_name_translate_yaml
|
|
@ -24,9 +24,9 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
resources :plugin_template_relateds
|
resources :plugin_template_relateds
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
<caption><h3>{{widget-title}}</h3></caption>
|
<caption><h3>{{widget-title}}</h3></caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<th class="col-md-1">{{th-col_name_to_show_in_index_page_arr}}</th>
|
<th class="col-md-1">{{th-col_name_to_show_in_index_page_arr}}</th>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody data-level="0" data-list="plugin_templates">
|
<tbody data-level="0" data-list="plugin_templates">
|
||||||
<tr>
|
<tr>
|
||||||
<% parse_again_start %>
|
parse_again_start
|
||||||
<td>{{col_name_to_show_in_index_page_arr}}</td>
|
<td>{{col_name_to_show_in_index_page_arr}}</td>
|
||||||
<% parse_again_end %>
|
parse_again_end
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue