4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/enjoy/admin/contact_message.rb', line 4
def self.config(fields = {})
Proc.new {
field :c_at do
read_only true
end
field :name
field :content, :text
field :email
field :phone
Enjoy.config.contacts_fields.each_pair do |fn, ft|
next if ft.nil?
if ft.is_a?(Array)
field fn, ft[1].to_sym
else
field fn
end
end
fields.each_pair do |name, type|
if type.nil?
field name
else
if type.is_a?(Array)
field name, type[0], &type[1]
else
field name, type
end
end
end
if block_given?
yield self
end
}
end
|