tramway-event 1.11.1 → 1.11.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee9b98770fa7546d0b7c49c02f766217b562830ec0e1d53f6d21b13277ca3ed0
|
4
|
+
data.tar.gz: 542630d73692b2d556707204eb618b439af46b49c385161bbb84170d8b6ffc7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4d0e94e345e70cb67c92d63f2ee48822afecf082b536c95bca865c620ed5bd9aabb7dbf699c251613869e1350dda4e0da9d45b98bdac73dd3d3309d91019bbb
|
7
|
+
data.tar.gz: daae540aefa2f8dfa0a4b387137c6746f63d47949286577b908d3f05aff8569b46e1e3fc40131f96ef1f77935f095b70478a7aea63a27e759109bcb6f467ed14
|
@@ -6,7 +6,7 @@ class Tramway::Event::ParticipantExtendedFormCreator < Tramway::Core::FormCreato
|
|
6
6
|
properties = event.participant_form_fields.inputs_list.reduce({}) do |hash, field|
|
7
7
|
hash.merge! field.title.to_sym => {
|
8
8
|
object: field,
|
9
|
-
validates: (field
|
9
|
+
validates: build_validations(field)
|
10
10
|
}
|
11
11
|
end
|
12
12
|
if simple_properties.keys.any?
|
@@ -15,4 +15,13 @@ class Tramway::Event::ParticipantExtendedFormCreator < Tramway::Core::FormCreato
|
|
15
15
|
::Tramway::Core::ExtendableForm.new(class_name, **properties)
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
def self.build_validations(field)
|
20
|
+
case field.field_type
|
21
|
+
when 'checkbox'
|
22
|
+
field.validations.except('presence').deep_merge! inclusion: { in: [ 'true' ] }
|
23
|
+
else
|
24
|
+
field.validations
|
25
|
+
end
|
26
|
+
end
|
18
27
|
end
|
@@ -3,11 +3,15 @@
|
|
3
3
|
class Tramway::Event::ParticipantFormField < ::Tramway::Event::ApplicationRecord
|
4
4
|
belongs_to :event, class_name: 'Tramway::Event::Event'
|
5
5
|
|
6
|
-
enumerize :field_type, in: %i[text string numeric date_picker select], default: :text
|
6
|
+
enumerize :field_type, in: %i[text string numeric date_picker select checkbox], default: :text
|
7
7
|
|
8
8
|
scope :inputs_list, -> { active.order(position: :asc) }
|
9
9
|
|
10
10
|
def required
|
11
11
|
options.present? && options.dig('validations', 'presence') == 'true'
|
12
12
|
end
|
13
|
+
|
14
|
+
def validations
|
15
|
+
(options == '' ? {} : options)&.dig('validations')
|
16
|
+
end
|
13
17
|
end
|
data/config/locales/models.yml
CHANGED
@@ -90,6 +90,7 @@ ru:
|
|
90
90
|
attributes:
|
91
91
|
default:
|
92
92
|
presence: не может быть пустым
|
93
|
+
inclusion: этот пункт должен быть отмечен
|
93
94
|
cases:
|
94
95
|
tramway/event/event:
|
95
96
|
plural: мероприятия
|
@@ -136,3 +137,4 @@ ru:
|
|
136
137
|
numeric: Число
|
137
138
|
date_picker: Дата
|
138
139
|
select: Выпадающий список (да/нет)
|
140
|
+
checkbox: Галочка
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: configus
|