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 +4 -4
- data/app/controllers/tramway/event/events_controller.rb +7 -1
- data/app/decorators/tramway/event/events/show/event_decorator.rb +4 -0
- data/app/decorators/tramway/event/section_feature_decorator.rb +1 -1
- data/app/models/tramway/event/event.rb +10 -1
- data/app/views/tramway/event/events/_show_page.html.haml +2 -1
- data/app/views/tramway/event/events/show.html.haml +1 -1
- data/lib/tramway/event/generators/install_generator.rb +1 -0
- data/lib/tramway/event/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33005b2651369b99ef16b07e17d5d997b0e171c6bd0011a81bde611039ec478c
|
4
|
+
data.tar.gz: 0144eafb3f6265b0d536c6080f05e338423c0958b66ceaa5db04aea643ac8d40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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::
|
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
|
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.
|
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-
|
11
|
+
date: 2018-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rails engine for events
|
14
14
|
email:
|