tramway-event 1.9.31.2 → 1.10

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: 389fa955d28b590eee11a279a178a13666b3a86d76f5eb21359901666e524f59
4
- data.tar.gz: ac723fb0e351f2888753963b76febe034745128fa3bad07c1fa1af4035372f43
3
+ metadata.gz: ee8a6cc38a6f646e4149e9eaceb77b7f4f62021267c6d5d3299a7d116645bd7b
4
+ data.tar.gz: 3789f8bf034c384c6afde58e97b3594433c583e1bf1d740367473f7e33d2fd9b
5
5
  SHA512:
6
- metadata.gz: 8163d819f33edeff900a9eeba0ea89dc5f18ce9256124f0b6e42fadf169eff2417ccefeae6cd8ddb770a28321aa7bcb8cd0e9e324b8cca6afc5c6bb6f6829ef6
7
- data.tar.gz: 033466f38c2f791c3480f45233e187d39ccc2db6b030466adfb8b882b5cba0e8d72d74f089dde6215a1430d2058df2917900f6ba154eeb3e0ab958af6f91c11a
6
+ metadata.gz: 74b444d6e9a2990c37369bd3a1d69f0d578f5353a99de63bea017aa750c187bb084638d7c5dba22e87bc9777dffdcc9180e849fcb02a82a114b93c44edf0e79d
7
+ data.tar.gz: a37a05dddae8a310b1e8c722e68f4eab54ba4b14b5471c4764066ce6fdc7ddc489871d07c7d22c2c32ea57b2b831da93b5376731095855c354849dd0b541b4f8
@@ -7,7 +7,7 @@ class Tramway::Event::ParticipantsController < Tramway::Event::ApplicationContro
7
7
  if @participant_form.submit params[:tramway_event_participant].except :event_id
8
8
  redirect_to event_path event, flash: :success
9
9
  else
10
- redirect_to event_path event, flash: :error, errors: @participant_form.errors.messages
10
+ redirect_to event_path event, flash: :error, errors: @participant_form.errors.messages # , participant: @participant_form.attributes
11
11
  end
12
12
  end
13
13
  end
@@ -0,0 +1,21 @@
1
+ class Tramway::Event::ActionDecorator < Tramway::Core::ApplicationDecorator
2
+ class << self
3
+ delegate :human_action_state_event_name, to: :model_class
4
+ delegate :human_attribute_name, to: :model_class
5
+ end
6
+
7
+ def name
8
+ "#{object.title} - #{date_view(object.deadline)} - #{state_machine_view(object, :action_state)}"
9
+ end
10
+
11
+ def action_state_button_color(event)
12
+ case event
13
+ when :do
14
+ :success
15
+ when :decline
16
+ :danger
17
+ when :return
18
+ :warning
19
+ end
20
+ end
21
+ end
@@ -22,7 +22,7 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
22
22
  end
23
23
 
24
24
  def show_associations
25
- %i[participant_form_fields]
25
+ %i[participant_form_fields actions]
26
26
  end
27
27
 
28
28
  def list_attributes
@@ -38,6 +38,7 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
38
38
  decorate_association :partakings
39
39
  decorate_association :partnerships
40
40
  decorate_association :organizations
41
+ decorate_association :actions, as: :event, state_machines: [ :action_state ]
41
42
 
42
43
  def background
43
44
  object.photo
@@ -0,0 +1,13 @@
1
+ class Admin::Tramway::Event::ActionForm < Tramway::Core::ApplicationForm
2
+ properties :title, :action_state_event, :deadline
3
+
4
+ association :event
5
+
6
+ def initialize(object)
7
+ super(object).tap do
8
+ form_properties event: :association,
9
+ title: :string,
10
+ deadline: :date_picker
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ class Tramway::Event::Action < Tramway::Core::ApplicationRecord
2
+ belongs_to :event, class_name: 'Tramway::Event::Event'
3
+
4
+ state_machine :action_state, initial: :must_be_done do
5
+ state :must_be_done
6
+ state :done
7
+ state :declined
8
+
9
+ event :do do
10
+ transition must_be_done: :done
11
+ end
12
+
13
+ event :decline do
14
+ transition must_be_done: :declined
15
+ end
16
+
17
+ event :return do
18
+ transition [ :declined, :done ] => :must_be_done
19
+ end
20
+ end
21
+ end
@@ -9,6 +9,7 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
9
9
  has_many :partakings, as: :part, class_name: 'Tramway::Event::Partaking'
10
10
  has_many :partnerships, class_name: 'Tramway::Partner::Partnership', as: :partner
11
11
  has_many :organizations, as: :partners, through: :partnerships, class_name: 'Tramway::Partner::Organization'
12
+ has_many :actions, class_name: 'Tramway::Event::Action'
12
13
  has_and_belongs_to_many :places
13
14
 
14
15
  enumerize :status, default: :common, in: %i[common main]
@@ -7,6 +7,7 @@
7
7
  ::Tramway::Event::Person,
8
8
  ::Tramway::Event::Partaking,
9
9
  ::Tramway::Event::Place,
10
+ ::Tramway::Event::Action,
10
11
  project: :event)
11
12
  ::Tramway::Admin.set_notificable_queries new_participants: lambda { |current_user|
12
13
  ::Tramway::Event::Participant.active.where(participation_state: :requested).send "#{current_user.role}_scope", current_user.id
@@ -39,6 +39,7 @@ ru:
39
39
  does_not_have_end_date: мероприятие не имеет даты окончания
40
40
  participant_form_fields: Поле анкеты
41
41
  short_description: Краткое описание
42
+ actions: Действие
42
43
  tramway/event/participant:
43
44
  name: Имя
44
45
  list_fields: Данные
@@ -74,6 +75,10 @@ ru:
74
75
  part_name: Мероприятие
75
76
  event_duration: Дата мероприятия
76
77
  part_description: Описание
78
+ tramway/event/action:
79
+ event: Мероприятие
80
+ title: Название
81
+ deadline: Дедлайн
77
82
  errors:
78
83
  models:
79
84
  tramway/event/participant:
@@ -102,6 +107,9 @@ ru:
102
107
  tramway/event/place:
103
108
  genitive: место
104
109
  plural: места
110
+ tramway/event/action:
111
+ genitive: действие
112
+ plural: действия
105
113
  collections:
106
114
  tramway/event/participant:
107
115
  requested: Необработанные
@@ -23,3 +23,13 @@ ru:
23
23
  not_got_answer: Связаться не удалось
24
24
  reserve: Отправить в резерв
25
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: Вернуть статус
@@ -47,7 +47,8 @@ module Tramway::Event::Generators
47
47
 
48
48
  :create_tramway_event_places,
49
49
  :create_tramway_event_events_places,
50
- :add_short_description_to_tramway_event_events
50
+ :add_short_description_to_tramway_event_events,
51
+ :create_tramway_event_actions
51
52
  ]
52
53
  migrations.each do |migration|
53
54
  migration_template "#{migration}.rb", "db/migrate/#{migration}.rb"
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateTramwayEventActions < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :tramway_event_actions do |t|
6
+ t.integer :event_id
7
+ t.text :title
8
+ t.datetime :deadline
9
+ t.text :action_state, default: :must_be_done
10
+ t.text :state, default: :active
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Event
5
- VERSION = '1.9.31.2'
5
+ VERSION = '1.10'
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.9.31.2
4
+ version: '1.10'
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-02-25 00:00:00.000000000 Z
11
+ date: 2020-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: configus
@@ -42,6 +42,7 @@ files:
42
42
  - app/controllers/tramway/event/application_controller.rb
43
43
  - app/controllers/tramway/event/events_controller.rb
44
44
  - app/controllers/tramway/event/participants_controller.rb
45
+ - app/decorators/tramway/event/action_decorator.rb
45
46
  - app/decorators/tramway/event/event_decorator.rb
46
47
  - app/decorators/tramway/event/event_link_decorator.rb
47
48
  - app/decorators/tramway/event/events/show/event_decorator.rb
@@ -54,6 +55,7 @@ files:
54
55
  - app/decorators/tramway/event/place_decorator.rb
55
56
  - app/decorators/tramway/event/section_decorator.rb
56
57
  - app/decorators/tramway/event/section_feature_decorator.rb
58
+ - app/forms/admin/tramway/event/action_form.rb
57
59
  - app/forms/admin/tramway/event/event_form.rb
58
60
  - app/forms/admin/tramway/event/partaking_form.rb
59
61
  - app/forms/admin/tramway/event/participant_form.rb
@@ -65,6 +67,7 @@ files:
65
67
  - app/helpers/tramway/event/application_helper.rb
66
68
  - app/jobs/tramway/event/application_job.rb
67
69
  - app/mailers/tramway/event/application_mailer.rb
70
+ - app/models/tramway/event/action.rb
68
71
  - app/models/tramway/event/application_record.rb
69
72
  - app/models/tramway/event/event.rb
70
73
  - app/models/tramway/event/partaking.rb
@@ -99,6 +102,7 @@ files:
99
102
  - lib/tramway/event/generators/templates/add_short_description_to_tramway_event_events.rb
100
103
  - lib/tramway/event/generators/templates/add_state_to_tramway_event_partakings.rb
101
104
  - lib/tramway/event/generators/templates/add_status_to_tramway_event_events.rb
105
+ - lib/tramway/event/generators/templates/create_tramway_event_actions.rb
102
106
  - lib/tramway/event/generators/templates/create_tramway_event_events.rb
103
107
  - lib/tramway/event/generators/templates/create_tramway_event_events_places.rb
104
108
  - lib/tramway/event/generators/templates/create_tramway_event_participant_form_fields.rb