tramway-event 1.12.3.9 → 1.12.6.2

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: d16cb62030954f34b751e718ea4c6d9e6f674a9a5f819f2f77c72352e23a5522
4
- data.tar.gz: 3fce7c42f43263082bf4076dd5e0a4eaadbe252e1be83d481611e765b4276ab1
3
+ metadata.gz: 0c7a13d81c0f6f396312c7401c34089bf766812f530121a7bf525cd8aaa557bb
4
+ data.tar.gz: f82e08ce10379a04c28a3b80cdd26408c21f8314ba29a7dc69544e55001fde12
5
5
  SHA512:
6
- metadata.gz: be1c3f5817c1920b5d455d0ba2d6b583d79fc0edd29d80d738c053df40cb474916f08a9075ab0d1ab11b1da5a8ef50c3103a8213eb6b6a20ecf0cf166c7b8849
7
- data.tar.gz: 8954b357e87e8035a1b6722696529993b52531088a74a42f160d190b7db78f2b94b2a1df811d07192462f0b98e1119590b19f660da1d1851f023258cb7674fbd
6
+ metadata.gz: c9e2b4dd803318ab7db79ce025d62ed8066ab41726f5710dea281bd1fb9586536991efeb3b4ce95364766b57a37e7dfa5025afdfa4b24401cf10b041e6d21e11
7
+ data.tar.gz: 219d971dbe76967a917c36891b3be59bb05c3547598a0d62051f0fecd518b84862f37103d01dbee885cf955deecba2f9ea673b76f5009a207cd376b54b7e5694
@@ -11,7 +11,7 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
11
11
  end
12
12
 
13
13
  def show_associations
14
- %i[participant_form_fields actions]
14
+ %i[participant_form_fields actions sections partakings]
15
15
  end
16
16
 
17
17
  def list_attributes
@@ -20,8 +20,10 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
20
20
  end
21
21
 
22
22
  delegate :title, to: :object
23
- decorate_associations :participants, :sections, :partakings, :partnerships, :organizations
23
+ decorate_associations :participants, :partnerships, :organizations
24
24
  decorate_association :participant_form_fields, as: :event
25
+ decorate_association :sections, as: :event
26
+ decorate_association :partakings, as: :part
25
27
  decorate_association :actions, as: :event, state_machines: [:action_state]
26
28
 
27
29
  def background
@@ -5,11 +5,15 @@ class Tramway::Event::SectionDecorator < ::Tramway::Landing::BlockTypes::Feature
5
5
  def collections
6
6
  [:all]
7
7
  end
8
+
9
+ def show_associations
10
+ [ :partakings ]
11
+ end
8
12
  end
9
13
 
10
14
  delegate :description, to: :object
11
15
  decorate_association :event
12
- decorate_association :partakings, decorator: Tramway::Event::PartakingFeatureDecorator
16
+ decorate_association :partakings, as: :part, decorator: Tramway::Event::PartakingFeatureDecorator
13
17
 
14
18
  def name
15
19
  "#{object.title} | #{object.event.title}"
@@ -3,7 +3,7 @@
3
3
  require 'securerandom'
4
4
 
5
5
  class Admin::Tramway::Event::ParticipantForm < ::Tramway::Core::ApplicationForm
6
- properties :participation_state_event, :comment
6
+ properties :comment
7
7
  association :event
8
8
 
9
9
  def self.new(object)
@@ -11,7 +11,6 @@ class Admin::Tramway::Event::ParticipantForm < ::Tramway::Core::ApplicationForm
11
11
  ::Tramway::Event::ParticipantExtendedFormCreator.create_form_class(
12
12
  SecureRandom.hex,
13
13
  object.event,
14
- participation_state_event: :default,
15
14
  comment: :string
16
15
  ).new object
17
16
  else
@@ -3,21 +3,21 @@
3
3
  class Tramway::Event::Action < Tramway::Core::ApplicationRecord
4
4
  belongs_to :event, class_name: 'Tramway::Event::Event'
5
5
 
6
- state_machine :action_state, initial: :must_be_done do
7
- state :must_be_done
6
+ aasm :action_state, column: :action_state do
7
+ state :must_be_done, initial: true
8
8
  state :done
9
9
  state :declined
10
10
 
11
11
  event :do do
12
- transition must_be_done: :done
12
+ transitions from: :must_be_done, to: :done
13
13
  end
14
14
 
15
15
  event :decline do
16
- transition must_be_done: :declined
16
+ transitions from: :must_be_done, to: :declined
17
17
  end
18
18
 
19
19
  event :return do
20
- transition %i[declined done] => :must_be_done
20
+ transitions from: %i[declined done], to: :must_be_done
21
21
  end
22
22
  end
23
23
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
3
+ class Tramway::Event::Event < ::Tramway::Core::ApplicationRecord
4
4
  mount_uploader :photo, PhotoUploader
5
5
 
6
6
  validate :check_dimensions
@@ -8,6 +8,8 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
8
8
  def check_dimensions
9
9
  if photo.present?
10
10
  errors.add :photo, :too_small_image if photo.width.present? && (photo.width < 1920 || photo.height < 1080)
11
+ else
12
+ errors.add :photo, :is_not_present
11
13
  end
12
14
  end
13
15
 
@@ -22,7 +24,9 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
22
24
 
23
25
  enumerize :reach, default: :open, in: %i[open closed]
24
26
 
25
- scope :actual, -> { where('begin_date > ?', DateTime.now).where('begin_date < ?', DateTime.now + 11.days).order(begin_date: :asc) }
27
+ scope :actual, -> do
28
+ where('begin_date > ?', DateTime.now).or(where('begin_date < ? AND end_date > ?', DateTime.now, DateTime.now)).order(begin_date: :asc)
29
+ end
26
30
  scope :past, -> { where 'end_date < ?', DateTime.now }
27
31
  scope :open, -> { where reach: :open }
28
32
  scope :closed, -> { where reach: :closed }
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Tramway::Event::Participant < ::Tramway::Event::ApplicationRecord
3
+ class Tramway::Event::Participant < ::Tramway::Core::ApplicationRecord
4
4
  belongs_to :event, class_name: 'Tramway::Event::Event'
5
5
 
6
- state_machine :participation_state, initial: :requested do
7
- state :requested
6
+ aasm :participation_state, column: :participation_state do
7
+ state :requested, initial: true
8
8
  state :prev_approved
9
9
  state :waiting
10
10
  state :rejected
@@ -13,31 +13,31 @@ class Tramway::Event::Participant < ::Tramway::Event::ApplicationRecord
13
13
  state :reserved
14
14
 
15
15
  event :previous_approve do
16
- transition %i[requested without_answer waiting] => :prev_approved
16
+ transitions from: %i[requested without_answer waiting], to: :prev_approved
17
17
  end
18
18
 
19
19
  event :wait_for_decision do
20
- transition %i[requested without_answer] => :waiting
20
+ transitions from: %i[requested without_answer], to: :waiting
21
21
  end
22
22
 
23
23
  event :reserve do
24
- transition %i[requested without_answer waiting] => :reserved
24
+ transitions from: %i[requested without_answer waiting], to: :reserved
25
25
  end
26
26
 
27
27
  event :reject do
28
- transition %i[requested without_answer waiting prev_approved reserved] => :rejected
28
+ transitions from: %i[requested without_answer waiting prev_approved reserved], to: :rejected
29
29
  end
30
30
 
31
31
  event :approve do
32
- transition %i[prev_approved reserved requested] => :approved
32
+ transitions from: %i[prev_approved reserved requested], to: :approved
33
33
  end
34
34
 
35
35
  event :not_got_answer do
36
- transition requested: :without_answer
36
+ transitions from: :requested, to: :without_answer
37
37
  end
38
38
 
39
39
  event :return_to_requested do
40
- transition %i[prev_approved rejected] => :requested
40
+ transitions from: %i[prev_approved rejected], to: :requested
41
41
  end
42
42
  end
43
43
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Tramway::Event::ParticipantFormField < ::Tramway::Event::ApplicationRecord
3
+ class Tramway::Event::ParticipantFormField < ::Tramway::Core::ApplicationRecord
4
4
  belongs_to :event, class_name: 'Tramway::Event::Event'
5
5
 
6
6
  enumerize :field_type, in: %i[text string numeric date_picker select checkbox], default: :text
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Tramway::Event::Person < ::Tramway::Event::ApplicationRecord
3
+ class Tramway::Event::Person < ::Tramway::Core::ApplicationRecord
4
4
  mount_uploader :photo, PhotoUploader
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Tramway::Event::Section < ::Tramway::Event::ApplicationRecord
3
+ class Tramway::Event::Section < ::Tramway::Core::ApplicationRecord
4
4
  mount_uploader :photo, PhotoUploader
5
5
 
6
6
  belongs_to :event, class_name: 'Tramway::Event::Event'
@@ -1,11 +1,12 @@
1
- .row.form
2
- .col-lg-12
3
- %h1.text-center
4
- = t(".request_collecting_state.#{event.request_collecting_state}")
5
- - if event.request_collecting_state == :are_being_right_now && event.participant_form_fields.any?
6
- - class_name = 'tramway_event_participant'
7
- = simple_form_for @participant_form, url: ::Tramway::Event::Engine.routes.url_helpers.participants_path, method: :post, html: { class: class_name, id: class_name } do |f|
8
- = f.input :event_id, as: :hidden, input_html: { value: event.id, class: class_name, id: "#{class_name}_event_id", name: "#{class_name}[event_id]" }
9
- - event.participant_form_fields.inputs_list.each do |field|
10
- = render 'tramway/core/shared/input_extended', field: field, class_name: class_name, f: f, value: (params[:participant].present? ? params[:participant][field.title] : '')
11
- = f.button :submit, t('.submit_form')
1
+ - unless event.request_collecting_state == :not_initialized
2
+ .row.form
3
+ .col-lg-12
4
+ %h1.text-center
5
+ = t(".request_collecting_state.#{event.request_collecting_state}")
6
+ - if event.request_collecting_state == :are_being_right_now && event.participant_form_fields.any?
7
+ - class_name = 'tramway_event_participant'
8
+ = simple_form_for @participant_form, url: ::Tramway::Event::Engine.routes.url_helpers.participants_path, method: :post, html: { class: class_name, id: class_name } do |f|
9
+ = f.input :event_id, as: :hidden, input_html: { value: event.id, class: class_name, id: "#{class_name}_event_id", name: "#{class_name}[event_id]" }
10
+ - event.participant_form_fields.inputs_list.each do |field|
11
+ = render 'tramway/core/shared/input_extended', field: field, class_name: class_name, f: f, value: (params[:participant].present? ? params[:participant][field.title] : '')
12
+ = f.button :submit, t('.submit_form')
@@ -40,6 +40,7 @@ ru:
40
40
  short_description: Краткое описание
41
41
  actions: Действие
42
42
  reach: Доступность мероприятия
43
+ sections: События
43
44
  tramway/event/participant:
44
45
  name: Имя
45
46
  list_fields: Данные
@@ -3,33 +3,32 @@ ru:
3
3
  tramway/event/participant:
4
4
  published: Опубликованные
5
5
  hidden: Скрытые
6
- activerecord:
7
- state_machines:
8
- tramway/event/participant:
9
- participation_state:
10
- states:
11
- requested: Заявка отправлена
12
- prev_approved: Получено предварительное подтверждение
13
- waiting: Ожидание решения
14
- rejected: Заявка отклонена
15
- approved: Прибывшие
16
- without_answer: Без ответа
17
- reserved: В резерве
18
- events:
19
- previous_approve: Предварительно подтвердить
20
- wait_for_decision: Ожидать ответа
21
- reject: Отклонить
22
- approve: Прибыл(а)
23
- not_got_answer: Связаться не удалось
24
- reserve: Отправить в резерв
25
- return_to_requested: Вернуть в необработанные
26
- tramway/event/action:
27
- action_state:
28
- states:
29
- done: Сделано
30
- must_be_done: Запланировано
31
- declined: Отклонено
32
- events:
33
- do: Выполнено
34
- decline: Отклонить
35
- return: Вернуть статус
6
+ state_machines:
7
+ tramway/event/participant:
8
+ participation_state:
9
+ states:
10
+ requested: Заявка отправлена
11
+ prev_approved: Получено предварительное подтверждение
12
+ waiting: Ожидание решения
13
+ rejected: Заявка отклонена
14
+ approved: Прибывшие
15
+ without_answer: Без ответа
16
+ reserved: В резерве
17
+ events:
18
+ previous_approve: Предварительно подтвердить
19
+ wait_for_decision: Ожидать ответа
20
+ reject: Отклонить
21
+ approve: Прибыл(а)
22
+ not_got_answer: Связаться не удалось
23
+ reserve: Отправить в резерв
24
+ return_to_requested: Вернуть в необработанные
25
+ tramway/event/action:
26
+ action_state:
27
+ states:
28
+ done: Сделано
29
+ must_be_done: Запланировано
30
+ declined: Отклонено
31
+ events:
32
+ do: Выполнено
33
+ decline: Отклонить
34
+ return: Вернуть статус
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Event
5
- VERSION = '1.12.3.9'
5
+ VERSION = '1.12.6.2'
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.3.9
4
+ version: 1.12.6.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: 2020-06-24 00:00:00.000000000 Z
11
+ date: 2021-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: configus
@@ -68,7 +68,6 @@ files:
68
68
  - app/jobs/tramway/event/application_job.rb
69
69
  - app/mailers/tramway/event/application_mailer.rb
70
70
  - app/models/tramway/event/action.rb
71
- - app/models/tramway/event/application_record.rb
72
71
  - app/models/tramway/event/event.rb
73
72
  - app/models/tramway/event/partaking.rb
74
73
  - app/models/tramway/event/participant.rb
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tramway
4
- module Event
5
- class ApplicationRecord < ::Tramway::Core::ApplicationRecord
6
- self.abstract_class = true
7
- end
8
- end
9
- end