formnestic 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/formnestic.gemspec +1 -1
- data/lib/formnestic/helpers/inputs_helper.rb +86 -13
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1621bcb434bcdbcba856cb23bc8be60ea07f1722ccc468abe0a80b2f3adbe28
|
4
|
+
data.tar.gz: 54fc1c385b28dda9f53090a7d092826d3f72c9a3fc208a3e7da258cd143964f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfca5c52f22b47c1c35b444c5b53ce6fa0803cb8796d6f6337ca4416cc2c7f29e907394b95d81365dd56eba78192d0252320a4a437f504fa6727a8b0e2a8b22f
|
7
|
+
data.tar.gz: 1fea05ff4909724c25da44289f6aae4d2a0e01d41d695713dd5b4bb1198fd5c6f9683bd74e191d38b9df649638bdbab1788c0c7006584bcf25e50208c95f6858
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.11
|
data/formnestic.gemspec
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# rubocop:disable MethodLength, AbcSize, ModuleLength
|
1
2
|
module Formnestic
|
2
3
|
module Helpers
|
3
4
|
module InputsHelper
|
@@ -13,18 +14,54 @@ module Formnestic
|
|
13
14
|
|
14
15
|
# for listing form
|
15
16
|
def formnestic_list_row_inputs(*args, &block)
|
16
|
-
html_options =
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
html_options =
|
18
|
+
formnestic_prepare_html_options_for_wrapper(:list, *args)
|
19
|
+
rows_counter =
|
20
|
+
template.content_tag(
|
21
|
+
:span,
|
22
|
+
options[:parent_builder].rows_counter,
|
23
|
+
class: 'formnestic-li-fieldset-for-order'
|
24
|
+
)
|
25
|
+
content_div_content = [
|
26
|
+
formnestic_legend_for_list_form,
|
27
|
+
' #'.html_safe,
|
28
|
+
rows_counter
|
29
|
+
].join.html_safe
|
30
|
+
title_div = template.content_tag(
|
31
|
+
:div,
|
32
|
+
content_div_content,
|
33
|
+
class: 'formnestic-li-fieldset-legend'
|
34
|
+
)
|
35
|
+
template.content_tag(
|
36
|
+
:fieldset, [
|
37
|
+
title_div, (
|
38
|
+
if options[:row_removable]
|
39
|
+
formnestic_row_removing_content_tag(:list)
|
40
|
+
else
|
41
|
+
''
|
42
|
+
end
|
43
|
+
),
|
44
|
+
template.capture(&block)
|
45
|
+
].join.html_safe,
|
46
|
+
html_options
|
47
|
+
)
|
21
48
|
end
|
22
49
|
|
23
50
|
# For table form
|
24
51
|
def formnestic_table_row_inputs(*args, &block)
|
25
|
-
html_options =
|
26
|
-
|
27
|
-
|
52
|
+
html_options =
|
53
|
+
formnestic_prepare_html_options_for_wrapper(:table, *args)
|
54
|
+
template.content_tag(
|
55
|
+
:tr, [
|
56
|
+
template.capture(&block), (
|
57
|
+
if options[:row_removable]
|
58
|
+
formnestic_row_removing_content_tag(:table)
|
59
|
+
else
|
60
|
+
''
|
61
|
+
end
|
62
|
+
)
|
63
|
+
].join.html_safe, html_options
|
64
|
+
)
|
28
65
|
end
|
29
66
|
|
30
67
|
def formnestic_legend_for_list_form
|
@@ -40,20 +77,55 @@ formnestic_row_removing_content_tag(:table) : '')].join.html_safe, html_options)
|
|
40
77
|
.downcase
|
41
78
|
.titleize
|
42
79
|
end
|
43
|
-
template.content_tag(
|
80
|
+
template.content_tag(
|
81
|
+
:span,
|
82
|
+
record_name,
|
83
|
+
class: 'formnestic-li-fieldset-for'
|
84
|
+
)
|
44
85
|
end
|
45
86
|
|
46
87
|
def formnestic_row_removing_content_tag(form_type)
|
47
88
|
contents = []
|
48
|
-
contents.push(
|
49
|
-
|
50
|
-
|
89
|
+
contents.push(
|
90
|
+
hidden_field(
|
91
|
+
:_destroy,
|
92
|
+
class: 'formnestic-destroy-input',
|
93
|
+
value: object.marked_for_destruction?
|
94
|
+
)
|
95
|
+
)
|
96
|
+
contents.push(
|
97
|
+
template.content_tag(
|
98
|
+
:div,
|
99
|
+
'',
|
100
|
+
title: I18n.t('formnestic.labels.remove_this_entry'),
|
101
|
+
class: "#{formnestic_row_removing_cell_div_class(form_type)} \
|
102
|
+
icon-cancel-circled",
|
103
|
+
onclick: formnestic_row_removing_cell_js_call(form_type)
|
104
|
+
)
|
105
|
+
)
|
106
|
+
template.content_tag(
|
107
|
+
form_type == :table ? :td : :div,
|
108
|
+
contents.join.html_safe,
|
109
|
+
class: formnestic_row_removing_cell_container_div_class(form_type)
|
110
|
+
)
|
51
111
|
end
|
52
112
|
|
53
113
|
def formnestic_prepare_html_options_for_wrapper(form_type, *args)
|
54
114
|
html_options = args.extract_options!
|
55
115
|
html_options[:name] = field_set_title_from_args(*args)
|
56
|
-
html_options[:class] = [
|
116
|
+
html_options[:class] = [
|
117
|
+
html_options[:class] || 'inputs',
|
118
|
+
formnestic_wrapper_class(form_type),
|
119
|
+
formnestic_row_class_based_on_position(
|
120
|
+
options[:parent_builder].rows_counter
|
121
|
+
)
|
122
|
+
].join(' ')
|
123
|
+
if object.marked_for_destruction?
|
124
|
+
html_options[:style] = [
|
125
|
+
html_options[:style],
|
126
|
+
'display: none'
|
127
|
+
].compact.join(';')
|
128
|
+
end
|
57
129
|
options[:parent_builder].increase_rows_counter
|
58
130
|
html_options
|
59
131
|
end
|
@@ -96,3 +168,4 @@ formnestic_row_removing_content_tag(:table) : '')].join.html_safe, html_options)
|
|
96
168
|
end
|
97
169
|
end
|
98
170
|
end
|
171
|
+
# rubocop:enable all
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formnestic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James
|
@@ -237,8 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
237
|
- !ruby/object:Gem::Version
|
238
238
|
version: '0'
|
239
239
|
requirements: []
|
240
|
-
|
241
|
-
rubygems_version: 2.7.6
|
240
|
+
rubygems_version: 3.0.3
|
242
241
|
signing_key:
|
243
242
|
specification_version: 3
|
244
243
|
summary: An extension of formtastic form builder gem
|