tramway-event 1.12.2 → 1.12.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 130a891dad032f778f01bfd28ca0cb61b48b55d6fc28d57b35a3f019f759d747
4
- data.tar.gz: 374010438e4851f53e2248314565bea7d5e12740e91161a3d8dc84821b86417e
3
+ metadata.gz: 4c529a4a5e6d2219d91443ae1780dc190909dac7e620eb10f014ea706a72d862
4
+ data.tar.gz: 451ead0b0517c8dec41562ce6b727dea3f7350b49ea1e41fe2cb8f859e86bcf1
5
5
  SHA512:
6
- metadata.gz: e6354bfccd5a717af7bb82cd3082407334f133dac23384d25fbbb20fbac2471b3febbe02e4ba866bc38e42647afbc9367917c0589fed0fab804607258f642994
7
- data.tar.gz: dc45b8e48ae39e6f0a384dc7a72e61263fa231d7da61d08211ac669d7d68b8b447ec5f57affadd3d263308467b216fbcc71ea3110490edcd357541f9bc5524cf
6
+ metadata.gz: 5cbcbc4960148c90ac9a4aca8875e6cfc21bfa6df05890224d335a1bcebdaad71a1e6e138aab746575a3231e39d5b9e3f37c2f19e24a3a1448074184c5761c9f
7
+ data.tar.gz: 5a855610a0db0d145191519881e02bbfa73159336906869148a479f755718738979262d794961c3be59b522b0248043f27bfc8ffe619ec83052efb5bbdceee81
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::ExtendedApplicationForm
4
- properties :title, :description, :field_type, :options, :position, :list_field, :presence_field
4
+ properties :title, :description, :field_type, :options, :position, :list_field, :presence_field, :select_options
5
5
  association :event
6
6
 
7
7
  def initialize(object)
@@ -13,7 +13,13 @@ class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::Extende
13
13
  options: :text,
14
14
  list_field: :boolean,
15
15
  presence_field: :boolean,
16
- position: :numeric
16
+ position: :numeric,
17
+ select_options: {
18
+ type: :string,
19
+ input_options: {
20
+ hint: I18n.t('hints.tramway.event.participant_form_field.select_options')
21
+ }
22
+ }
17
23
  end
18
24
  end
19
25
 
@@ -21,6 +27,7 @@ class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::Extende
21
27
  super(params).tap do
22
28
  model.options = {} if model.options == ''
23
29
  model.options&.merge! list_field: (params[:list_field] == '1').to_s
30
+ model.options&.deep_merge! collection: { array: params[:select_options].split(',') || [] }
24
31
  model.options&.deep_merge! validations: { presence: (params[:presence_field] == '1').to_s }
25
32
  model.save
26
33
  end
@@ -34,6 +41,10 @@ class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::Extende
34
41
  model.options.present? && model.options.dig('validations', 'presence') == 'true'
35
42
  end
36
43
 
44
+ def select_options
45
+ model.options.present? && model.options.dig('collection', 'array')&.join(',')
46
+ end
47
+
37
48
  def options
38
49
  model.options&.to_json
39
50
  end
@@ -71,6 +71,7 @@ ru:
71
71
  title: Название (в Tramway название Поля анкеты - это ключ для выборки пользователей. Если вы измените ключ к выборке пользователей, то все пользователи, получившие данные по предыдущему ключу по этой выборке показываться не будут)
72
72
  list_field: Показывать это поле в общем списке участников?
73
73
  presence_field: Обязательное поле
74
+ select_options: Опции выпадающего списка
74
75
  tramway/event/partaking:
75
76
  part_name: Мероприятие
76
77
  event_duration: Дата мероприятия
@@ -0,0 +1,6 @@
1
+ ru:
2
+ hints:
3
+ tramway:
4
+ event:
5
+ participant_form_field:
6
+ select_options: "в случае выбора тип поля \"Выпадающий список\", введите через запятую без пробелов все элементы списка"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Event
5
- VERSION = '1.12.2'
5
+ VERSION = '1.12.3'
6
6
  end
7
7
  end
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.12.2
4
+ version: 1.12.3
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-04-04 00:00:00.000000000 Z
11
+ date: 2020-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: configus
@@ -83,6 +83,7 @@ files:
83
83
  - config/initializers/assets.rb
84
84
  - config/initializers/tramway.rb
85
85
  - config/locales/models.yml
86
+ - config/locales/ru.forms.yml
86
87
  - config/locales/ru.yml
87
88
  - config/locales/state_machines.yml
88
89
  - config/routes.rb