for user new interface, member role is working.
This commit is contained in:
1 parent
b301f6522a
commit
bd0d975014
15 files changed
+312
-90
No files matched your search
@@ -22,10 +22,35 @@ class AttributeField
|
||||
|
||||
belongs_to :attribute
|
||||
# belongs_to :role
|
||||
has_many :attribute_values
|
||||
has_many :attribute_values,:autosave => true, :dependent => :destroy
|
||||
|
||||
# validates_uniqueness_of :key
|
||||
|
||||
def self_defined_markup_options?
|
||||
(self.attribute.role.method(self[:key].pluralize.to_sym) && self.attribute.role.method(self[:key].pluralize+"_for_"+markup)) rescue false
|
||||
end
|
||||
|
||||
def markup_value=(var)
|
||||
if !self_defined_markup_options?
|
||||
self[:markup_value] = (eval(var) rescue {})
|
||||
end
|
||||
end
|
||||
|
||||
def markup_value
|
||||
if self_defined_markup_options?
|
||||
#Class need to have corresponding field and value agent
|
||||
# Ex: For "status" the class must have field called "statuses" for the relation and "statuses_for_select" for the select function
|
||||
method = self.attribute.role.method(self[:key].pluralize+"_for_"+markup)
|
||||
return (method.call rescue {})
|
||||
elsif self[:markup_value].nil? || (self[:markup_value].empty?)
|
||||
return {}
|
||||
else
|
||||
return self[:markup_value]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def markup_options=(var)
|
||||
self[:markup_options] = (eval(var) rescue {})
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user