tramway-event 1.9.19.1 → 1.9.19.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -3
- data/Rakefile +3 -5
- data/app/assets/stylesheets/tramway/event/events/show.css.sass +1 -1
- data/app/controllers/tramway/event/application_controller.rb +2 -0
- data/app/controllers/tramway/event/events_controller.rb +2 -0
- data/app/controllers/tramway/event/participants_controller.rb +2 -0
- data/app/decorators/tramway/event/event_decorator.rb +23 -16
- data/app/decorators/tramway/event/event_link_decorator.rb +2 -0
- data/app/decorators/tramway/event/events/show/event_decorator.rb +14 -8
- data/app/decorators/tramway/event/partaking_decorator.rb +5 -3
- data/app/decorators/tramway/event/partaking_feature_decorator.rb +2 -0
- data/app/decorators/tramway/event/participant_decorator.rb +7 -5
- data/app/decorators/tramway/event/participant_form_field_decorator.rb +3 -1
- data/app/decorators/tramway/event/participant_xlsx_decorator.rb +3 -1
- data/app/decorators/tramway/event/person_decorator.rb +3 -1
- data/app/decorators/tramway/event/place_decorator.rb +2 -0
- data/app/decorators/tramway/event/section_decorator.rb +3 -1
- data/app/decorators/tramway/event/section_feature_decorator.rb +3 -1
- data/app/forms/tramway/event/event_form.rb +9 -7
- data/app/forms/tramway/event/partaking_form.rb +4 -2
- data/app/forms/tramway/event/participant_extended_form_creator.rb +2 -0
- data/app/forms/tramway/event/participant_form.rb +2 -0
- data/app/forms/tramway/event/participant_form_field_form.rb +2 -0
- data/app/forms/tramway/event/person_form.rb +5 -3
- data/app/forms/tramway/event/place_form.rb +6 -4
- data/app/forms/tramway/event/section_form.rb +3 -1
- data/app/helpers/tramway/event/application_helper.rb +3 -1
- data/app/jobs/tramway/event/application_job.rb +2 -0
- data/app/mailers/tramway/event/application_mailer.rb +2 -0
- data/app/models/tramway/event/application_record.rb +2 -0
- data/app/models/tramway/event/event.rb +7 -3
- data/app/models/tramway/event/partaking.rb +4 -2
- data/app/models/tramway/event/participant.rb +9 -7
- data/app/models/tramway/event/participant_form_field.rb +3 -1
- data/app/models/tramway/event/person.rb +2 -2
- data/app/models/tramway/event/place.rb +2 -0
- data/app/models/tramway/event/section.rb +2 -0
- data/config/initializers/assets.rb +3 -1
- data/config/initializers/tramway.rb +9 -7
- data/config/locales/models.yml +1 -0
- data/config/routes.rb +2 -0
- data/lib/tasks/tramway/event_tasks.rake +2 -0
- data/lib/tramway/event.rb +3 -1
- data/lib/tramway/event/engine.rb +2 -0
- data/lib/tramway/event/generators/install_generator.rb +4 -2
- data/lib/tramway/event/generators/templates/add_description_to_tramway_event_people.rb +2 -0
- data/lib/tramway/event/generators/templates/add_icon_to_tramway_event_sections.rb +2 -0
- data/lib/tramway/event/generators/templates/add_more_fields_to_tramway_event_participants.rb +2 -0
- data/lib/tramway/event/generators/templates/add_options_to_tramway_event_participant_form_fields.rb +2 -0
- data/lib/tramway/event/generators/templates/add_photo_to_tramway_event_events.rb +2 -0
- data/lib/tramway/event/generators/templates/add_position_to_tramway_event_partakings.rb +2 -0
- data/lib/tramway/event/generators/templates/add_position_to_tramway_event_participant_form_fields.rb +2 -0
- data/lib/tramway/event/generators/templates/add_position_to_tramway_event_sections.rb +2 -0
- data/lib/tramway/event/generators/templates/add_request_period_to_tramway_event_events.rb +2 -0
- data/lib/tramway/event/generators/templates/add_state_to_tramway_event_partakings.rb +2 -0
- data/lib/tramway/event/generators/templates/add_status_to_tramway_event_events.rb +2 -0
- data/lib/tramway/event/generators/templates/create_tramway_event_events.rb +2 -0
- data/lib/tramway/event/generators/templates/create_tramway_event_events_places.rb +2 -0
- data/lib/tramway/event/generators/templates/create_tramway_event_participant_form_fields.rb +2 -0
- data/lib/tramway/event/generators/templates/create_tramway_event_participants.rb +2 -0
- data/lib/tramway/event/generators/templates/create_tramway_event_people.rb +2 -0
- data/lib/tramway/event/generators/templates/create_tramway_event_people_sections.rb +2 -0
- data/lib/tramway/event/generators/templates/create_tramway_event_places.rb +2 -0
- data/lib/tramway/event/generators/templates/create_tramway_event_sections.rb +2 -0
- data/lib/tramway/event/generators/templates/rebuild_association_between_participant_and_partakings_to_polymorphic.rb +2 -0
- data/lib/tramway/event/generators/templates/rename_tramway_event_people_sections_to_tramway_event_partakings.rb +2 -0
- data/lib/tramway/event/version.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30ef78204cd4ee382b3d6fe1f2ea0aee9a6a73dfa20763b7d7315b035dd66840
|
4
|
+
data.tar.gz: 0f809850f6a465cc37bd40aea40ead15e884c5c6cbb1d0bc0c0010859bcce088
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e79568865d3c6cf054cde85248c3807da326d38fb64b1ca8428276bec75dc3f68821fac6dc8e9a07529caa36f5aa35f2662ec57ac591c33bbffd3278bf46d645
|
7
|
+
data.tar.gz: 3f19ed519d3052c77806f16412ca89400b12db5285d496bb23d0b9ae7cd642ac2fc492b0b07139fd91f1b17804b5342e0110ae093ad438a9d5130609538387cd
|
data/README.md
CHANGED
@@ -9,16 +9,30 @@ Add this line to your application's Gemfile:
|
|
9
9
|
|
10
10
|
```ruby
|
11
11
|
gem 'tramway-event'
|
12
|
+
gem 'carrierwave'
|
13
|
+
gem 'more_html_tags'
|
12
14
|
```
|
13
15
|
|
14
16
|
And then execute:
|
15
17
|
```bash
|
16
18
|
$ bundle
|
17
19
|
```
|
20
|
+
*Gemfile*
|
21
|
+
```ruby
|
22
|
+
gem 'tramway-event'
|
23
|
+
```
|
18
24
|
|
19
|
-
|
20
|
-
```
|
21
|
-
|
25
|
+
Then run:
|
26
|
+
```shell
|
27
|
+
rails g tramway:event:install
|
28
|
+
rails db:migrate
|
29
|
+
```
|
30
|
+
|
31
|
+
Then make `tramway-landing` installation. [How-to](https://github.com/ulmic/tramway-dev/blob/develop/tramway-landing/README.md#installation)
|
32
|
+
|
33
|
+
*config/initializers/tramway.rb*
|
34
|
+
```ruby
|
35
|
+
Tramway::Admin.set_available_models ::Tramway::Event::Event, ::Tramway::Event::ParticipantFormField, ::Tramway::Event::Participant, project: #{project_which_you_used_in_the_application}
|
22
36
|
```
|
23
37
|
|
24
38
|
## Contributing
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
4
|
require 'bundler/setup'
|
3
5
|
rescue LoadError
|
@@ -14,14 +16,11 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
16
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
17
|
end
|
16
18
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
19
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
18
20
|
load 'rails/tasks/engine.rake'
|
19
21
|
|
20
|
-
|
21
22
|
load 'rails/tasks/statistics.rake'
|
22
23
|
|
23
|
-
|
24
|
-
|
25
24
|
require 'bundler/gem_tasks'
|
26
25
|
|
27
26
|
require 'rake/testtask'
|
@@ -32,5 +31,4 @@ Rake::TestTask.new(:test) do |t|
|
|
32
31
|
t.verbose = false
|
33
32
|
end
|
34
33
|
|
35
|
-
|
36
34
|
task default: :test
|
@@ -1,25 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
|
2
4
|
class << self
|
3
5
|
def collections
|
4
|
-
[
|
6
|
+
[:all]
|
5
7
|
end
|
6
8
|
|
7
9
|
def show_attributes
|
8
|
-
[
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
%i[
|
11
|
+
title
|
12
|
+
duration
|
13
|
+
state
|
14
|
+
created_at
|
15
|
+
photo
|
16
|
+
status
|
17
|
+
request_collecting_duration
|
18
|
+
description
|
19
|
+
participants_list
|
18
20
|
]
|
19
21
|
end
|
20
22
|
|
21
23
|
def list_attributes
|
22
|
-
[
|
24
|
+
%i[requested_participants approved_participants]
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
@@ -56,7 +58,7 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
|
|
56
58
|
|
57
59
|
def duration(begin_date: object.begin_date, end_date: object.end_date)
|
58
60
|
if begin_date.to_date == end_date.to_date
|
59
|
-
|
61
|
+
I18n.l(begin_date, format: '%d %B %Y').to_s
|
60
62
|
elsif begin_date.month == end_date.month
|
61
63
|
"#{I18n.t('date.from')} #{I18n.l(begin_date, format: '%d')} #{I18n.t('date.to')} #{I18n.l(end_date, format: '%d %B %Y')}"
|
62
64
|
else
|
@@ -65,6 +67,7 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
|
|
65
67
|
end
|
66
68
|
|
67
69
|
def request_collecting_duration
|
70
|
+
return if object.request_collecting_begin_date.nil? || object.request_collecting_end_date.nil?
|
68
71
|
duration begin_date: object.request_collecting_begin_date, end_date: object.request_collecting_end_date
|
69
72
|
end
|
70
73
|
|
@@ -73,10 +76,14 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
|
|
73
76
|
end
|
74
77
|
|
75
78
|
def approved_participants
|
76
|
-
if
|
77
|
-
|
79
|
+
if object.end_date.present?
|
80
|
+
if DateTime.now < object.end_date
|
81
|
+
I18n.t('activerecord.attributes.tramway/event/event.not_yet_held')
|
82
|
+
else
|
83
|
+
object.participants.approved.count
|
84
|
+
end
|
78
85
|
else
|
79
|
-
|
86
|
+
I18n.t('activerecord.attributes.tramway/event/event.does_not_have_end_date')
|
80
87
|
end
|
81
88
|
end
|
82
89
|
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::Events::Show::EventDecorator < ::Tramway::Core::ApplicationDecorator
|
2
4
|
class << self
|
3
5
|
def collections
|
4
|
-
[
|
6
|
+
[:all]
|
5
7
|
end
|
6
8
|
end
|
7
9
|
|
@@ -12,8 +14,10 @@ class Tramway::Event::Events::Show::EventDecorator < ::Tramway::Core::Applicatio
|
|
12
14
|
delegate :partakings, to: :object
|
13
15
|
delegate :request_collecting_state, to: :object
|
14
16
|
|
15
|
-
::Tramway::Partner
|
16
|
-
|
17
|
+
if defined?(::Tramway::Partner)
|
18
|
+
::Tramway::Partner::Partnership.partnership_type.values.each do |partnership_type|
|
19
|
+
decorate_association partnership_type.to_s.pluralize
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
23
|
def background
|
@@ -22,7 +26,7 @@ class Tramway::Event::Events::Show::EventDecorator < ::Tramway::Core::Applicatio
|
|
22
26
|
|
23
27
|
def duration
|
24
28
|
if object.begin_date.to_date == object.end_date.to_date
|
25
|
-
|
29
|
+
I18n.l(object.begin_date, format: '%d %B %Y').to_s
|
26
30
|
elsif object.begin_date.month == object.end_date.month
|
27
31
|
"#{I18n.t('date.from')} #{I18n.l(object.begin_date, format: '%d')} #{I18n.t('date.to')} #{I18n.l(object.end_date, format: '%d %B %Y')}"
|
28
32
|
else
|
@@ -31,10 +35,12 @@ class Tramway::Event::Events::Show::EventDecorator < ::Tramway::Core::Applicatio
|
|
31
35
|
end
|
32
36
|
|
33
37
|
def partners
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
+
if defined?(::Tramway::Partner)
|
39
|
+
@partners ||= ::Tramway::Partner::Partnership.partnership_type.values.reduce({}) do |hash, partnership_type|
|
40
|
+
hash.merge! partnership_type => (object.send(partnership_type.to_s.pluralize).active.map do |partner|
|
41
|
+
Tramway::Partner::OrganizationFeatureDecorator.decorate partner
|
42
|
+
end)
|
43
|
+
end
|
38
44
|
end
|
39
45
|
end
|
40
46
|
|
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::PartakingDecorator < ::Tramway::Core::ApplicationDecorator
|
2
4
|
class << self
|
3
5
|
def collections
|
4
|
-
[
|
6
|
+
[:all]
|
5
7
|
end
|
6
8
|
|
7
9
|
def show_attributes
|
8
|
-
[
|
10
|
+
%i[part_name event_duration part_description]
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
@@ -14,7 +16,7 @@ class Tramway::Event::PartakingDecorator < ::Tramway::Core::ApplicationDecorator
|
|
14
16
|
def name
|
15
17
|
"#{object.person.first_name} #{object.person.last_name} - #{object.position}"
|
16
18
|
end
|
17
|
-
|
19
|
+
|
18
20
|
def part_name
|
19
21
|
part.name
|
20
22
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::ParticipantDecorator < ::Tramway::Core::ApplicationDecorator
|
2
4
|
include HTMLTagsHelpers
|
3
5
|
class << self
|
4
6
|
def collections
|
5
|
-
[
|
7
|
+
%i[requested waiting prev_approved without_answer approved rejected reserved all]
|
6
8
|
end
|
7
9
|
|
8
10
|
def list_attributes
|
@@ -34,11 +36,11 @@ class Tramway::Event::ParticipantDecorator < ::Tramway::Core::ApplicationDecorat
|
|
34
36
|
end)
|
35
37
|
object.event.participant_form_fields.map do |field|
|
36
38
|
hash = if field.options.is_a?(Hash)
|
37
|
-
field.options
|
39
|
+
field.options
|
38
40
|
else
|
39
41
|
begin
|
40
42
|
JSON.parse(field.options.present? ? field.options : '{}')
|
41
|
-
rescue => e
|
43
|
+
rescue StandardError => e
|
42
44
|
I18n.t('.invalid_field_with_error', e)
|
43
45
|
end
|
44
46
|
end
|
@@ -49,7 +51,7 @@ class Tramway::Event::ParticipantDecorator < ::Tramway::Core::ApplicationDecorat
|
|
49
51
|
field.title
|
50
52
|
end)
|
51
53
|
concat(content_tag(:td) do
|
52
|
-
value = object.values&.dig(
|
54
|
+
value = object.values&.dig(field.title)
|
53
55
|
if russian_phone_number?(value)
|
54
56
|
tel_tag value
|
55
57
|
else
|
@@ -74,7 +76,7 @@ class Tramway::Event::ParticipantDecorator < ::Tramway::Core::ApplicationDecorat
|
|
74
76
|
end)
|
75
77
|
concat(content_tag(:td) do
|
76
78
|
concat(if russian_phone_number?(value)
|
77
|
-
|
79
|
+
tel_tag value
|
78
80
|
else
|
79
81
|
value
|
80
82
|
end)
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::ParticipantXlsxDecorator < Tramway::Export::Xlsx::ApplicationDecorator
|
2
4
|
class << self
|
3
5
|
def columns
|
4
|
-
[
|
6
|
+
%i[full_name email phone organization event].map do |attribute|
|
5
7
|
{ Tramway::Event::Participant.human_attribute_name(attribute).to_sym => attribute }
|
6
8
|
end
|
7
9
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class ::Tramway::Event::SectionFeatureDecorator < ::Tramway::Landing::BlockTypes::FeaturesDecorator
|
2
4
|
delegate :icon, to: :object
|
3
5
|
delegate :title, to: :object
|
4
6
|
delegate :description, to: :object
|
5
7
|
|
6
8
|
def text
|
7
|
-
object.description.scan(
|
9
|
+
object.description.scan(%r{<strong>.*?</strong>}).join(' ')
|
8
10
|
end
|
9
11
|
|
10
12
|
def image
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::EventForm < ::Tramway::Core::ApplicationForm
|
2
4
|
properties :title, :description, :begin_date, :end_date, :photo, :status,
|
3
5
|
:request_collecting_begin_date, :request_collecting_end_date
|
@@ -5,13 +7,13 @@ class Tramway::Event::EventForm < ::Tramway::Core::ApplicationForm
|
|
5
7
|
def initialize(object)
|
6
8
|
super(object).tap do
|
7
9
|
form_properties title: :string,
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
description: :ckeditor,
|
11
|
+
begin_date: :date_picker,
|
12
|
+
end_date: :date_picker,
|
13
|
+
request_collecting_begin_date: :date_picker,
|
14
|
+
request_collecting_end_date: :date_picker,
|
15
|
+
photo: :file,
|
16
|
+
status: :default
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::PartakingForm < ::Tramway::Core::ApplicationForm
|
2
4
|
properties :part_id, :part_type, :person_id, :position
|
3
5
|
associations :person, :part
|
@@ -5,8 +7,8 @@ class Tramway::Event::PartakingForm < ::Tramway::Core::ApplicationForm
|
|
5
7
|
def initialize(object)
|
6
8
|
super(object).tap do
|
7
9
|
form_properties part: :polymorphic_association,
|
8
|
-
|
9
|
-
|
10
|
+
person: :association,
|
11
|
+
position: :string
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::PersonForm < ::Tramway::Core::ApplicationForm
|
2
4
|
properties :first_name, :last_name, :photo, :description
|
3
5
|
|
4
6
|
def initialize(object)
|
5
7
|
super(object).tap do
|
6
8
|
form_properties first_name: :string,
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
last_name: :string,
|
10
|
+
photo: :file,
|
11
|
+
description: :ckeditor
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::PlaceForm < Tramway::Core::ApplicationForm
|
2
4
|
properties :title, :description, :coordinates, :photo, :city
|
3
5
|
|
4
6
|
def initialize(object)
|
5
7
|
super(object).tap do
|
6
8
|
form_properties title: :string,
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
description: :ckeditor,
|
10
|
+
coordinates: :string,
|
11
|
+
photo: :file,
|
12
|
+
city: :string
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::SectionForm < ::Tramway::Core::ApplicationForm
|
2
4
|
properties :event, :title, :description, :photo, :icon, :position
|
3
5
|
association :event
|
@@ -10,6 +12,6 @@ class Tramway::Event::SectionForm < ::Tramway::Core::ApplicationForm
|
|
10
12
|
photo: :file,
|
11
13
|
icon: :string,
|
12
14
|
position: :numeric
|
13
|
-
end
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
|
2
4
|
mount_uploader :photo, PhotoUploader
|
3
5
|
|
@@ -9,12 +11,12 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
|
|
9
11
|
has_many :organizations, as: :partners, through: :partnerships, class_name: 'Tramway::Partner::Organization'
|
10
12
|
has_and_belongs_to_many :places
|
11
13
|
|
12
|
-
enumerize :status, default: :common, in: [
|
14
|
+
enumerize :status, default: :common, in: %i[common main]
|
13
15
|
|
14
16
|
scope :main_event, -> { where(status: :main) }
|
15
17
|
scope :actual, -> { where 'end_date > ?', DateTime.now }
|
16
18
|
scope :past, -> { where 'end_date < ?', DateTime.now }
|
17
|
-
|
19
|
+
|
18
20
|
def request_collecting_state
|
19
21
|
return :not_initialized unless request_collecting_begin_date.present? || request_collecting_end_date.present?
|
20
22
|
return :will_begin_soon if request_collecting_begin_date > DateTime.now
|
@@ -22,5 +24,7 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
|
|
22
24
|
return :are_being_right_now if request_collecting_begin_date&.past? && request_collecting_end_date&.future?
|
23
25
|
end
|
24
26
|
|
25
|
-
|
27
|
+
if defined? ::Tramway::Partner
|
28
|
+
include ::Tramway::Partner::Scopes
|
29
|
+
end
|
26
30
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::Partaking < ::Tramway::Core::ApplicationRecord
|
2
4
|
belongs_to :part, polymorphic: true
|
3
|
-
enumerize :part_type, in: [
|
5
|
+
enumerize :part_type, in: ['Tramway::Event::Event', 'Tramway::Event::Section']
|
4
6
|
|
5
7
|
belongs_to :person, class_name: 'Tramway::Event::Person'
|
6
8
|
|
7
|
-
search_by :position, person: [
|
9
|
+
search_by :position, person: %i[first_name last_name description]
|
8
10
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::Participant < ::Tramway::Event::ApplicationRecord
|
2
4
|
belongs_to :event, class_name: 'Tramway::Event::Event'
|
3
|
-
|
5
|
+
|
4
6
|
state_machine :participation_state, initial: :requested do
|
5
7
|
state :requested
|
6
8
|
state :prev_approved
|
@@ -11,23 +13,23 @@ class Tramway::Event::Participant < ::Tramway::Event::ApplicationRecord
|
|
11
13
|
state :reserved
|
12
14
|
|
13
15
|
event :previous_approve do
|
14
|
-
transition [
|
16
|
+
transition %i[requested without_answer waiting] => :prev_approved
|
15
17
|
end
|
16
18
|
|
17
19
|
event :wait_for_decision do
|
18
|
-
transition [
|
20
|
+
transition %i[requested without_answer] => :waiting
|
19
21
|
end
|
20
22
|
|
21
23
|
event :reserve do
|
22
|
-
transition [
|
24
|
+
transition %i[requested without_answer waiting] => :reserved
|
23
25
|
end
|
24
26
|
|
25
27
|
event :reject do
|
26
|
-
transition [
|
28
|
+
transition %i[requested without_answer waiting prev_approved reserved] => :rejected
|
27
29
|
end
|
28
30
|
|
29
31
|
event :approve do
|
30
|
-
transition [
|
32
|
+
transition %i[prev_approved reserved requested] => :approved
|
31
33
|
end
|
32
34
|
|
33
35
|
event :not_got_answer do
|
@@ -35,7 +37,7 @@ class Tramway::Event::Participant < ::Tramway::Event::ApplicationRecord
|
|
35
37
|
end
|
36
38
|
|
37
39
|
event :return_to_requested do
|
38
|
-
transition [
|
40
|
+
transition %i[prev_approved rejected] => :requested
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Event::ParticipantFormField < ::Tramway::Event::ApplicationRecord
|
2
4
|
belongs_to :event, class_name: 'Tramway::Event::Event'
|
3
5
|
|
4
|
-
enumerize :field_type, in: [
|
6
|
+
enumerize :field_type, in: %i[text string numeric date_picker select], default: :text
|
5
7
|
|
6
8
|
scope :inputs_list, -> { active.order(position: :asc) }
|
7
9
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
has_and_belongs_to_many :sections, class_name: 'Tramway::Event::Section'
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
3
|
+
class Tramway::Event::Person < ::Tramway::Event::ApplicationRecord
|
4
4
|
mount_uploader :photo, PhotoUploader
|
5
5
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
::Tramway::Admin.set_available_models(::Tramway::Event::Event,
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
::Tramway::Event::ParticipantFormField,
|
5
|
+
::Tramway::Event::Participant,
|
6
|
+
::Tramway::Event::Section,
|
7
|
+
::Tramway::Event::Person,
|
8
|
+
::Tramway::Event::Partaking,
|
9
|
+
::Tramway::Event::Place,
|
10
|
+
project: :event)
|
data/config/locales/models.yml
CHANGED
@@ -25,6 +25,7 @@ ru:
|
|
25
25
|
approved_participants: Количество пришедших
|
26
26
|
not_yet_held: мероприятие ещё не проведено
|
27
27
|
participants_list: Список участников
|
28
|
+
does_not_have_end_date: мероприятие не имеет даты окончания
|
28
29
|
tramway/event/participant:
|
29
30
|
comment: Примечание
|
30
31
|
event: Мероприятие
|
data/config/routes.rb
CHANGED
data/lib/tramway/event.rb
CHANGED
data/lib/tramway/event/engine.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rails/generators'
|
2
4
|
require 'tramway/core/generators/install_generator'
|
3
5
|
|
4
6
|
module Tramway::Event::Generators
|
5
7
|
class InstallGenerator < ::Tramway::Core::Generators::InstallGenerator
|
6
8
|
include Rails::Generators::Migration
|
7
|
-
source_root File.expand_path('
|
9
|
+
source_root File.expand_path('templates', __dir__)
|
8
10
|
|
9
11
|
def run_other_generators
|
10
12
|
generate 'tramway:partner:install'
|
@@ -36,7 +38,7 @@ module Tramway::Event::Generators
|
|
36
38
|
:add_position_to_tramway_event_partakings,
|
37
39
|
:add_state_to_tramway_event_partakings,
|
38
40
|
:add_more_fields_to_tramway_event_participants,
|
39
|
-
|
41
|
+
|
40
42
|
# NOTE must be removed until tramway-event 2.0
|
41
43
|
:rebuild_association_between_participant_and_partakings_to_polymorphic,
|
42
44
|
|
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.19.
|
4
|
+
version: 1.9.19.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rails engine for events
|
14
14
|
email:
|