Fixing bugs

This commit is contained in:
chris committed 2012-11-05 11:30:15 +08:00
1 parent 6783844937
commit 58d4554b0b
3 files changed
+18 -17

No files matched your search

+6 -1
View File
@@ -35,7 +35,12 @@ class AttributeField
end
def locale
(get_data["locale"] == "true" ? true : false) rescue false
default = true
if get_data["locale"].nil?
return default
else
(get_data["locale"] == "true" ? true : false) rescue default
end
end
def self_defined_markup_options?
+9 -9
View File
@@ -17,7 +17,7 @@ class AttributeValue
def data_proc
# binding.pry
# binding.pry if self.attribute_field.markup == 'radio_button'
if self.attribute_field.locale
# if self.attribute_field
case self.attribute_field.markup
when 'text_field','text_area'
# binding.pry
@@ -38,7 +38,7 @@ class AttributeValue
when 'checkbox'
self["val"] = self[:temp_data].keys rescue {}
end #end of case
end
# end #of if self.attribute_field
self.unset('temp_data')
end
@@ -72,29 +72,29 @@ class AttributeValue
end
def get_value_by_locale(locale)
case self.attribute_field.markup
when "text_field"
self.attribute_field.locale ? self.value[locale.to_s] : self.value
self.attribute_field.locale ? self[locale.to_s] : self.value
when "select"
markup_values = self.attribute_field.self_defined_markup_options? ? self.attribute_field.markup_value : eval(self.attribute_field.markup_value)
markup_values[self.value][locale.to_s] rescue 'NoData'
when "text_area"
self.attribute_field.locale ? self.value[locale.to_s] : self.value
self.attribute_field.locale ? self[locale.to_s] : self.value
when "date"
Date.new(self[:val]["(1i)"].to_i,self[:val]["(2i)"].to_i,self[:val]["(3i)"].to_i) rescue nil
when "addr"
self.value
when "radio_button"
markup_values = eval(self.attribute_field.markup_value)
markup_values[self.value][locale.to_s]
markup_values[:value][locale.to_s]
when "checkbox"
markup_values = eval(self.attribute_field.markup_value)
self.value.collect{|key| markup_values[key][locale.to_s] }.join(",")
markup_values = self.attribute_field.markup_value
self[:value].keys.collect{|key| markup_values[key][locale.to_s]}.join(",")
when "date_durnation"
self.value
else
self.attribute_field.locale ? self.value[locale.to_s] : self.value
self.attribute_field.locale ? self[locale.to_s] : self.value
end
end