tramway-event 1.9.24 → 1.9.27

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: b5958b4032cf120b5f9d0f7cf4ebe18f17ec2ebb44cc2ec71dc6b1d51b7454d6
4
- data.tar.gz: 2c5a343cb390eaee3c3cee050d1fa2d89b028facb49c1e512a312d90ff4f79b9
3
+ metadata.gz: 254c506135da94272d3b29c64e8433408899887d076f9ddf90c500575fce39bc
4
+ data.tar.gz: ccf6e8f67d7305b19d57c262a7375d7f6cee0c7a22e8f38a2f9040ff67dceff5
5
5
  SHA512:
6
- metadata.gz: c5c7549fe496068b3a0952e97ff938894e35378af15e8968495b925a11e65d586a8784235a38170a72fb11f8ad09864678a8574643ba8d4ea87715617992e67a
7
- data.tar.gz: 9c8578d4c7b5eecaf097e08a3653a85eb38688346f569209c8280e28de389ad5048936963b12a34ff5d397fdb7677d6a120f0d4051299ec07126dab3ca1b9eaa
6
+ metadata.gz: 5511a2b01b04e1fcc82970f02eb620f94f3cdade6679841846400597b2647c6a61dde2fd5a3299b7da5e640d1c74bed105085dd48789efd87caee00c50a77d36
7
+ data.tar.gz: a5d4093e097bbf6c56a37e6151f7723ae4bf83d907f35313df0794208c2452038fa462ecb436ba5b7e3859546c0ba1e9d6137fc37d40a4949ca5f6a18285ceef
@@ -0,0 +1,8 @@
1
+ //= require tramway/core/application
2
+ //= require_tree .
3
+ //= require clipboard
4
+
5
+ $(document).ready(function(){
6
+
7
+ var clipboard = new Clipboard('.clipboard-btn');
8
+ });
@@ -1,4 +1,2 @@
1
1
  //= require tramway/core/application
2
- //= require_tree .
3
-
4
- window.current_locale = window.i18n_locale('ru');
2
+ //= require_tree .
@@ -10,6 +10,7 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
10
10
  %i[
11
11
  title
12
12
  duration
13
+ events_link
13
14
  state
14
15
  created_at
15
16
  photo
@@ -19,15 +20,19 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
19
20
  ]
20
21
  end
21
22
 
23
+ def show_associations
24
+ %i[participant_form_fields]
25
+ end
26
+
22
27
  def list_attributes
23
- %i[requested_participants approved_participants]
28
+ %i[requested_participants approved_participants events_link]
24
29
  end
25
30
  end
26
31
 
27
32
  delegate :title, to: :object
28
33
  delegate :status, to: :object
29
34
  decorate_association :participants
30
- decorate_association :participant_form_fields
35
+ decorate_association :participant_form_fields, as: :event
31
36
  decorate_association :sections
32
37
  decorate_association :partakings
33
38
  decorate_association :partnerships
@@ -56,6 +61,8 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
56
61
  end
57
62
 
58
63
  def duration(begin_date: object.begin_date, end_date: object.end_date)
64
+ return unless begin_date.present? || end_date.present?
65
+
59
66
  if begin_date.to_date == end_date.to_date
60
67
  I18n.l(begin_date, format: '%d %B %Y').to_s
61
68
  elsif begin_date.month == end_date.month
@@ -65,6 +72,16 @@ class Tramway::Event::EventDecorator < ::Tramway::Core::ApplicationDecorator
65
72
  end
66
73
  end
67
74
 
75
+ def events_link
76
+ event_link = Tramway::Event::Engine.routes.url_helpers.event_path object
77
+ event_url = ['molodoy.online', event_link].join
78
+ content_tag(:div) do
79
+ id = "event#{object.id}"
80
+ concat link_to event_url, event_url, id: id
81
+ concat copy_to_clipboard id
82
+ end
83
+ end
84
+
68
85
  def request_collecting_duration
69
86
  return if object.request_collecting_begin_date.nil? || object.request_collecting_end_date.nil?
70
87
 
@@ -25,6 +25,8 @@ class Tramway::Event::Events::Show::EventDecorator < ::Tramway::Core::Applicatio
25
25
  end
26
26
 
27
27
  def duration
28
+ return unless object.begin_date.present? || object.end_date.present?
29
+
28
30
  if object.begin_date.to_date == object.end_date.to_date
29
31
  I18n.l(object.begin_date, format: '%d %B %Y').to_s
30
32
  elsif object.begin_date.month == object.end_date.month
@@ -3,7 +3,7 @@
3
3
  require 'securerandom'
4
4
 
5
5
  class Tramway::Event::ParticipantForm < ::Tramway::Core::ApplicationForm
6
- properties :participation_state, :comment
6
+ properties :participation_state_event, :comment
7
7
  association :event
8
8
 
9
9
  def self.new(object)
@@ -12,7 +12,7 @@ class Tramway::Event::ParticipantForm < ::Tramway::Core::ApplicationForm
12
12
  SecureRandom.hex,
13
13
  object.event,
14
14
  comment: :string,
15
- participation_state: :string
15
+ participation_state_event: :string
16
16
  ).new object
17
17
  else
18
18
  super(object).tap do |obj|
@@ -1,20 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::ApplicationForm
4
- properties :title, :description, :field_type, :options, :position
3
+ class Tramway::Event::ParticipantFormFieldForm < ::Tramway::Core::ExtendedApplicationForm
4
+ properties :title, :description, :field_type, :options, :position, :list_field
5
5
  association :event
6
6
 
7
7
  def initialize(object)
8
8
  super(object).tap do
9
9
  form_properties event: :association,
10
- title: :string,
11
- description: :string,
12
- field_type: :default,
13
- options: :text,
14
- position: :numeric
10
+ title: :string,
11
+ description: :string,
12
+ field_type: :default,
13
+ options: :text,
14
+ list_field: :boolean,
15
+ position: :numeric
15
16
  end
16
17
  end
17
18
 
19
+ def submit(params)
20
+ super(params).tap do
21
+ model.options&.merge! list_field: (params[:list_field] == '1').to_s
22
+ model.save
23
+ end
24
+ end
25
+
26
+ def list_field
27
+ model.options&.dig('list_field') == 'true'
28
+ end
29
+
18
30
  def options
19
31
  model.options&.to_json
20
32
  end
@@ -20,8 +20,9 @@ class Tramway::Event::Event < ::Tramway::Event::ApplicationRecord
20
20
  def request_collecting_state
21
21
  return :not_initialized unless request_collecting_begin_date.present? || request_collecting_end_date.present?
22
22
  return :will_begin_soon if request_collecting_begin_date > DateTime.now
23
- return :is_over if request_collecting_end_date < DateTime.now
23
+ return :is_over if request_collecting_end_date.present? && request_collecting_end_date < DateTime.now
24
24
  return :are_being_right_now if request_collecting_begin_date&.past? && request_collecting_end_date&.future?
25
+ return :are_being_right_now if request_collecting_begin_date < DateTime.now && !request_collecting_end_date.present?
25
26
  end
26
27
 
27
28
  include ::Tramway::Partner::Scopes if defined? ::Tramway::Partner
@@ -8,6 +8,6 @@
8
8
  ::Tramway::Event::Partaking,
9
9
  ::Tramway::Event::Place,
10
10
  project: :event)
11
- ::Tramway::Admin.set_notificable_queries new_participants: -> (current_user) do
11
+ ::Tramway::Admin.set_notificable_queries new_participants: lambda { |current_user|
12
12
  ::Tramway::Event::Participant.active.where(participation_state: :requested).send "#{current_user.role}_scope", current_user.id
13
- end
13
+ }
@@ -20,6 +20,7 @@ ru:
20
20
  tramway/event/place: Место
21
21
  attributes:
22
22
  tramway/event/event:
23
+ events_link: Ссылка на мероприятие
23
24
  title: Название
24
25
  name: Название
25
26
  description: Описание
@@ -36,6 +37,7 @@ ru:
36
37
  not_yet_held: мероприятие ещё не проведено
37
38
  participants_list: Список участников
38
39
  does_not_have_end_date: мероприятие не имеет даты окончания
40
+ participant_form_fields: Поле анкеты
39
41
  tramway/event/participant:
40
42
  name: Имя
41
43
  list_fields: Данные
@@ -48,6 +50,7 @@ ru:
48
50
  participation_state: Статус участника
49
51
  event: Мероприятие
50
52
  values: Данные
53
+ participation_state_event: Статус участия в мероприятии
51
54
  tramway/event/section:
52
55
  title: Название
53
56
  description: Описание
@@ -62,8 +65,9 @@ ru:
62
65
  description: Описание
63
66
  field_type: Тип поля
64
67
  position: Позиция в анкете
65
- options: Параметры
68
+ options: Параметры (не редактировать без надобности)
66
69
  title: Название (в Tramway название Поля анкеты - это ключ для выборки пользователей. Если вы измените ключ к выборке пользователей, то все пользователи, получившие данные по предыдущему ключу по этой выборке показываться не будут)
70
+ list_field: Показывать это поле в общем списке участников?
67
71
  tramway/event/partaking:
68
72
  part_name: Мероприятие
69
73
  event_duration: Дата мероприятия
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Event
5
- VERSION = '1.9.24'
5
+ VERSION = '1.9.27'
6
6
  end
7
7
  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.9.24
4
+ version: 1.9.27
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-01-23 00:00:00.000000000 Z
11
+ date: 2020-01-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for events
14
14
  email:
@@ -21,6 +21,7 @@ files:
21
21
  - README.md
22
22
  - Rakefile
23
23
  - app/assets/config/tramway_event_manifest.js
24
+ - app/assets/javascripts/application.js
24
25
  - app/assets/javascripts/tramway/event/application.js
25
26
  - app/assets/stylesheets/tramway/event/application.css.sass
26
27
  - app/assets/stylesheets/tramway/event/events/show.css.sass