tramway-event 1.9.28.3 → 1.9.31.1

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: 96668739e33f5f171c0a8f25c402c6da617358ae0f401689679bc980ddeafd9d
4
- data.tar.gz: 60c9422d93e2c807e785b53f871189283dc0b606f4addd7145b9ea8006b06777
3
+ metadata.gz: eca92e584773c5effe967dedf5295b6e72760305c3d1abc02a6a8ab1f028b59b
4
+ data.tar.gz: '09dc9dd27d0faa05002dbaa131cdbe3728c2ef4fc46163090f59368561600c43'
5
5
  SHA512:
6
- metadata.gz: fbb32905515b7655f003a93692a252f12bd5576d7e78d1646ef674ce5e8bf858d9c5926fca333a288431ef78f29ecbcd540f999e92ccd68a97dea9910420beaf
7
- data.tar.gz: 6b3c8e650dd39976a9a153767c4ba46c013bce0300409bc5298dc2165b18b133be4d81d4babcb21dfa39562e38979fc0727c96d88b5b68d7a55c51083e64c70d
6
+ metadata.gz: 5e7b456fab796106a23288b814e0f9fa26046155bcea94f0cb773a5e9d88950bdc01736728313c5cb106a35e9ad122a61f7f07ea66ab7fdb392175836ec4565b
7
+ data.tar.gz: 6482ca0c495535133d2c6e3467572089ff14e86357ccddff6ad83beeadda66882fac8742b4f0460d3e1a371ff4550ba759a14bdb84e2aaec1978f7376c851375
data/README.md CHANGED
@@ -12,6 +12,7 @@ How to use my plugin.
12
12
  gem 'tramway-event'
13
13
  gem 'carrierwave'
14
14
  gem 'more_html_tags'
15
+ gem 'configus'
15
16
  ```
16
17
 
17
18
  #### 2. And then execute:
@@ -48,6 +49,21 @@ Tramway::Admin.set_available_models ::Tramway::Event::Event, ::Tramway::Event::P
48
49
  mount Tramway::Event::Engine, at: '/'
49
50
  ```
50
51
 
52
+ #### 7. Add hosts in your environments via gem `configus`. [What is configus?](https://github.com/kaize/configus)
53
+
54
+ *config/configus.rb*
55
+ ```ruby
56
+ Configus.build Rails.env do
57
+ env :production do
58
+ host 'https://your-site-domain.com'
59
+ end
60
+ env :development do
61
+ host 'http://localhost:3000'
62
+ end
63
+ env :test, parent: :development
64
+ end
65
+ ```
66
+
51
67
  ## How-to
52
68
 
53
69
  ### Create event
@@ -75,7 +75,7 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
75
75
 
76
76
  def events_link
77
77
  event_link = Tramway::Event::Engine.routes.url_helpers.event_path object
78
- event_url = ['http://molodoy.online', event_link].join
78
+ event_url = [configus.host, event_link].join
79
79
  content_tag(:pre) do
80
80
  id = "event#{object.id}"
81
81
  concat link_to event_url, event_url, id: id
@@ -47,4 +47,11 @@ class Tramway::Event::Events::Show::EventDecorator < ::Tramway::Core::Applicatio
47
47
  end
48
48
 
49
49
  alias tagline duration
50
+
51
+ def responsible_person
52
+ {
53
+ phone: (object.creator.phone if object.creator&.phone&.present?),
54
+ email: (object.creator.email if object.creator&.email&.present?)
55
+ }
56
+ end
50
57
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Tramway::Event::ParticipantXlsxDecorator < Tramway::Export::Xlsx::ApplicationDecorator
3
+ class Tramway::Event::ParticipantXlsDecorator < Tramway::Export::Xls::ApplicationDecorator
4
4
  class << self
5
5
  def columns
6
6
  %i[full_name email phone organization event].map do |attribute|
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::ExtendedApplicationForm
4
- properties :title, :description, :field_type, :options, :position, :list_field
4
+ properties :title, :description, :field_type, :options, :position, :list_field, :presence_field
5
5
  association :event
6
6
 
7
7
  def initialize(object)
@@ -12,6 +12,7 @@ class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::Extende
12
12
  field_type: :default,
13
13
  options: :text,
14
14
  list_field: :boolean,
15
+ presence_field: :boolean,
15
16
  position: :numeric
16
17
  end
17
18
  end
@@ -20,6 +21,7 @@ class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::Extende
20
21
  super(params).tap do
21
22
  model.options = {} if model.options == ''
22
23
  model.options&.merge! list_field: (params[:list_field] == '1').to_s
24
+ model.options&.deep_merge! validations: { presence: (params[:presence_field] == '1').to_s }
23
25
  model.save
24
26
  end
25
27
  end
@@ -28,6 +30,10 @@ class Admin::Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::Extende
28
30
  model.options&.dig('list_field') == 'true'
29
31
  end
30
32
 
33
+ def presence_field
34
+ model.options&.dig('validations', 'presence') == 'true'
35
+ end
36
+
31
37
  def options
32
38
  model.options&.to_json
33
39
  end
@@ -6,4 +6,8 @@ class Tramway::Event::ParticipantFormField < ::Tramway::Event::ApplicationRecord
6
6
  enumerize :field_type, in: %i[text string numeric date_picker select], default: :text
7
7
 
8
8
  scope :inputs_list, -> { active.order(position: :asc) }
9
+
10
+ def required
11
+ options&.dig('validations', 'presence') == 'true'
12
+ end
9
13
  end
@@ -7,9 +7,9 @@
7
7
  %hr/
8
8
  %p.mb-0
9
9
  По всем вопросам обращайтесь по телефону
10
- = tel_tag @application.phone
10
+ = tel_tag @event.responsible_person[:phone] || @application.phone
11
11
  или пишите на email
12
- = mail_to @application.email
12
+ = mail_to @event.responsible_person[:email] || @application.email
13
13
  - if params[:flash] == 'error'
14
14
  .alert.alert-danger{ role: "alert" }
15
15
  %button.close{"aria-label" => "Close", "data-dismiss" => "alert", type: "button"}
@@ -19,9 +19,9 @@
19
19
  %hr/
20
20
  %p.mb-0
21
21
  Если ошибка повторяется или не отображается, обращайтесь по телефону
22
- = tel_tag @application.phone
22
+ = tel_tag @event.responsible_person[:phone] || @application.phone
23
23
  или пишите на email
24
- = mail_to @application.email
24
+ = mail_to @event.responsible_person[:email] || @application.email
25
25
  - if request.path == ::Tramway::Event::Engine.routes.url_helpers.event_path(event.id)
26
26
  = render 'tramway/landing/blocks/templates/full_page', block: event, buttons: [OpenStruct.new(title: t('.registration'), anchor: '#registration')]
27
27
  - content_for :main_image do
@@ -69,10 +69,17 @@ ru:
69
69
  options: Параметры (не редактировать без надобности)
70
70
  title: Название (в Tramway название Поля анкеты - это ключ для выборки пользователей. Если вы измените ключ к выборке пользователей, то все пользователи, получившие данные по предыдущему ключу по этой выборке показываться не будут)
71
71
  list_field: Показывать это поле в общем списке участников?
72
+ presence_field: Обязательное поле
72
73
  tramway/event/partaking:
73
74
  part_name: Мероприятие
74
75
  event_duration: Дата мероприятия
75
76
  part_description: Описание
77
+ errors:
78
+ models:
79
+ tramway/event/participant:
80
+ attributes:
81
+ default:
82
+ presence: не может быть пустым
76
83
  cases:
77
84
  tramway/event/event:
78
85
  plural: мероприятия
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Event
5
- VERSION = '1.9.28.3'
5
+ VERSION = '1.9.31.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-event
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.28.3
4
+ version: 1.9.31.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: 2020-02-12 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2020-02-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: configus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: Rails engine for events
14
28
  email:
15
29
  - kalashnikovisme@gmail.com
@@ -35,7 +49,7 @@ files:
35
49
  - app/decorators/tramway/event/partaking_feature_decorator.rb
36
50
  - app/decorators/tramway/event/participant_decorator.rb
37
51
  - app/decorators/tramway/event/participant_form_field_decorator.rb
38
- - app/decorators/tramway/event/participant_xlsx_decorator.rb
52
+ - app/decorators/tramway/event/participant_xls_decorator.rb
39
53
  - app/decorators/tramway/event/person_decorator.rb
40
54
  - app/decorators/tramway/event/place_decorator.rb
41
55
  - app/decorators/tramway/event/section_decorator.rb