index_for 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/index_for/builder.rb +13 -0
- data/lib/index_for/builders/body_column_builder.rb +1 -1
- data/lib/index_for/builders/head_column_builder.rb +3 -3
- data/lib/index_for/builders/list_column_builder.rb +9 -9
- data/lib/index_for/share_helper.rb +1 -1
- data/lib/index_for/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2010dcbec2b783d82d74ad60ab5c0909cb5417b
|
4
|
+
data.tar.gz: 5e06dd07ccfe91209a45ec9b3d7be27d18fee0ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70d9e5e43515b41b4c7ce2dd633edf1a5d7e7ce40cf81560426d296ff15e50bef342de160949aa556379e323659a3a61648fc8ffdc66be80e8b73b3e4b85cfbb
|
7
|
+
data.tar.gz: 61b801c4b72935510bd56aafa86ad4fd057bf1b138fcec7264e102d3a30073da952572de1243ba039ef610d7f3fdf6ecaeb396739449cfd4689e620e7eff7fd1
|
data/lib/index_for/builder.rb
CHANGED
@@ -24,6 +24,14 @@ module IndexFor
|
|
24
24
|
end.join.html_safe
|
25
25
|
end
|
26
26
|
|
27
|
+
def fields_for attribute_name, options = {}, &block
|
28
|
+
object = @object.send(attribute_name)
|
29
|
+
fields_for = @html_options[:fields_for] || []
|
30
|
+
fields_for.push attribute_name
|
31
|
+
options.merge!(fields_for: attribute_name)
|
32
|
+
@template.capture(self.class.new(object, options, @template), &block)
|
33
|
+
end
|
34
|
+
|
27
35
|
def actions *action_names, █ end
|
28
36
|
|
29
37
|
private
|
@@ -47,6 +55,11 @@ module IndexFor
|
|
47
55
|
type_html_options
|
48
56
|
end
|
49
57
|
|
58
|
+
def attribute_class_name attribute_name
|
59
|
+
class_name = ["attr", *@html_options[:fields_for], attribute_name]
|
60
|
+
class_name.compact!
|
61
|
+
class_name.join("_").to_sym
|
62
|
+
end
|
50
63
|
|
51
64
|
def wrap_content_with type, content, options = {}, &block #:nodoc:
|
52
65
|
type_tag, type_html_options = apply_html type, options
|
@@ -4,7 +4,7 @@ module IndexFor
|
|
4
4
|
class BodyColumnBuilder < Builder
|
5
5
|
|
6
6
|
def attribute attribute_name, options = {}, &block
|
7
|
-
append_html_class options,
|
7
|
+
append_html_class options, attribute_class_name(attribute_name)
|
8
8
|
wrap_content_with :table_body_cell, attribute_value(attribute_name,
|
9
9
|
options), options, &block
|
10
10
|
end
|
@@ -4,16 +4,16 @@ module IndexFor
|
|
4
4
|
class HeadColumnBuilder < Builder
|
5
5
|
|
6
6
|
def attribute attribute_name, options = {}
|
7
|
-
append_html_class options,
|
7
|
+
append_html_class options, attribute_class_name(attribute_name)
|
8
8
|
wrap_with :table_head_cell, attribute_label(attribute_name), options
|
9
9
|
end
|
10
10
|
|
11
11
|
def actions *action_names
|
12
12
|
options = action_names.extract_options!
|
13
13
|
options[:html] = apply_html_options :table_actions_cell, options
|
14
|
-
|
14
|
+
|
15
15
|
wrap_with :table_head_cell, translate(:"actions.actions"), options
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
19
|
-
end
|
19
|
+
end
|
@@ -6,27 +6,27 @@ module IndexFor
|
|
6
6
|
def attribute attribute_name, options = {}, &block
|
7
7
|
label_options = options
|
8
8
|
label_options[:html] = options[:label_html]
|
9
|
+
label = list_label attribute_name, label_options
|
9
10
|
|
10
11
|
content_options = options
|
11
12
|
content_options[:html] = options[:content_html]
|
13
|
+
content = list_content attribute_name, content_options, &block
|
12
14
|
|
13
15
|
row_options = options
|
14
16
|
row_options[:html] = options[:row_html]
|
15
|
-
|
16
|
-
wrap_with :list_row, label(attribute_name, label_options) +
|
17
|
-
content(attribute_name, options, &block), row_options
|
17
|
+
wrap_with :list_row, label + content, row_options
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
append_html_class options,
|
20
|
+
def list_label attribute_name, options
|
21
|
+
append_html_class options, attribute_class_name(attribute_name)
|
22
22
|
wrap_with :list_label, attribute_label(attribute_name), options
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
append_html_class options,
|
27
|
-
wrap_content_with :list_content, attribute_value(attribute_name,
|
25
|
+
def list_content attribute_name, options, &block
|
26
|
+
append_html_class options, attribute_class_name(attribute_name)
|
27
|
+
wrap_content_with :list_content, attribute_value(attribute_name,
|
28
28
|
options), options, &block
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
32
|
-
end
|
32
|
+
end
|
data/lib/index_for/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: index_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|