simple_admin 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,16 @@
|
|
1
1
|
module SimpleAdmin
|
2
2
|
module AdminHelper
|
3
|
+
def expand_block_options!(options)
|
4
|
+
options.each do |key, val|
|
5
|
+
case val
|
6
|
+
when Proc
|
7
|
+
options[key] = instance_exec(@resource, &val)
|
8
|
+
else
|
9
|
+
options[key] = val
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
3
14
|
include SimpleAdmin::TitleHelper
|
4
15
|
include SimpleAdmin::HeaderHelper
|
5
16
|
include SimpleAdmin::TableHelper
|
@@ -2,20 +2,23 @@ module SimpleAdmin
|
|
2
2
|
module FormHelper
|
3
3
|
def form_fields(form, attributes)
|
4
4
|
attributes.map do |col|
|
5
|
+
options = (col.options || {}).dup
|
6
|
+
expand_block_options!(options)
|
7
|
+
|
5
8
|
case col.kind
|
6
9
|
when :attribute
|
7
|
-
form.input col.attribute,
|
10
|
+
form.input col.attribute, options
|
8
11
|
when :content
|
9
12
|
instance_exec(@resource, &col.data)
|
10
13
|
when :fieldset
|
11
|
-
content_tag :fieldset,
|
14
|
+
content_tag :fieldset, options do
|
12
15
|
content_tag :legend do
|
13
|
-
|
14
|
-
end unless
|
16
|
+
options[:legend]
|
17
|
+
end unless options[:legend].blank
|
15
18
|
form_fields(form, col.attributes)
|
16
19
|
end
|
17
20
|
else
|
18
|
-
content_tag :div,
|
21
|
+
content_tag :div, options do
|
19
22
|
form_fields(form, col.attributes)
|
20
23
|
end
|
21
24
|
end
|
data/lib/simple_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 2
|
10
|
+
version: 0.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeff Rafter
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-17 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|