126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# File 'lib/common_lib/action_view_extension/base.rb', line 126
def method_missing_with_wrapping(symb,*args, &block)
method_name = symb.to_s
if method_name =~ /^wrapped_(.+)$/
unwrapped_method_name = $1
object_name = args[0]
method = args[1]
content = field_wrapper(method,:class => unwrapped_method_name) do
s = if respond_to?(unwrapped_method_name)
options = args.detect{|i| i.is_a?(Hash) }
label_text = options.delete(:label_text) unless options.nil?
if unwrapped_method_name == 'check_box'
send("#{unwrapped_method_name}",*args,&block) <<
label( object_name, method, label_text )
else
label( object_name, method, label_text ) <<
send("#{unwrapped_method_name}",*args,&block)
end
else
send("_#{method_name}",*args,&block)
end
s << (( block_given? )? capture(&block) : '')
end
content
else
method_missing_without_wrapping(symb,*args, &block)
end
end
|