tramway-event 1.9.19.1 → 1.9.19.2

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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -5
  3. data/app/controllers/tramway/event/application_controller.rb +2 -0
  4. data/app/controllers/tramway/event/events_controller.rb +2 -0
  5. data/app/controllers/tramway/event/participants_controller.rb +2 -0
  6. data/app/decorators/tramway/event/event_decorator.rb +16 -13
  7. data/app/decorators/tramway/event/event_link_decorator.rb +2 -0
  8. data/app/decorators/tramway/event/events/show/event_decorator.rb +4 -2
  9. data/app/decorators/tramway/event/partaking_decorator.rb +5 -3
  10. data/app/decorators/tramway/event/partaking_feature_decorator.rb +2 -0
  11. data/app/decorators/tramway/event/participant_decorator.rb +7 -5
  12. data/app/decorators/tramway/event/participant_form_field_decorator.rb +3 -1
  13. data/app/decorators/tramway/event/participant_xlsx_decorator.rb +3 -1
  14. data/app/decorators/tramway/event/person_decorator.rb +3 -1
  15. data/app/decorators/tramway/event/place_decorator.rb +2 -0
  16. data/app/decorators/tramway/event/section_decorator.rb +3 -1
  17. data/app/decorators/tramway/event/section_feature_decorator.rb +3 -1
  18. data/app/forms/tramway/event/event_form.rb +9 -7
  19. data/app/forms/tramway/event/partaking_form.rb +4 -2
  20. data/app/forms/tramway/event/participant_extended_form_creator.rb +2 -0
  21. data/app/forms/tramway/event/participant_form.rb +2 -0
  22. data/app/forms/tramway/event/participant_form_field_form.rb +2 -0
  23. data/app/forms/tramway/event/person_form.rb +5 -3
  24. data/app/forms/tramway/event/place_form.rb +6 -4
  25. data/app/forms/tramway/event/section_form.rb +3 -1
  26. data/app/helpers/tramway/event/application_helper.rb +3 -1
  27. data/app/jobs/tramway/event/application_job.rb +2 -0
  28. data/app/mailers/tramway/event/application_mailer.rb +2 -0
  29. data/app/models/tramway/event/application_record.rb +2 -0
  30. data/app/models/tramway/event/event.rb +4 -2
  31. data/app/models/tramway/event/partaking.rb +4 -2
  32. data/app/models/tramway/event/participant.rb +9 -7
  33. data/app/models/tramway/event/participant_form_field.rb +3 -1
  34. data/app/models/tramway/event/person.rb +2 -0
  35. data/app/models/tramway/event/place.rb +2 -0
  36. data/app/models/tramway/event/section.rb +2 -0
  37. data/config/initializers/assets.rb +3 -1
  38. data/config/initializers/tramway.rb +9 -7
  39. data/config/routes.rb +2 -0
  40. data/lib/tasks/tramway/event_tasks.rake +2 -0
  41. data/lib/tramway/event.rb +3 -1
  42. data/lib/tramway/event/engine.rb +2 -0
  43. data/lib/tramway/event/generators/install_generator.rb +4 -2
  44. data/lib/tramway/event/generators/templates/add_description_to_tramway_event_people.rb +2 -0
  45. data/lib/tramway/event/generators/templates/add_icon_to_tramway_event_sections.rb +2 -0
  46. data/lib/tramway/event/generators/templates/add_more_fields_to_tramway_event_participants.rb +2 -0
  47. data/lib/tramway/event/generators/templates/add_options_to_tramway_event_participant_form_fields.rb +2 -0
  48. data/lib/tramway/event/generators/templates/add_photo_to_tramway_event_events.rb +2 -0
  49. data/lib/tramway/event/generators/templates/add_position_to_tramway_event_partakings.rb +2 -0
  50. data/lib/tramway/event/generators/templates/add_position_to_tramway_event_participant_form_fields.rb +2 -0
  51. data/lib/tramway/event/generators/templates/add_position_to_tramway_event_sections.rb +2 -0
  52. data/lib/tramway/event/generators/templates/add_request_period_to_tramway_event_events.rb +2 -0
  53. data/lib/tramway/event/generators/templates/add_state_to_tramway_event_partakings.rb +2 -0
  54. data/lib/tramway/event/generators/templates/add_status_to_tramway_event_events.rb +2 -0
  55. data/lib/tramway/event/generators/templates/create_tramway_event_events.rb +2 -0
  56. data/lib/tramway/event/generators/templates/create_tramway_event_events_places.rb +2 -0
  57. data/lib/tramway/event/generators/templates/create_tramway_event_participant_form_fields.rb +2 -0
  58. data/lib/tramway/event/generators/templates/create_tramway_event_participants.rb +2 -0
  59. data/lib/tramway/event/generators/templates/create_tramway_event_people.rb +2 -0
  60. data/lib/tramway/event/generators/templates/create_tramway_event_people_sections.rb +2 -0
  61. data/lib/tramway/event/generators/templates/create_tramway_event_places.rb +2 -0
  62. data/lib/tramway/event/generators/templates/create_tramway_event_sections.rb +2 -0
  63. data/lib/tramway/event/generators/templates/rebuild_association_between_participant_and_partakings_to_polymorphic.rb +2 -0
  64. data/lib/tramway/event/generators/templates/rename_tramway_event_people_sections_to_tramway_event_partakings.rb +2 -0
  65. data/lib/tramway/event/version.rb +3 -1
  66. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41f0767e6a896e151cc837b8728ee5175e2441fc2ecfbb3e2afcff941e199b5f
4
- data.tar.gz: 6d37f908a7618031f73771de99e46ebacddf80503c30c5e8c8caf108d3497a47
3
+ metadata.gz: 2fa39c1639004038330bc20e061dde1b2737ebdd6e8029c6d067fa675d2112cc
4
+ data.tar.gz: dc24aa87fdc2346c96a34d98a38f0bb4569e94ad6805be93271e6a6fe789f0df
5
5
  SHA512:
6
- metadata.gz: cfdebc74750ff1e24f39294707007227512045e16a1c47ac67a1d25914735f62f4ad805eb91ee26adc63e5e9d0a00cd670ba96162c69832a51de519b93e7877e
7
- data.tar.gz: 4ad68d335c853d2338188c48c1fd236308588de1b0670828c3361b0da14fe62e88341c59cdd1a9df3c5ca7b34f2df3476bfcd683b6fbd3ebbb75916ba0d2c268
6
+ metadata.gz: 8809bdb33077e8dc9aded16ccfc98d8c894f5f1d0823802f7b211fdbd6ae352d218ba18d9a1200e6ca8706e3912dbac1c2a81b93cca75ae0e9c57a84aec61c49
7
+ data.tar.gz: e48bc4b4a56bfb11da3963564a59812854b35006ad70b762185c3749c9b64fffd0418c223e2e28ce620bf8123d384e04a1bda9c58329db1a3f735a95558df743
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("../test/dummy/Rakefile", __FILE__)
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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Event
3
5
  class ApplicationController < ::Tramway::Core::ApplicationController
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::EventsController < Tramway::Event::ApplicationController
2
4
  layout 'tramway/landing/application'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::ParticipantsController < Tramway::Event::ApplicationController
2
4
  def create
3
5
  event = ::Tramway::Event::Event.find params[:tramway_event_participant][:event_id]
@@ -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
- [ :all ]
6
+ [:all]
5
7
  end
6
8
 
7
9
  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
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
- [ :requested_participants, :approved_participants ]
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
- "#{I18n.l(begin_date, format: '%d %B %Y')}"
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
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::EventLinkDecorator < ::Tramway::Landing::LinkDecorator
2
4
  delegate :title, to: :object
3
5
 
@@ -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
- [ :all ]
6
+ [:all]
5
7
  end
6
8
  end
7
9
 
@@ -22,7 +24,7 @@ class Tramway::Event::Events::Show::EventDecorator < ::Tramway::Core::Applicatio
22
24
 
23
25
  def duration
24
26
  if object.begin_date.to_date == object.end_date.to_date
25
- "#{I18n.l(object.begin_date, format: '%d %B %Y')}"
27
+ I18n.l(object.begin_date, format: '%d %B %Y').to_s
26
28
  elsif object.begin_date.month == object.end_date.month
27
29
  "#{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
30
  else
@@ -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
- [ :all ]
6
+ [:all]
5
7
  end
6
8
 
7
9
  def show_attributes
8
- [ :part_name, :event_duration, :part_description ]
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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ::Tramway::Event::PartakingFeatureDecorator < ::Tramway::Landing::BlockTypes::FeaturesDecorator
2
4
  def text
3
5
  object.position&.html_safe
@@ -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
- [ :requested, :waiting, :prev_approved, :without_answer, :approved, :rejected, :reserved, :all ]
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( field.title )
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
- tel_tag value
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::ParticipantFormFieldDecorator < ::Tramway::Core::ApplicationDecorator
2
4
  class << self
3
5
  def collections
4
- [ :all ]
6
+ [:all]
5
7
  end
6
8
 
7
9
  def list_attributes
@@ -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
- [ :full_name, :email, :phone, :organization, :event ].map do |attribute|
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,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::PersonDecorator < ::Tramway::Core::ApplicationDecorator
2
4
  class << self
3
5
  def collections
4
- [ :all ]
6
+ [:all]
5
7
  end
6
8
  end
7
9
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::PlaceDecorator < Tramway::Core::ApplicationDecorator
2
4
  delegate :title, to: :object
3
5
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::SectionDecorator < ::Tramway::Landing::BlockTypes::FeaturesDecorator
2
4
  class << self
3
5
  def collections
4
- [ :all ]
6
+ [:all]
5
7
  end
6
8
  end
7
9
 
@@ -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(/<strong>.*?<\/strong>/).join(' ')
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
- description: :ckeditor,
9
- begin_date: :date_picker,
10
- end_date: :date_picker,
11
- request_collecting_begin_date: :date_picker,
12
- request_collecting_end_date: :date_picker,
13
- photo: :file,
14
- status: :default
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
- person: :association,
9
- position: :string
10
+ person: :association,
11
+ position: :string
10
12
  end
11
13
  end
12
14
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::ParticipantExtendedFormCreator < Tramway::Core::FormCreator
2
4
  def self.create_form_class(uuid, event, **simple_properties)
3
5
  class_name = "ParticipantExtendedForm#{uuid.gsub('-', '')}"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
 
3
5
  class Tramway::Event::ParticipantForm < ::Tramway::Core::ApplicationForm
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::ApplicationForm
2
4
  properties :title, :description, :field_type, :options, :position
3
5
  association :event
@@ -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
- last_name: :string,
8
- photo: :file,
9
- description: :ckeditor
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
- description: :ckeditor,
8
- coordinates: :string,
9
- photo: :file,
10
- city: :string
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,4 +1,6 @@
1
- require "tramway/collections/helper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'tramway/collections/helper'
2
4
 
3
5
  module Tramway
4
6
  module Event
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Event
3
5
  class ApplicationJob < ActiveJob::Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Event
3
5
  class ApplicationMailer < ActionMailer::Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Event
3
5
  class ApplicationRecord < ::Tramway::Core::ApplicationRecord
@@ -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: [ :common, :main ]
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
@@ -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: [ 'Tramway::Event::Event', 'Tramway::Event::Section' ]
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: [:first_name, :last_name, :description]
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 [ :requested, :without_answer, :waiting ] => :prev_approved
16
+ transition %i[requested without_answer waiting] => :prev_approved
15
17
  end
16
18
 
17
19
  event :wait_for_decision do
18
- transition [ :requested, :without_answer ] => :waiting
20
+ transition %i[requested without_answer] => :waiting
19
21
  end
20
22
 
21
23
  event :reserve do
22
- transition [ :requested, :without_answer, :waiting ] => :reserved
24
+ transition %i[requested without_answer waiting] => :reserved
23
25
  end
24
26
 
25
27
  event :reject do
26
- transition [ :requested, :without_answer, :waiting, :prev_approved, :reserved ] => :rejected
28
+ transition %i[requested without_answer waiting prev_approved reserved] => :rejected
27
29
  end
28
30
 
29
31
  event :approve do
30
- transition [ :prev_approved, :reserved, :requested ] => :approved
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 [ :prev_approved, :rejected ] => :requested
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: [ :text, :string, :numeric, :date_picker, :select ], default: :text
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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::Person < ::Tramway::Event::ApplicationRecord
2
4
  has_and_belongs_to_many :sections, class_name: 'Tramway::Event::Section'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::Place < Tramway::Core::ApplicationRecord
2
4
  has_and_belongs_to_many :events
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Event::Section < ::Tramway::Event::ApplicationRecord
2
4
  mount_uploader :photo, PhotoUploader
3
5
 
@@ -1 +1,3 @@
1
- Rails.application.config.assets.precompile += %w( tramway/event/events/show.css )
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.config.assets.precompile += %w[tramway/event/events/show.css]
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ::Tramway::Admin.set_available_models(::Tramway::Event::Event,
2
- ::Tramway::Event::ParticipantFormField,
3
- ::Tramway::Event::Participant,
4
- ::Tramway::Event::Section,
5
- ::Tramway::Event::Person,
6
- ::Tramway::Event::Partaking,
7
- ::Tramway::Event::Place,
8
- project: :event)
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/routes.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Tramway::Event::Engine.routes.draw do
2
4
  resources :events, only: :show
3
5
  resources :participants, only: :create
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # desc "Explaining what the task does"
2
4
  # task :tramway_event do
3
5
  # # Task goes here
data/lib/tramway/event.rb CHANGED
@@ -1,4 +1,6 @@
1
- require "tramway/event/engine"
1
+ # frozen_string_literal: true
2
+
3
+ require 'tramway/event/engine'
2
4
  require 'tramway/event/generators/install_generator'
3
5
 
4
6
  module Tramway
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Event
3
5
  class Engine < ::Rails::Engine
@@ -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('../templates', __FILE__)
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
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddDescriptionToTramwayEventPeople < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_people, :description, :text
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddIconToTramwayEventSections < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_sections, :icon, :text
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddMoreFieldsToTramwayEventParticipants < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_participants, :participation_state, :text, default: :requested
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddOptionsToTramwayEventParticipantFormFields < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_participant_form_fields, :options, :jsonb
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddPhotoToTramwayEventEvents < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_events, :photo, :text
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddPositionToTramwayEventPartakings < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_partakings, :position, :text
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddPositionToTramwayEventParticipantFormFields < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_participant_form_fields, :position, :integer
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddPositionToTramwayEventSections < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_sections, :position, :integer
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddRequestPeriodToTramwayEventEvents < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_events, :request_collecting_begin_date, :datetime
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddStateToTramwayEventPartakings < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_partakings, :state, :text
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddStatusToTramwayEventEvents < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  add_column :tramway_event_events, :status, :text
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayEventEvents < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_event_events do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayEventEventsPlaces < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_event_events_places do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayEventParticipantFormFields < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_event_participant_form_fields do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayEventParticipants < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_event_participants do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayEventPeople < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_event_people do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayEventPeopleSections < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_event_people_sections do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayEventPlaces < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_event_places do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateTramwayEventSections < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :tramway_event_sections do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # NOTE must be removed until tramway-event 2.0
2
4
 
3
5
  class RebuildAssociationBetweenParticipantAndPartakingsToPolymorphic < ActiveRecord::Migration[5.1]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # NOTE must be removed until tramway-event 2.0
2
4
 
3
5
  class RenameTramwayEventPeopleSectionsToTramwayEventPartakings < ActiveRecord::Migration[5.1]
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tramway
2
4
  module Event
3
- VERSION = '1.9.19.1'
5
+ VERSION = '1.9.19.2'
4
6
  end
5
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.9.19.1
4
+ version: 1.9.19.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: 2019-10-06 00:00:00.000000000 Z
11
+ date: 2019-11-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for events
14
14
  email: