Fix bug.
This commit is contained in:
parent
aff1807a35
commit
6dc3bba750
|
@ -262,9 +262,11 @@ class Admin::PersonalPluginFieldsController < OrbitMemberController
|
|||
strftime_string = ".strftime(\"#{date_time_strftime[field_value[:field_type]]}\")"
|
||||
end
|
||||
["def #{field_value[:field_name]}",
|
||||
" \"\#{self.#{field_value[:field_name]}_start#{strftime_string}} ~ \#{self.#{field_value[:field_name]}_end#{strftime_string}}\"",
|
||||
"end"]
|
||||
}.flatten
|
||||
" #{field_value[:field_name]}_start = self.#{field_value[:field_name]}_start#{strftime_string} rescue \"\"",
|
||||
" #{field_value[:field_name]}_end = self.#{field_value[:field_name]}_end#{strftime_string} rescue \"\"",
|
||||
" \"\#{#{field_value[:field_name]}_start} ~ \#{#{field_value[:field_name]}_end}\"",
|
||||
"end"]
|
||||
}.flatten
|
||||
related_periodic_methods_define = @personal_plugin_field.related_modal_fields.map{|field_values|
|
||||
field_values.select{|f| (f[:periodic_time] == "1" rescue false)}.map{|field_value|
|
||||
strftime_string = ""
|
||||
|
@ -294,6 +296,7 @@ class Admin::PersonalPluginFieldsController < OrbitMemberController
|
|||
iterate_step_text = "1"
|
||||
end
|
||||
end
|
||||
period_fields = primary_modal_fields.select{|f| (f[:periodic_time] == "1" rescue false)}.map{|f| f[:field_name]}
|
||||
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,
|
||||
|
@ -337,7 +340,8 @@ class Admin::PersonalPluginFieldsController < OrbitMemberController
|
|||
"iterate_step_text" => iterate_step_text,
|
||||
"plugin_template_related_members" => plugin_template_related_members.to_s,
|
||||
"periodic_methods_define" => periodic_methods_define,
|
||||
"related_periodic_methods_define" => related_periodic_methods_define
|
||||
"related_periodic_methods_define" => related_periodic_methods_define,
|
||||
"period_fields_text" => period_fields.to_s
|
||||
}
|
||||
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}
|
||||
|
|
|
@ -13,7 +13,7 @@ class PersonalPluginTemplatesController < ApplicationController
|
|||
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"] = "<a href='#{path}'>#{member.name}</a>"
|
||||
fields_hash["authors"] = "<a href='#{path}'>#{member.name}</a>" rescue ""
|
||||
fields_hash["link_to_show"] = OrbitHelper.url_to_show(plugin_template.to_param)
|
||||
fields_hash
|
||||
end
|
||||
|
|
|
@ -43,8 +43,10 @@ parse_again_end
|
|||
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)
|
||||
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.pluralize.to_sym.ne=>[]).count == 0 rescue false)
|
||||
elsif period_fields_text.include?(t)
|
||||
fields_to_remove << t if (datas.select{|d| d.send(t) != " ~ " }.count == 0 rescue false)
|
||||
else
|
||||
fields_to_remove << t if (datas.where(t.to_sym.ne => nil).count == 0 rescue false)
|
||||
end
|
||||
pd_title << {
|
||||
|
|
Loading…
Reference in New Issue