tramway-event 1.9.13 → 1.9.14
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: d2914e53cfd520f85ea7a3e43b76bfb3d298e386f5dc8a16129e8f9288ddc2f7
|
4
|
+
data.tar.gz: 606304cb054cdfd32344b2a2ab94210e561e8a7489326a5e9da67256c41b57e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b534c5d54d203c65beaab5cc4d12fabcf460ba14a880412ce13fc3de2de29d69e49d4496d060274f522a5b7c0230281ddb05e78bb3390786ee07dc76e1ce3c4d
|
7
|
+
data.tar.gz: 9ccc5d0a5344dba87bb93eff5c7b0ddfe11389d4c4db762b3ad6c5cf08d359a729b04904f2baa12f3b6ad2218c701161b449477d7ab51f2c51265a281c6ae08a
|
@@ -3,10 +3,28 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
|
|
3
3
|
def collections
|
4
4
|
[ :all ]
|
5
5
|
end
|
6
|
+
|
7
|
+
def show_attributes
|
8
|
+
[
|
9
|
+
:title,
|
10
|
+
:duration,
|
11
|
+
:state,
|
12
|
+
:created_at,
|
13
|
+
:photo,
|
14
|
+
:status,
|
15
|
+
:request_collecting_duration,
|
16
|
+
:description,
|
17
|
+
:participants_list
|
18
|
+
]
|
19
|
+
end
|
20
|
+
|
21
|
+
def list_attributes
|
22
|
+
[ :requested_participants, :approved_participants ]
|
23
|
+
end
|
6
24
|
end
|
7
25
|
|
8
26
|
delegate :title, to: :object
|
9
|
-
delegate :
|
27
|
+
delegate :status, to: :object
|
10
28
|
decorate_association :participants
|
11
29
|
decorate_association :participant_form_fields
|
12
30
|
decorate_association :sections
|
@@ -18,15 +36,57 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
|
|
18
36
|
object.photo
|
19
37
|
end
|
20
38
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
39
|
+
def description
|
40
|
+
raw object.description
|
41
|
+
end
|
42
|
+
|
43
|
+
def photo
|
44
|
+
image_view object.photo
|
45
|
+
end
|
46
|
+
|
47
|
+
def created_at
|
48
|
+
date_view object.created_at
|
49
|
+
end
|
50
|
+
|
51
|
+
def participants_list
|
52
|
+
content_tag :a, href: ::Tramway::Admin::Engine.routes.url_helpers.records_path(model: ::Tramway::Event::Participant, filter: { event_id_eq: object.id }) do
|
53
|
+
I18n.t('helpers.links.open')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def duration(begin_date: object.begin_date, end_date: object.end_date)
|
58
|
+
if begin_date.to_date == end_date.to_date
|
59
|
+
"#{I18n.l(begin_date, format: '%d %B %Y')}"
|
60
|
+
elsif begin_date.month == end_date.month
|
61
|
+
"#{I18n.t('date.from')} #{I18n.l(begin_date, format: '%d')} #{I18n.t('date.to')} #{I18n.l(end_date, format: '%d %B %Y')}"
|
26
62
|
else
|
27
|
-
"#{I18n.t('date.from')} #{I18n.l(
|
63
|
+
"#{I18n.t('date.from')} #{I18n.l(begin_date, format: '%d %B %Y')} #{I18n.t('date.to')} #{I18n.l(end_date, format: '%d %B %Y')}"
|
28
64
|
end
|
29
65
|
end
|
30
66
|
|
67
|
+
def request_collecting_duration
|
68
|
+
duration begin_date: object.request_collecting_begin_date, end_date: object.request_collecting_end_date
|
69
|
+
end
|
70
|
+
|
71
|
+
def requested_participants
|
72
|
+
object.participants.count
|
73
|
+
end
|
74
|
+
|
75
|
+
def approved_participants
|
76
|
+
if DateTime.now < object.end_date
|
77
|
+
I18n.t('activerecord.attributes.tramway/event/event.not_yet_held')
|
78
|
+
else
|
79
|
+
object.participants.approved.count
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def state
|
84
|
+
state_machine_view object, :state
|
85
|
+
end
|
86
|
+
|
87
|
+
def status
|
88
|
+
enumerize_view object.status
|
89
|
+
end
|
90
|
+
|
31
91
|
alias tagline duration
|
32
92
|
end
|
@@ -33,21 +33,33 @@ class Tramway::Event::ParticipantDecorator < ::Tramway::Core::ApplicationDecorat
|
|
33
33
|
end)
|
34
34
|
end)
|
35
35
|
object.event.participant_form_fields.map do |field|
|
36
|
-
hash = field.options.is_a?(Hash)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
hash = if field.options.is_a?(Hash)
|
37
|
+
field.options
|
38
|
+
else
|
39
|
+
begin
|
40
|
+
JSON.parse(field.options.present? ? field.options : '{}')
|
41
|
+
rescue => e
|
42
|
+
I18n.t('.invalid_field_with_error', e)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
if hash.is_a? Hash
|
46
|
+
if hash.dig('list_field') == 'true'
|
47
|
+
concat(content_tag(:tr) do
|
48
|
+
concat(content_tag(:td) do
|
49
|
+
field.title
|
50
|
+
end)
|
51
|
+
concat(content_tag(:td) do
|
52
|
+
value = object.values&.dig( field.title )
|
53
|
+
if russian_phone_number?(value)
|
54
|
+
tel_tag value
|
55
|
+
else
|
56
|
+
value
|
57
|
+
end
|
58
|
+
end)
|
41
59
|
end)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
tel_tag value
|
46
|
-
else
|
47
|
-
value
|
48
|
-
end
|
49
|
-
end)
|
50
|
-
end)
|
60
|
+
end
|
61
|
+
else
|
62
|
+
hash
|
51
63
|
end
|
52
64
|
end.compact
|
53
65
|
end
|
data/config/locales/models.yml
CHANGED
@@ -10,11 +10,20 @@ ru:
|
|
10
10
|
attributes:
|
11
11
|
tramway/event/event:
|
12
12
|
title: Название
|
13
|
+
name: Название
|
13
14
|
description: Описание
|
14
15
|
begin_date: Дата начала
|
15
16
|
end_date: Дата конца
|
16
17
|
request_collecting_begin_date: Дата начала приёма заявок на мероприятие
|
17
18
|
request_collecting_end_date: Дата окончания приёма заявок на мероприятие
|
19
|
+
request_collecting_duration: Продолжительность сбора заявок
|
20
|
+
status: Статус на сайте
|
21
|
+
photo: Фоновое изображение
|
22
|
+
duration: Продолжительность
|
23
|
+
requested_participants: Количество заявившихся
|
24
|
+
approved_participants: Количество пришедших
|
25
|
+
not_yet_held: мероприятие ещё не проведено
|
26
|
+
participants_list: Список участников
|
18
27
|
tramway/event/participant:
|
19
28
|
comment: Примечание
|
20
29
|
event: Мероприятие
|
@@ -55,4 +64,8 @@ ru:
|
|
55
64
|
approved: Окончательно подтверждены
|
56
65
|
without_answer: Не ответили
|
57
66
|
reserved: В резерве
|
58
|
-
|
67
|
+
enumerize:
|
68
|
+
tramway/event/event:
|
69
|
+
status:
|
70
|
+
main: На главной странице
|
71
|
+
common: Не на главной странице
|
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.9.
|
4
|
+
version: 1.9.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rails engine for events
|
14
14
|
email:
|