tramway-event 1.9.29 → 1.9.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/app/forms/admin/tramway/event/participant_form_field_form.rb +7 -1
- data/config/locales/models.yml +7 -0
- data/lib/tramway/event/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccbba9d4e213e01b03e1d8b447d3ecc7c999dc13e32b5902c76bc1a6422bba39
|
4
|
+
data.tar.gz: 1ac5580d257ffa32f36ca9bab2e28ac85fa9ae5a0c29bfaef4d8bc163b6a1ca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73bd1a360e798f16ed21c4708fcb411b3a207a2e67fb220a0ec234ce7f317b8966f40ec2a12bbb5a3858f975f443217d2e80d867e2d2b6c835a54548c2d0f20a
|
7
|
+
data.tar.gz: 1d7e7c7a06dbd0fd4a0531d7eb959619591a6bd5213fa22a171eb922393cfa2e8aa34528b8a4882957ca89146edf66aa0ea70126b2646ba1a5032ea09a245a80
|
data/README.md
CHANGED
@@ -12,6 +12,7 @@ How to use my plugin.
|
|
12
12
|
gem 'tramway-event'
|
13
13
|
gem 'carrierwave'
|
14
14
|
gem 'more_html_tags'
|
15
|
+
gem 'configus'
|
15
16
|
```
|
16
17
|
|
17
18
|
#### 2. And then execute:
|
@@ -48,6 +49,21 @@ Tramway::Admin.set_available_models ::Tramway::Event::Event, ::Tramway::Event::P
|
|
48
49
|
mount Tramway::Event::Engine, at: '/'
|
49
50
|
```
|
50
51
|
|
52
|
+
#### 7. Add hosts in your environments via gem `configus`. [What is configus?](https://github.com/kaize/configus)
|
53
|
+
|
54
|
+
*config/configus.rb*
|
55
|
+
```ruby
|
56
|
+
Configus.build Rails.env do
|
57
|
+
env :production do
|
58
|
+
host 'https://your-site-domain.com'
|
59
|
+
end
|
60
|
+
env :development do
|
61
|
+
host 'http://localhost:3000'
|
62
|
+
end
|
63
|
+
env :test, parent: :development
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
51
67
|
## How-to
|
52
68
|
|
53
69
|
### Create event
|
@@ -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
|
4
|
+
properties :title, :description, :field_type, :options, :position, :list_field, :presence_field
|
5
5
|
association :event
|
6
6
|
|
7
7
|
def initialize(object)
|
@@ -12,6 +12,7 @@ class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::Extende
|
|
12
12
|
field_type: :default,
|
13
13
|
options: :text,
|
14
14
|
list_field: :boolean,
|
15
|
+
presence_field: :boolean,
|
15
16
|
position: :numeric
|
16
17
|
end
|
17
18
|
end
|
@@ -20,6 +21,7 @@ class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::Extende
|
|
20
21
|
super(params).tap do
|
21
22
|
model.options = {} if model.options == ''
|
22
23
|
model.options&.merge! list_field: (params[:list_field] == '1').to_s
|
24
|
+
model.options&.deep_merge! validations: { presence: (params[:presence_field] == '1').to_s }
|
23
25
|
model.save
|
24
26
|
end
|
25
27
|
end
|
@@ -28,6 +30,10 @@ class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::Extende
|
|
28
30
|
model.options&.dig('list_field') == 'true'
|
29
31
|
end
|
30
32
|
|
33
|
+
def presence_field
|
34
|
+
model.options&.dig('validations', 'presence') == 'true'
|
35
|
+
end
|
36
|
+
|
31
37
|
def options
|
32
38
|
model.options&.to_json
|
33
39
|
end
|
data/config/locales/models.yml
CHANGED
@@ -69,10 +69,17 @@ ru:
|
|
69
69
|
options: Параметры (не редактировать без надобности)
|
70
70
|
title: Название (в Tramway название Поля анкеты - это ключ для выборки пользователей. Если вы измените ключ к выборке пользователей, то все пользователи, получившие данные по предыдущему ключу по этой выборке показываться не будут)
|
71
71
|
list_field: Показывать это поле в общем списке участников?
|
72
|
+
presence_field: Обязательное поле
|
72
73
|
tramway/event/partaking:
|
73
74
|
part_name: Мероприятие
|
74
75
|
event_duration: Дата мероприятия
|
75
76
|
part_description: Описание
|
77
|
+
errors:
|
78
|
+
models:
|
79
|
+
tramway/event/participant:
|
80
|
+
attributes:
|
81
|
+
default:
|
82
|
+
presence: не может быть пустым
|
76
83
|
cases:
|
77
84
|
tramway/event/event:
|
78
85
|
plural: мероприятия
|