tramway-event 1.12.9.1 → 2.0
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/javascripts/application.js +2 -2
- data/app/assets/javascripts/tramway/event/application.js +2 -2
- data/app/assets/stylesheets/tramway/event/events/show.css.sass +1 -1
- data/app/controllers/tramway/event/application_controller.rb +1 -1
- data/app/decorators/tramway/event/action_decorator.rb +1 -1
- data/app/decorators/tramway/event/event_decorator.rb +3 -6
- data/app/decorators/tramway/event/events/show/event_decorator.rb +3 -3
- data/app/decorators/tramway/event/partaking_decorator.rb +1 -1
- data/app/decorators/tramway/event/participant_decorator.rb +2 -6
- data/app/decorators/tramway/event/participant_form_field_decorator.rb +1 -1
- data/app/decorators/tramway/event/person_decorator.rb +1 -1
- data/app/decorators/tramway/event/place_decorator.rb +1 -1
- data/app/forms/admin/tramway/event/action_form.rb +1 -1
- data/app/forms/admin/tramway/event/event_form.rb +1 -1
- data/app/forms/admin/tramway/event/partaking_form.rb +1 -1
- data/app/forms/admin/tramway/event/participant_form.rb +1 -1
- data/app/forms/admin/tramway/event/participant_form_field_form.rb +1 -1
- data/app/forms/admin/tramway/event/person_form.rb +1 -1
- data/app/forms/admin/tramway/event/place_form.rb +1 -1
- data/app/forms/admin/tramway/event/section_form.rb +1 -1
- data/app/forms/tramway/event/participant_extended_form_creator.rb +3 -3
- data/app/models/tramway/event/action.rb +1 -1
- data/app/models/tramway/event/event.rb +6 -6
- data/app/models/tramway/event/partaking.rb +1 -1
- data/app/models/tramway/event/participant.rb +1 -1
- data/app/models/tramway/event/participant_form_field.rb +1 -1
- data/app/models/tramway/event/person.rb +1 -1
- data/app/models/tramway/event/place.rb +1 -1
- data/app/models/tramway/event/section.rb +1 -1
- data/app/views/tramway/event/participants/_form.html.haml +1 -1
- data/config/initializers/tramway.rb +2 -2
- data/lib/tramway/event/generators/install_generator.rb +2 -2
- data/lib/tramway/event/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 015ee29d79339473ab21a7599accf8bc1b6069dc2857b2c27e2f043009ffe0d3
|
4
|
+
data.tar.gz: 14bc25abb9f1b8ad28c934950217fb9b11499f761fa6ea941e1bddc628015958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6470ed1ac3acb351551206cef82ad9629f4216a679af39ee1c0a0ac423cc2dcb56d095702b56917aacc9a160a2669a60c95a6f996ef8aa561a8df21df021638c
|
7
|
+
data.tar.gz: 4511da3a712ebb85953d3c807c91bfead1bc81a3c9f046e462a8fe4814fe5b6a76206715e48f6483d6ca6ab713f159beb48abfb9f61600132bd55ec688109743
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ Versions table
|
|
39
39
|
|
40
40
|
*config/initializers/tramway.rb*
|
41
41
|
```ruby
|
42
|
-
Tramway
|
42
|
+
Tramway.set_available_models ::Tramway::Event::Event, ::Tramway::Event::ParticipantFormField, ::Tramway::Event::Participant, project: #{project_which_you_used_in_the_application}
|
43
43
|
```
|
44
44
|
|
45
45
|
#### 6. Add events routes to the app
|
@@ -1,2 +1,2 @@
|
|
1
|
-
//= require tramway/
|
2
|
-
//= require_tree .
|
1
|
+
//= require tramway/application
|
2
|
+
//= require_tree .
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Tramway::Event::ActionDecorator < Tramway::
|
3
|
+
class Tramway::Event::ActionDecorator < Tramway::ApplicationDecorator
|
4
4
|
class << self
|
5
5
|
delegate :human_action_state_event_name, to: :model_class
|
6
6
|
delegate :human_attribute_name, to: :model_class
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Tramway::Event::EventDecorator < ::Tramway::
|
3
|
+
class Tramway::Event::EventDecorator < ::Tramway::ApplicationDecorator
|
4
4
|
class << self
|
5
5
|
def collections
|
6
6
|
[:all]
|
7
7
|
end
|
8
8
|
|
9
9
|
def show_attributes
|
10
|
-
%i[title duration events_link
|
10
|
+
%i[title duration events_link created_at photo request_collecting_duration description participants_list]
|
11
11
|
end
|
12
12
|
|
13
13
|
def show_associations
|
@@ -43,7 +43,7 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def participants_list
|
46
|
-
content_tag :a, href: ::Tramway::
|
46
|
+
content_tag :a, href: ::Tramway::Engine.routes.url_helpers.records_path(model: ::Tramway::Event::Participant, filter: { event_id_eq: object.id }) do
|
47
47
|
I18n.t('helpers.links.open')
|
48
48
|
end
|
49
49
|
end
|
@@ -92,8 +92,5 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
def state
|
96
|
-
state_machine_view object, :state
|
97
|
-
end
|
98
95
|
alias tagline duration
|
99
96
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Tramway::Event::Events::Show::EventDecorator < ::Tramway::
|
3
|
+
class Tramway::Event::Events::Show::EventDecorator < ::Tramway::ApplicationDecorator
|
4
4
|
class << self
|
5
5
|
def collections
|
6
6
|
[:all]
|
@@ -45,10 +45,10 @@ class Tramway::Event::Events::Show::EventDecorator < ::Tramway::Core::Applicatio
|
|
45
45
|
|
46
46
|
def responsible_person
|
47
47
|
{
|
48
|
-
title: Tramway::
|
48
|
+
title: Tramway::UserDecorator.decorate(object.creator)&.name,
|
49
49
|
phone: (object.creator.phone if object.creator&.phone&.present?),
|
50
50
|
email: (object.creator.email if object.creator&.email&.present?),
|
51
|
-
social_networks: (object.creator.social_networks
|
51
|
+
social_networks: (object.creator.social_networks if object.creator.respond_to?(:social_networks))
|
52
52
|
}
|
53
53
|
end
|
54
54
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Tramway::Event::ParticipantDecorator < ::Tramway::
|
3
|
+
class Tramway::Event::ParticipantDecorator < ::Tramway::ApplicationDecorator
|
4
4
|
include HTMLTagsHelpers
|
5
5
|
class << self
|
6
6
|
def collections
|
@@ -13,7 +13,7 @@ class Tramway::Event::ParticipantDecorator < ::Tramway::Core::ApplicationDecorat
|
|
13
13
|
delegate :human_participation_state_event_name, to: :model_class
|
14
14
|
|
15
15
|
def show_attributes
|
16
|
-
%i[id event values
|
16
|
+
%i[id event values created_at updated_at participation_state comment]
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -96,10 +96,6 @@ class Tramway::Event::ParticipantDecorator < ::Tramway::Core::ApplicationDecorat
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
def state
|
100
|
-
state_machine_view object, :state
|
101
|
-
end
|
102
|
-
|
103
99
|
def created_at
|
104
100
|
date_view object.created_at
|
105
101
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Admin::Tramway::Event::EventForm < ::Tramway::
|
3
|
+
class Admin::Tramway::Event::EventForm < ::Tramway::ApplicationForm
|
4
4
|
properties :title, :description, :begin_date, :end_date, :photo, :reach,
|
5
5
|
:request_collecting_begin_date, :request_collecting_end_date, :short_description
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Admin::Tramway::Event::PartakingForm < ::Tramway::
|
3
|
+
class Admin::Tramway::Event::PartakingForm < ::Tramway::ApplicationForm
|
4
4
|
properties :part_id, :part_type, :person_id, :position
|
5
5
|
associations :person, :part
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::
|
3
|
+
class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::ExtendedApplicationForm
|
4
4
|
properties :title, :description, :field_type, :options, :position, :list_field, :presence_field, :select_options
|
5
5
|
association :event
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Admin::Tramway::Event::SectionForm < ::Tramway::
|
3
|
+
class Admin::Tramway::Event::SectionForm < ::Tramway::ApplicationForm
|
4
4
|
properties :event, :title, :description, :photo, :icon, :position
|
5
5
|
association :event
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Tramway::Event::ParticipantExtendedFormCreator < Tramway::
|
3
|
+
class Tramway::Event::ParticipantExtendedFormCreator < Tramway::FormCreator
|
4
4
|
def self.create_form_class(uuid, event, **simple_properties)
|
5
5
|
class_name = "ParticipantExtendedForm#{uuid.gsub('-', '')}"
|
6
6
|
properties = event.participant_form_fields.inputs_list.reduce({}) do |hash, field|
|
@@ -10,9 +10,9 @@ class Tramway::Event::ParticipantExtendedFormCreator < Tramway::Core::FormCreato
|
|
10
10
|
}
|
11
11
|
end
|
12
12
|
if simple_properties.keys.any?
|
13
|
-
::Tramway::
|
13
|
+
::Tramway::ExtendableForm.new(class_name, simple_properties: simple_properties, **properties)
|
14
14
|
else
|
15
|
-
::Tramway::
|
15
|
+
::Tramway::ExtendableForm.new(class_name, **properties)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Tramway::Event::Event <
|
3
|
+
class Tramway::Event::Event < Tramway::ApplicationRecord
|
4
4
|
mount_uploader :photo, PhotoUploader
|
5
5
|
|
6
6
|
validate :check_dimensions
|
@@ -11,13 +11,13 @@ class Tramway::Event::Event < ::Tramway::Core::ApplicationRecord
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
has_many :participants, class_name: 'Tramway::Event::Participant'
|
15
|
-
has_many :participant_form_fields, -> { order(position: :asc) }, class_name: 'Tramway::Event::ParticipantFormField'
|
16
|
-
has_many :sections, class_name: 'Tramway::Event::Section'
|
14
|
+
has_many :participants, class_name: 'Tramway::Event::Participant', dependent: :destroy
|
15
|
+
has_many :participant_form_fields, -> { order(position: :asc) }, class_name: 'Tramway::Event::ParticipantFormField', dependent: :destroy
|
16
|
+
has_many :sections, class_name: 'Tramway::Event::Section', dependent: :destroy
|
17
17
|
has_many :partakings, as: :part, class_name: 'Tramway::Event::Partaking', dependent: :destroy
|
18
|
-
has_many :partnerships, class_name: 'Tramway::Partner::Partnership', as: :partner
|
18
|
+
has_many :partnerships, class_name: 'Tramway::Partner::Partnership', as: :partner, dependent: :destroy
|
19
19
|
has_many :organizations, as: :partners, through: :partnerships, class_name: 'Tramway::Partner::Organization'
|
20
|
-
has_many :actions, -> { order(id: :asc) }, class_name: 'Tramway::Event::Action'
|
20
|
+
has_many :actions, -> { order(id: :asc) }, class_name: 'Tramway::Event::Action', dependent: :destroy
|
21
21
|
has_and_belongs_to_many :places
|
22
22
|
|
23
23
|
enumerize :reach, default: :open, in: %i[open closed]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Tramway::Event::Partaking < ::Tramway::
|
3
|
+
class Tramway::Event::Partaking < ::Tramway::ApplicationRecord
|
4
4
|
belongs_to :part, polymorphic: true
|
5
5
|
enumerize :part_type, in: ['Tramway::Event::Event', 'Tramway::Event::Section']
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Tramway::Event::Participant < ::Tramway::
|
3
|
+
class Tramway::Event::Participant < ::Tramway::ApplicationRecord
|
4
4
|
belongs_to :event, class_name: 'Tramway::Event::Event'
|
5
5
|
|
6
6
|
aasm :participation_state, column: :participation_state do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Tramway::Event::ParticipantFormField < ::Tramway::
|
3
|
+
class Tramway::Event::ParticipantFormField < ::Tramway::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
|
@@ -8,5 +8,5 @@
|
|
8
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
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
10
|
- event.participant_form_fields.inputs_list.each do |field|
|
11
|
-
= render 'tramway/
|
11
|
+
= render 'tramway/shared/input_extended', field: field, class_name: class_name, f: f, value: (params[:participant].present? ? params[:participant][field.title] : '')
|
12
12
|
= f.button :submit, t('.submit_form')
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
::Tramway
|
3
|
+
::Tramway.set_available_models(::Tramway::Event::Event,
|
4
4
|
::Tramway::Event::ParticipantFormField,
|
5
5
|
::Tramway::Event::Participant,
|
6
6
|
::Tramway::Event::Section,
|
@@ -9,7 +9,7 @@
|
|
9
9
|
::Tramway::Event::Place,
|
10
10
|
::Tramway::Event::Action,
|
11
11
|
project: :event)
|
12
|
-
::Tramway
|
12
|
+
::Tramway.set_notificable_queries new_participants: lambda { |current_user|
|
13
13
|
::Tramway::Event::Participant.where(participation_state: :requested).send "#{current_user.role}_scope", current_user.id
|
14
14
|
}
|
15
15
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rails/generators'
|
4
|
-
require 'tramway/
|
4
|
+
require 'tramway/generators/install_generator'
|
5
5
|
|
6
6
|
module Tramway::Event::Generators
|
7
|
-
class InstallGenerator < ::Tramway::
|
7
|
+
class InstallGenerator < ::Tramway::Generators::InstallGenerator
|
8
8
|
include Rails::Generators::Migration
|
9
9
|
source_root File.expand_path('templates', __dir__)
|
10
10
|
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: '2.0'
|
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: 2023-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: tramway
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -116,7 +116,7 @@ files:
|
|
116
116
|
- lib/tramway/event/generators/templates/remove_status_from_tramway_event_events.rb
|
117
117
|
- lib/tramway/event/generators/templates/rename_tramway_event_people_sections_to_tramway_event_partakings.rb
|
118
118
|
- lib/tramway/event/version.rb
|
119
|
-
homepage: https://github.com/
|
119
|
+
homepage: https://github.com/kalashnikovisme/tramway-event
|
120
120
|
licenses:
|
121
121
|
- MIT
|
122
122
|
metadata: {}
|