tramway-event 1.8.10 → 1.9

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: 9d0adbec3f4557fb5425681c1cffb056109f570b52fe509cb00ac34e145609c6
4
- data.tar.gz: 39496020cc747f886ad3523622a5c2b88cd6b2e389c973663b5ff072b2e15ec4
3
+ metadata.gz: 33005b2651369b99ef16b07e17d5d997b0e171c6bd0011a81bde611039ec478c
4
+ data.tar.gz: 0144eafb3f6265b0d536c6080f05e338423c0958b66ceaa5db04aea643ac8d40
5
5
  SHA512:
6
- metadata.gz: b8d22de331a0e8d4675b6cd5c067cef25c9c0aba6dd167f7d9b58e68b5ff6922402b18bd111e3f3f6ed796fceb95c86582b6a6106cb8e19306b3d6229a81f3e2
7
- data.tar.gz: 77034da5f129f7e0f4cb86d4db9a674d74b76a17c68346683f6d276d918ed90ce5c60e7537e4a221e560faa0e836c11fe6c82815d6cb7992fd78da737f952dc2
6
+ metadata.gz: 0fb2bf375991bc12b8dcf08c3bd44142d6f0e52a923e591376ce6ae16cdbd3657baeb837b69b04b61036c96499431704c5a147c26a71dc353196fa1a001b57c6
7
+ data.tar.gz: 440445b2629e5127a44731c60980c0eb1094480b59995d7b178073efe7b206a5d3cfe1bdc6132e27812ae182afc53ff9cbdc649b23e4b6e8ac2e46544a5e13d0
@@ -2,12 +2,18 @@ class Tramway::Event::EventsController < Tramway::Event::ApplicationController
2
2
  layout 'tramway/landing/application'
3
3
 
4
4
  def show
5
- @event = ::Tramway::Event::Events::Show::EventDecorator.decorate ::Tramway::Event::Event.find params[:id]
5
+ event = ::Tramway::Event::Event.find params[:id]
6
+ @event = ::Tramway::Event::Events::Show::EventDecorator.decorate event
6
7
  @participant_form = ::Tramway::Event::ParticipantExtendedFormCreator.create_form_class(request.uuid, @event).new ::Tramway::Event::Participant.new
7
8
  @sections_as_features = @event.sections.active.order(position: :asc).map { |s| ::Tramway::Event::SectionFeatureDecorator.decorate s }
8
9
  @sections = @event.sections.active.order(position: :asc).map { |s| ::Tramway::Event::SectionDecorator.decorate s }
9
10
  @footer = ::Tramway::Landing::BlockDecorator.decorate ::Tramway::Landing::Block.footer
10
11
  @events = ::Tramway::Event::Event.active.actual.map { |e| ::Tramway::Event::Events::Show::EventDecorator.decorate e }
11
12
  @people_as_features = @event.partakings.active.map { |p| ::Tramway::Event::PartakingFeatureDecorator.decorate p }
13
+ @partners = ::Tramway::Partner::Partnership.partnership_type.values.reduce({}) do |hash, partnership_type|
14
+ hash.merge! partnership_type => (event.send(partnership_type.to_s.pluralize).map do |partner|
15
+ Tramway::Partner::OrganizationFeatureDecorator.decorate partner
16
+ end)
17
+ end
12
18
  end
13
19
  end
@@ -12,6 +12,10 @@ class Tramway::Event::Events::Show::EventDecorator < ::Tramway::Core::Applicatio
12
12
  delegate :partakings, to: :object
13
13
  delegate :request_collecting_state, to: :object
14
14
 
15
+ ::Tramway::Partner::Partnership.partnership_type.values.each do |partnership_type|
16
+ decorate_association partnership_type.to_s.pluralize
17
+ end
18
+
15
19
  def background
16
20
  object.photo
17
21
  end
@@ -1,4 +1,4 @@
1
- class ::Tramway::Event::SectionFeatureDecorator < ::Tramway::Core::ApplicationDecorator
1
+ class ::Tramway::Event::SectionFeatureDecorator < ::Tramway::Landing::BlockTypes::FeaturesDecorator
2
2
  delegate :icon, to: :object
3
3
  delegate :title, to: :object
4
4
  delegate :description, to: :object
@@ -5,17 +5,26 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
5
5
  has_many :participant_form_fields, class_name: 'Tramway::Event::ParticipantFormField'
6
6
  has_many :sections, class_name: 'Tramway::Event::Section'
7
7
  has_many :partakings, as: :part, class_name: 'Tramway::Event::Partaking'
8
+ has_many :partnerships, class_name: 'Tramway::Partner::Partnership', as: :partner
9
+ has_many :organizations, as: :partners, through: :partnerships, class_name: 'Tramway::Partner::Organization'
10
+
11
+ ::Tramway::Partner::Partnership.partnership_type.values.each do |partnership_type|
12
+ has_many partnership_type.pluralize.to_sym, (-> do
13
+ joins(:partnerships).where 'tramway_partner_partnerships.partnership_type = ?', partnership_type
14
+ end), foreign_key: :organization_id, source: :organization, through: :partnerships, class_name: 'Tramway::Partner::Organization'
15
+ end
8
16
 
9
17
  enumerize :status, default: :common, in: [ :common, :main ]
10
18
 
11
19
  scope :main_event, -> { where(status: :main) }
12
20
  scope :actual, -> { where 'end_date > ?', DateTime.now }
13
21
  scope :past, -> { where 'end_date < ?', DateTime.now }
14
-
22
+
15
23
  def request_collecting_state
16
24
  return :not_initialized unless request_collecting_begin_date.present? || request_collecting_end_date.present?
17
25
  return :will_begin_soon if request_collecting_begin_date > DateTime.now
18
26
  return :is_over if request_collecting_end_date < DateTime.now
19
27
  return :are_being_right_now if request_collecting_begin_date&.past? && request_collecting_end_date&.future?
20
28
  end
29
+
21
30
  end
@@ -27,7 +27,6 @@
27
27
  = render 'tramway/landing/blocks/templates/full_page', block: event, buttons: [OpenStruct.new(title: t('.registration'), anchor: '#registration')]
28
28
  %main
29
29
  .container
30
- -#= render 'tramway/landing/blocks/templates/features_list', block: OpenStruct.new(title: "Направления IT Way'18", description: "Вы можете выбрать любое из направлений", anchor: :features), collection: sections_as_features
31
30
  = render 'tramway/landing/blocks/templates/features_list', collection: sections_as_features
32
31
  %br
33
32
  .row
@@ -42,3 +41,5 @@
42
41
  - if index < sections.count - 1
43
42
  %br
44
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' } } }
44
+ - ::Tramway::Partner::Partnership.partnership_type.values.each do |partnership_type|
45
+ = render 'tramway/landing/blocks/templates/features_list', block: OpenStruct.new(title: t("enumerize.tramway/partner/partnership.partnership_type.#{partnership_type}")), collection: partners[partnership_type]
@@ -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, people_as_features: @people_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, partners: @partners
10
10
  = render "tramway/landing/blocks/block_types/footer", block: @footer
@@ -7,6 +7,7 @@ module Tramway::Event::Generators
7
7
  source_root File.expand_path('../templates', __FILE__)
8
8
 
9
9
  def run_other_generators
10
+ generate 'tramway:partner:install'
10
11
  end
11
12
 
12
13
  def self.next_migration_number(path)
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Event
3
- VERSION = '1.8.10'
3
+ VERSION = '1.9'
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.8.10
4
+ version: '1.9'
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-12-19 00:00:00.000000000 Z
11
+ date: 2018-12-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for events
14
14
  email: