tramway-event 1.0.1 → 1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e06fdaa43cfd4ef68dcdb5369e6212412a5fbc68fc95d035f68325eb6cf468ee
4
- data.tar.gz: 24c0b650e98e7e3eef37ab86a680c58c27c77f8ba2518a89901d80fb7e6f6758
3
+ metadata.gz: 384dc18b6aaa234c4d0c80914b1d0226c4d93802afbbab326527ae2bfd3e3131
4
+ data.tar.gz: 273138747eab3764f22d6430fd3913ca64da20d49ba35d6cf979a466230da084
5
5
  SHA512:
6
- metadata.gz: af8d9d1da075c48caae42599b8bc260f93d87eabe2a7dea505bbba1bec68545973b3412e674cb4f2c99fa2ab88fe11376a0d060f9ab10821f35f32c91bc0f82a
7
- data.tar.gz: cf0e98feebee348ece819498dac34d69fec774459902fe7735e70f60d1ccc6c27bce66a2012b63a0737324e9355ffaa39efa3502036a3c9124e58e910ce29922
6
+ metadata.gz: 37d17fcadf7e8cfc40fc85927ba681b3d5e9bdbe4baec13c274124371582693f8a73ec3b186204556b3d0e434a40950489d8e4d5365558609eb4441aab75cf80
7
+ data.tar.gz: 60fb871a9ec3a297ad310957d68416951868ff7c5b43c28b2031091c2d4893d31f0034687bbb128c4710a41f5328e3b90b9ee412aff6789298c4995dff43d08d
@@ -1,4 +1,5 @@
1
1
  @import 'bootstrap'
2
+ @import 'tramway/core/application'
2
3
 
3
4
  body
4
5
  margin: 0
@@ -6,5 +6,6 @@ class Tramway::Event::EventsController < Tramway::Event::ApplicationController
6
6
  class_name = "ParticipantExtendedForm#{request.uuid.gsub('-', '')}"
7
7
  form_class = ::Tramway::Core::ExtendableForm.new(class_name, *@event.participant_form_fields.inputs_list.map(&:title).map(&:to_sym))
8
8
  @participant_form = form_class.new ::Tramway::Event::Participant.new
9
+ @sections = @event.sections.map { |s| ::Tramway::Event::SectionFeatureDecorator.decorate s }
9
10
  end
10
11
  end
@@ -7,6 +7,7 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
7
7
 
8
8
  delegate :title, to: :object
9
9
  delegate :participant_form_fields, to: :object
10
+ delegate :sections, to: :object
10
11
 
11
12
  def background
12
13
  object.photo
@@ -0,0 +1,7 @@
1
+ class Tramway::Event::SectionDecorator < ::Tramway::Core::ApplicationDecorator
2
+ class << self
3
+ def collections
4
+ [ :all ]
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ class ::Tramway::Event::SectionFeatureDecorator < ::Tramway::Core::ApplicationDecorator
2
+ delegate :icon, to: :object
3
+ delegate :title, to: :object
4
+ delegate :description, to: :object
5
+ alias text description
6
+
7
+ def image
8
+ object.photo.small.url
9
+ end
10
+ end
@@ -1,5 +1,6 @@
1
1
  class Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::ApplicationForm
2
- properties :title, :description, :field_type, :event, :options, :position
2
+ properties :title, :description, :field_type, :options, :position
3
+ association :event
3
4
 
4
5
  def initialize(object)
5
6
  form_object = super object
@@ -12,15 +13,11 @@ class Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::ApplicationFor
12
13
  form_object
13
14
  end
14
15
 
15
- def event=(value)
16
- super ::Tramway::Event::Event.find value
17
- end
18
-
19
16
  def options
20
- model.options.to_json
17
+ model.options&.to_json
21
18
  end
22
19
 
23
20
  def options=(value)
24
- super JSON.parse value
21
+ super value == '' ? value : JSON.parse(value)
25
22
  end
26
23
  end
@@ -0,0 +1,14 @@
1
+ class Tramway::Event::SectionForm < ::Tramway::Core::ApplicationForm
2
+ properties :event, :title, :description, :photo, :icon
3
+ association :event
4
+
5
+ def initialize(object)
6
+ super(object).tap do
7
+ form_properties title: :string,
8
+ description: :ckeditor,
9
+ event: :association,
10
+ photo: :file,
11
+ icon: :string
12
+ end
13
+ end
14
+ end
@@ -3,6 +3,8 @@ require "tramway/collection"
3
3
  module Tramway
4
4
  module Event
5
5
  module ApplicationHelper
6
+ include ::FontAwesome::Rails::IconHelper
7
+
6
8
  def collection_list_by(name:)
7
9
  require name # needed to load class name with collection
8
10
  unless ::Tramway::Collection.descendants.map(&:to_s).include?(name.camelize)
@@ -3,4 +3,5 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
3
3
 
4
4
  has_many :participants, class_name: 'Tramway::Event::Participant'
5
5
  has_many :participant_form_fields, class_name: 'Tramway::Event::ParticipantFormField'
6
+ has_many :sections, class_name: 'Tramway::Event::Section'
6
7
  end
@@ -0,0 +1,5 @@
1
+ class Tramway::Event::Section < ::Tramway::Event::ApplicationRecord
2
+ mount_uploader :photo, PhotoUploader
3
+
4
+ belongs_to :event, class_name: 'Tramway::Event::Event'
5
+ end
@@ -29,5 +29,6 @@
29
29
  или пишите на email
30
30
  = mail_to 'kalashnikov@ulmic.ru'
31
31
  = render 'tramway/landing/blocks/templates/full_page', block: @event, buttons: []
32
+ = render 'tramway/landing/blocks/templates/features_list', block: OpenStruct.new(title: "Направления IT Way'18", description: "Вы можете выбрать любое из направлений", anchor: :features), collection: @sections
32
33
  .container
33
34
  = render 'tramway/event/participants/form'
@@ -1,4 +1,5 @@
1
1
  ::Tramway::Admin.set_available_models(::Tramway::Event::Event,
2
2
  ::Tramway::Event::ParticipantFormField,
3
3
  ::Tramway::Event::Participant,
4
+ ::Tramway::Event::Section,
4
5
  project: :event)
@@ -4,6 +4,7 @@ ru:
4
4
  tramway/event/event: Мероприятие
5
5
  tramway/event/participant: Участник
6
6
  tramway/event/participant_form_field: Поле анкеты
7
+ tramway/event/section: Секция
7
8
  attributes:
8
9
  tramway/event/event:
9
10
  title: Название
@@ -17,6 +18,9 @@ ru:
17
18
  tramway/event/participant:
18
19
  plural: участники
19
20
  genitive: участника
21
+ tramway/event/section:
22
+ plural: секции
23
+ genitive: секцию
20
24
  tramway/event/participant_form_field:
21
25
  plural: поля анкеты
22
26
  genitive: поле анкеты
@@ -21,6 +21,8 @@ module Tramway::Event::Generators
21
21
  migration_template 'create_tramway_event_participants.rb', 'db/migrate/create_tramway_event_participants.rb'
22
22
  migration_template 'add_options_to_tramway_event_participant_form_fields.rb', 'db/migrate/add_options_to_tramway_event_participant_form_fields.rb'
23
23
  migration_template 'add_position_to_tramway_event_participant_form_fields.rb', 'db/migrate/add_position_to_tramway_event_participant_form_fields.rb'
24
+ migration_template 'create_tramway_event_sections.rb', 'db/migrate/create_tramway_event_sections.rb'
25
+ migration_template 'add_icon_to_tramway_event_sections.rb', 'db/migrate/add_icon_to_tramway_event_sections.rb'
24
26
  end
25
27
  end
26
28
  end
@@ -0,0 +1,5 @@
1
+ class AddIconToTramwayEventSections < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :tramway_event_sections, :icon, :text
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ class CreateTramwayEventSections < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :tramway_event_sections do |t|
4
+ t.integer :event_id
5
+ t.text :title
6
+ t.text :description
7
+ t.text :photo
8
+ t.text :state, default: :active
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Event
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1'
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.0.1
4
+ version: '1.1'
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-09-18 00:00:00.000000000 Z
11
+ date: 2018-09-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for events
14
14
  email:
@@ -31,9 +31,12 @@ files:
31
31
  - app/decorators/tramway/event/event_link_decorator.rb
32
32
  - app/decorators/tramway/event/participant_decorator.rb
33
33
  - app/decorators/tramway/event/participant_form_field_decorator.rb
34
+ - app/decorators/tramway/event/section_decorator.rb
35
+ - app/decorators/tramway/event/section_feature_decorator.rb
34
36
  - app/forms/tramway/event/event_form.rb
35
37
  - app/forms/tramway/event/participant_form.rb
36
38
  - app/forms/tramway/event/participant_form_field_form.rb
39
+ - app/forms/tramway/event/section_form.rb
37
40
  - app/helpers/tramway/event/application_helper.rb
38
41
  - app/jobs/tramway/event/application_job.rb
39
42
  - app/mailers/tramway/event/application_mailer.rb
@@ -41,6 +44,7 @@ files:
41
44
  - app/models/tramway/event/event.rb
42
45
  - app/models/tramway/event/participant.rb
43
46
  - app/models/tramway/event/participant_form_field.rb
47
+ - app/models/tramway/event/section.rb
44
48
  - app/views/tramway/event/events/show.html.haml
45
49
  - app/views/tramway/event/participants/_form.html.haml
46
50
  - config/initializers/assets.rb
@@ -52,12 +56,14 @@ files:
52
56
  - lib/tramway/event.rb
53
57
  - lib/tramway/event/engine.rb
54
58
  - lib/tramway/event/generators/install_generator.rb
59
+ - lib/tramway/event/generators/templates/add_icon_to_tramway_event_sections.rb
55
60
  - lib/tramway/event/generators/templates/add_options_to_tramway_event_participant_form_fields.rb
56
61
  - lib/tramway/event/generators/templates/add_photo_to_tramway_event_events.rb
57
62
  - lib/tramway/event/generators/templates/add_position_to_tramway_event_participant_form_fields.rb
58
63
  - lib/tramway/event/generators/templates/create_tramway_event_events.rb
59
64
  - lib/tramway/event/generators/templates/create_tramway_event_participant_form_fields.rb
60
65
  - lib/tramway/event/generators/templates/create_tramway_event_participants.rb
66
+ - lib/tramway/event/generators/templates/create_tramway_event_sections.rb
61
67
  - lib/tramway/event/version.rb
62
68
  homepage: https://github.com/ulmic/tramway-event
63
69
  licenses: