complete address field. still have javascript issue for fill back and display address ext fields in modal.

This commit is contained in:
Matthew K. Fu JuYuan authored and chris committed 2012-11-20 09:53:37 +08:00
1 parent 17988f2fb2
commit 2aa9a19deb
7 files changed
+111 -66

No files matched your search

+19 -7
View File
@@ -5,6 +5,8 @@ class AttributeValue
include AttributeValuesHelper
field :key
field :address_ext
belongs_to :attribute_field
belongs_to :user
@@ -28,7 +30,7 @@ class AttributeValue
else
self.attribute_field.get_data["cross_lang"] =="true" ? self["val"] : Hash[VALID_LOCALES.collect{|lang| [lang,self[lang.to_sym]]}]
end
when 'select','date','radio_button'
when 'select','date','radio_button','address'
self["val"]
when 'checkbox'
self["val"]
@@ -46,28 +48,36 @@ class AttributeValue
case self.attribute_field.markup
when "text_field"
case self.attribute_field.add_more
when true
add_more_index.nil? ? self.value.collect{|t| t[locale]}.join(",") : self.value(add_more_index)[locale]
when false
self.attribute_field.locale ? self[locale.to_s] : self.value
when true
add_more_index.nil? ? self.value.collect{|t| t[locale]}.join(",") : self.value(add_more_index)[locale]
when false
self.attribute_field.locale ? self[locale.to_s] : self.value
end
when "select"
markup_values = self.attribute_field.self_defined_markup_options? ? self.attribute_field.markup_value : self.attribute_field.markup_value
markup_values[self.value][locale.to_s] rescue 'NoData'
when "text_area"
self.attribute_field.locale ? self[locale.to_s] : self.value
when "date"
get_date_by_format
when "addr"
self.value
when "address"
self.value[locale.to_s]
when "radio_button"
markup_values = self.attribute_field.markup_value
markup_values[self.value][locale.to_s]
when "checkbox"
markup_values = self.attribute_field.markup_value
self.value.collect{|key| markup_values[key][locale.to_s]}.join(",")
when "date_durnation"
self.value
else
self.attribute_field.locale ? self[locale.to_s] : self.value
end
@@ -83,6 +93,8 @@ def unset_all_lang_values
def data_proc
unless self[:temp_data].nil?
case self.attribute_field.markup
when "address"
binding.pry
when 'text_field','text_area'
if self.attribute_field.add_more
self["val"] = self["temp_data"]