asbru 0.0.14 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd4c1c21cfc657365e3104fd7b9eb887d9c6345338fa9e36d0e96f9eacce0b56
4
- data.tar.gz: d8af286deb359f0faf17874965bba84f7b611b2d36232996ecafd1a84e204f58
3
+ metadata.gz: f1e59ef0d7603903d9130fb26f9acc5a259952269b809107185fa3e9881fe50c
4
+ data.tar.gz: 7425e9dfcbbc67bf3244caa1f3ca54d13a42e4a979095086ad2aa0de5b9bd49a
5
5
  SHA512:
6
- metadata.gz: 2cd056d9f3b78fd898029be1442b8fba37f83b299879005b82ddd4c258465e7dcd4f8fa34da827182ab0723919afaab0708563ee2b31dce5dbffdb22800719ed
7
- data.tar.gz: b5f9e669395c09a13dea89ac12065a810b88ab6cdc22e58560d89fe668fc619cf347c142c58c605b91258eeb65536f6aac43bb2461aa6153346d328e830338ac
6
+ metadata.gz: a8ab96f575317dc637da675b91d01dc25aaf39b8bb9d7b10b4dc04e62e8f5bd642facc98c484a289e248ff4727eed00fd777874bec86a604ab047748d39a3fd1
7
+ data.tar.gz: fb4fa46f0ceb53590f6229439bc9b8f55e9c51c13eaf496e8853cabddb85d03907a3d37efac6ef46af7a9397cd3ad4be26fe2153fa408f19963a8499c909ae52
@@ -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: item.send(text_method),
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
- # def submit(attribute = nil, options = {})
118
- # render_form_element attribute,
119
- # options.reverse_merge(text: 'Submit', type: 'submit')
120
- # end
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
@@ -1,3 +1,3 @@
1
1
  module Asbru
2
- VERSION = '0.0.14'
2
+ VERSION = '0.0.16'
3
3
  end
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.14
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-06-21 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails