tramway-event 1.6.4 → 1.7

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: 17c5fef82865b2a59a341fdd4b602e8bf461497dc68fffbf1f33425adc9f4144
4
- data.tar.gz: 55605dafbd285e984dffaeef226a71fe5a6b1ad36a6a6313393ee90528bc26ad
3
+ metadata.gz: 37923a2a9773e2913ef0830b5d9f15bca800c1fecc90ac0a3347dbb45f759306
4
+ data.tar.gz: fc14669e2e6ae25608176ffbee418a68c6531e8f896157dfb4f6599991e6733a
5
5
  SHA512:
6
- metadata.gz: 05d26eb2fb4eaaf2800dbe5e093b8d14ee283c7e73790dd64e8b0752d4015025953c8af91851caed73f32634db2e066edf28ea1f27c0c7a39b6d0a272e33339b
7
- data.tar.gz: 128e495a8396c61c12f151d14d39f94e392f08f77b30fe165884e06eae42d4015dd1018536a256456ff3f6d57868042375fe6653528854f482bb39edcd914a90
6
+ metadata.gz: 5d7e2039ad6e6854cb2d4b1549348579b676bd0ff83689f8490b09cfd32a918a4ba6274795607879096c351c1458f41c64056dc48fad0f2b04549509001c940a
7
+ data.tar.gz: 7f0ff40f0e46d85ad589e0bd56edb11cc44e5017ee2ffd9959cca4e803d06f251650e72176c6a6a1beeff8edfb8420207147e6c1dbb5d5f123062b4b6423d42f
@@ -8,5 +8,6 @@ class Tramway::Event::EventsController < Tramway::Event::ApplicationController
8
8
  @sections = @event.sections.order(position: :asc).map { |s| ::Tramway::Event::SectionDecorator.decorate s }
9
9
  @footer = ::Tramway::Landing::BlockDecorator.decorate ::Tramway::Landing::Block.footer
10
10
  @events = ::Tramway::Event::Event.active.map { |e| ::Tramway::Event::EventDecorator.decorate e }
11
+ @people_as_features = @event.partakings.map { |p| ::Tramway::Event::PartakingFeatureDecorator.decorate p }
11
12
  end
12
13
  end
@@ -9,6 +9,7 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
9
9
  delegate :description, to: :object
10
10
  delegate :participant_form_fields, to: :object
11
11
  delegate :sections, to: :object
12
+ delegate :partakings, to: :object
12
13
  decorate_association :participants
13
14
 
14
15
  def background
@@ -1,10 +1,10 @@
1
1
  class Tramway::Event::PartakingForm < ::Tramway::Core::ApplicationForm
2
- properties :section_id, :person_id, :position
3
- associations :section, :person
2
+ properties :part_id, :part_type, :person_id, :position
3
+ associations :person, :part
4
4
 
5
5
  def initialize(object)
6
6
  super(object).tap do
7
- form_properties section: :association,
7
+ form_properties part: :polymorphic_association,
8
8
  person: :association,
9
9
  position: :string
10
10
  end
@@ -4,6 +4,7 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
4
4
  has_many :participants, class_name: 'Tramway::Event::Participant'
5
5
  has_many :participant_form_fields, class_name: 'Tramway::Event::ParticipantFormField'
6
6
  has_many :sections, class_name: 'Tramway::Event::Section'
7
+ has_many :partakings, as: :part, class_name: 'Tramway::Event::Partaking'
7
8
 
8
9
  enumerize :status, default: :common, in: [ :common, :main ]
9
10
 
@@ -1,4 +1,6 @@
1
1
  class Tramway::Event::Partaking < ::Tramway::Core::ApplicationRecord
2
- belongs_to :section, class_name: 'Tramway::Event::Section'
2
+ belongs_to :part, polymorphic: true
3
+ enumerize :part_type, in: [ 'Tramway::Event::Event', 'Tramway::Event::Section' ]
4
+
3
5
  belongs_to :person, class_name: 'Tramway::Event::Person'
4
6
  end
@@ -2,5 +2,5 @@ class Tramway::Event::Section < ::Tramway::Event::ApplicationRecord
2
2
  mount_uploader :photo, PhotoUploader
3
3
 
4
4
  belongs_to :event, class_name: 'Tramway::Event::Event'
5
- has_many :partakings, class_name: 'Tramway::Event::Partaking'
5
+ has_many :partakings, as: :part, class_name: 'Tramway::Event::Partaking'
6
6
  end
@@ -40,3 +40,4 @@
40
40
  = render 'tramway/event/sections/show_page', section: section
41
41
  - if index < sections.count - 1
42
42
  %br
43
+ = render 'tramway/landing/blocks/templates/features_list', block: OpenStruct.new(title: "Оргкомитет", description: "", anchor: :organizers), collection: people_as_features, options: { image: { css: { class_name: 'circle' } } }
@@ -6,5 +6,5 @@
6
6
  %li
7
7
  = link_to event.title, event_path(event.id)
8
8
  - content_for :body_content do
9
- = render 'tramway/event/events/show_page', event: @event, sections: @sections, sections_as_features: @sections_as_features
9
+ = render 'tramway/event/events/show_page', event: @event, sections: @sections, sections_as_features: @sections_as_features, people_as_features: @people_as_features
10
10
  = render "tramway/landing/blocks/block_types/footer", block: @footer
@@ -16,6 +16,13 @@ ru:
16
16
  tramway/event/participant:
17
17
  comment: Примечание
18
18
  event: Мероприятие
19
+ tramway/event/section:
20
+ title: Название
21
+ description: Описание
22
+ event: Мероприятие
23
+ photo: Изображение
24
+ icon: Иконка
25
+ position: Позиция на странице мероприятия
19
26
  cases:
20
27
  tramway/event/event:
21
28
  plural: мероприятия
@@ -34,7 +34,10 @@ module Tramway::Event::Generators
34
34
 
35
35
  :add_position_to_tramway_event_partakings,
36
36
  :add_state_to_tramway_event_partakings,
37
- :add_more_fields_to_tramway_event_participants
37
+ :add_more_fields_to_tramway_event_participants,
38
+
39
+ # NOTE must be removed until tramway-event 2.0
40
+ :rebuild_association_between_participant_and_partakings_to_polymorphic
38
41
  ]
39
42
  migrations.each do |migration|
40
43
  migration_template "#{migration}.rb", "db/migrate/#{migration}.rb"
@@ -0,0 +1,8 @@
1
+ # NOTE must be removed until tramway-event 2.0
2
+
3
+ class RebuildAssociationBetweenParticipantAndPartakingsToPolymorphic < ActiveRecord::Migration[5.1]
4
+ def change
5
+ rename_column :tramway_event_partakings, :section_id, :part_id
6
+ add_column :tramway_event_partakings, :part_type, :text, default: 'Tramway::Event::Section'
7
+ end
8
+ end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Event
3
- VERSION = '1.6.4'
3
+ VERSION = '1.7'
4
4
  end
5
5
  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.6.4
4
+ version: '1.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-09 00:00:00.000000000 Z
11
+ date: 2018-10-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for events
14
14
  email:
@@ -82,6 +82,7 @@ files:
82
82
  - lib/tramway/event/generators/templates/create_tramway_event_people.rb
83
83
  - lib/tramway/event/generators/templates/create_tramway_event_people_sections.rb
84
84
  - lib/tramway/event/generators/templates/create_tramway_event_sections.rb
85
+ - lib/tramway/event/generators/templates/rebuild_association_between_participant_and_partakings_to_polymorphic.rb
85
86
  - lib/tramway/event/generators/templates/rename_tramway_event_people_sections_to_tramway_event_partakings.rb
86
87
  - lib/tramway/event/version.rb
87
88
  homepage: https://github.com/ulmic/tramway-event