asbru 0.0.14 → 0.0.16
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/lib/asbru/form_builder.rb +31 -6
- data/lib/asbru/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1e59ef0d7603903d9130fb26f9acc5a259952269b809107185fa3e9881fe50c
|
4
|
+
data.tar.gz: 7425e9dfcbbc67bf3244caa1f3ca54d13a42e4a979095086ad2aa0de5b9bd49a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8ab96f575317dc637da675b91d01dc25aaf39b8bb9d7b10b4dc04e62e8f5bd642facc98c484a289e248ff4727eed00fd777874bec86a604ab047748d39a3fd1
|
7
|
+
data.tar.gz: fb4fa46f0ceb53590f6229439bc9b8f55e9c51c13eaf496e8853cabddb85d03907a3d37efac6ef46af7a9397cd3ad4be26fe2153fa408f19963a8499c909ae52
|
data/lib/asbru/form_builder.rb
CHANGED
@@ -27,7 +27,6 @@ module Asbru
|
|
27
27
|
end
|
28
28
|
|
29
29
|
BASIC_FORM_FIELDS = [
|
30
|
-
{ submit: { text: 'Submit', type: 'submit' } },
|
31
30
|
{ date_field: { type: 'datepicker' } },
|
32
31
|
{ password_field: { type: 'password' } },
|
33
32
|
{ text_area: { type: 'textarea' } },
|
@@ -97,7 +96,14 @@ module Asbru
|
|
97
96
|
multiple = false)
|
98
97
|
collection.map do |item|
|
99
98
|
{
|
100
|
-
label:
|
99
|
+
label: if options[:translate_options]
|
100
|
+
I18n.t(
|
101
|
+
item.send(text_method),
|
102
|
+
scope: "activerecord.attributes.#{@object.class.name.downcase}.#{attribute}_options"
|
103
|
+
)
|
104
|
+
else
|
105
|
+
item.send(text_method)
|
106
|
+
end,
|
101
107
|
value: item.send(value_method),
|
102
108
|
name: options[:name] || tag_name_for(attribute, multiple),
|
103
109
|
checked: if @object.nil?
|
@@ -114,10 +120,29 @@ module Asbru
|
|
114
120
|
end
|
115
121
|
end
|
116
122
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
123
|
+
def submit(attribute = nil,
|
124
|
+
text: 'Submit',
|
125
|
+
type: 'submit',
|
126
|
+
**options)
|
127
|
+
options[:text] = text
|
128
|
+
options[:type] = type
|
129
|
+
options[:customData] = {} if options[:customData].nil?
|
130
|
+
|
131
|
+
if options.dig(:customData, :'data-disable').nil?
|
132
|
+
Rails.application
|
133
|
+
.config.action_view
|
134
|
+
.automatically_disable_submit_tag
|
135
|
+
.tap do |disable|
|
136
|
+
if disable == false
|
137
|
+
options[:customData][:'data-disable'] = false
|
138
|
+
else
|
139
|
+
options[:customData][:'data-disable'] = true
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
render_form_element attribute, options
|
145
|
+
end
|
121
146
|
|
122
147
|
# def date_field(attribute = nil, options = {})
|
123
148
|
# render_form_element attribute,
|
data/lib/asbru/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asbru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stev-0
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|