decidim-conferences 0.24.3 → 0.25.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/conferences/conference_m_cell.rb +1 -1
  3. data/app/cells/decidim/conferences/conference_speaker/show.erb +2 -2
  4. data/app/cells/decidim/conferences/conference_speaker_cell.rb +3 -3
  5. data/app/cells/decidim/conferences/content_blocks/highlighted_conferences/show.erb +1 -1
  6. data/app/cells/decidim/conferences/partner_cell.rb +2 -2
  7. data/app/commands/decidim/conferences/admin/copy_conference.rb +9 -2
  8. data/app/commands/decidim/conferences/admin/create_conference_speaker.rb +4 -2
  9. data/app/commands/decidim/conferences/admin/update_conference.rb +5 -10
  10. data/app/commands/decidim/conferences/admin/update_conference_speaker.rb +5 -9
  11. data/app/commands/decidim/conferences/admin/update_diploma.rb +2 -2
  12. data/app/commands/decidim/conferences/admin/update_partner.rb +5 -5
  13. data/app/controllers/decidim/conferences/admin/conference_invites_controller.rb +0 -2
  14. data/app/controllers/decidim/conferences/admin/conference_registrations_controller.rb +0 -2
  15. data/app/controllers/decidim/conferences/admin/conference_speakers_controller.rb +3 -3
  16. data/app/controllers/decidim/conferences/admin/conferences_controller.rb +1 -5
  17. data/app/controllers/decidim/conferences/admin/diplomas_controller.rb +2 -4
  18. data/app/forms/decidim/conferences/admin/conference_form.rb +2 -2
  19. data/app/forms/decidim/conferences/admin/conference_speaker_form.rb +1 -1
  20. data/app/forms/decidim/conferences/admin/partner_form.rb +2 -2
  21. data/app/models/decidim/conference.rb +8 -8
  22. data/app/models/decidim/conference_speaker.rb +2 -2
  23. data/app/models/decidim/conferences/partner.rb +2 -2
  24. data/app/packs/entrypoints/decidim_conferences_admin.js +7 -0
  25. data/app/{assets/images/decidim/conferences/conference.svg → packs/images/decidim/conferences/decidim_conferences.svg} +0 -0
  26. data/app/{assets/javascripts/decidim/conferences/admin/conference_invite_form.es6 → packs/src/decidim/conferences/admin/conference_invite_form.js} +3 -3
  27. data/app/{assets/javascripts/decidim/conferences/admin/conference_speakers.js.es6 → packs/src/decidim/conferences/admin/conference_speakers.js} +3 -3
  28. data/app/packs/src/decidim/conferences/admin/conferences.js +27 -0
  29. data/app/{assets/stylesheet → packs/stylesheets}/decidim/conferences/conferences.scss +0 -0
  30. data/app/presenters/decidim/conferences/conference_stats_presenter.rb +8 -22
  31. data/app/queries/decidim/conferences/admin/admin_users.rb +24 -11
  32. data/app/uploaders/decidim/conferences/diploma_uploader.rb +4 -2
  33. data/app/uploaders/decidim/conferences/partner_logo_uploader.rb +5 -5
  34. data/app/uploaders/decidim/cw/conferences/diploma_uploader.rb +14 -0
  35. data/app/uploaders/decidim/cw/conferences/partner_logo_uploader.rb +15 -0
  36. data/app/views/decidim/conferences/admin/conference_copies/_form.html.erb +1 -1
  37. data/app/views/decidim/conferences/admin/conference_invites/_form.html.erb +1 -1
  38. data/app/views/decidim/conferences/admin/conference_speakers/_form.html.erb +1 -1
  39. data/app/views/decidim/conferences/admin/conference_speakers/edit.html.erb +1 -1
  40. data/app/views/decidim/conferences/admin/conferences/_form.html.erb +1 -3
  41. data/app/views/decidim/conferences/admin/invite_join_conference_mailer/invite.html.erb +4 -4
  42. data/app/views/decidim/conferences/admin/partners/index.html.erb +1 -1
  43. data/app/views/decidim/conferences/admin/send_conference_diploma_mailer/diploma_user.html.erb +2 -2
  44. data/app/views/decidim/conferences/conference_program/_program_meeting.html.erb +5 -5
  45. data/app/views/decidim/conferences/conference_registration_mailer/confirmation.html.erb +3 -3
  46. data/app/views/decidim/conferences/conference_registration_mailer/pending_validation.html.erb +3 -3
  47. data/app/views/decidim/conferences/conferences/_promoted_conference.html.erb +1 -1
  48. data/app/views/decidim/conferences/conferences/show.html.erb +2 -3
  49. data/app/views/devise/mailer/join_conference.html.erb +5 -5
  50. data/app/views/layouts/decidim/_conference_hero.html.erb +1 -1
  51. data/app/views/layouts/decidim/admin/conference.html.erb +4 -106
  52. data/app/views/layouts/decidim/conference.html.erb +2 -2
  53. data/app/views/layouts/decidim/diploma.html.erb +1 -1
  54. data/config/assets.rb +9 -0
  55. data/config/locales/ar.yml +0 -18
  56. data/config/locales/ca.yml +4 -18
  57. data/config/locales/cs.yml +4 -18
  58. data/config/locales/de.yml +4 -18
  59. data/config/locales/el.yml +0 -18
  60. data/config/locales/en.yml +4 -18
  61. data/config/locales/es-MX.yml +4 -18
  62. data/config/locales/es-PY.yml +4 -18
  63. data/config/locales/es.yml +4 -18
  64. data/config/locales/eu.yml +0 -18
  65. data/config/locales/fi-plain.yml +4 -18
  66. data/config/locales/fi.yml +4 -18
  67. data/config/locales/fr-CA.yml +1 -18
  68. data/config/locales/fr-LU.yml +577 -0
  69. data/config/locales/fr.yml +1 -18
  70. data/config/locales/gl.yml +4 -18
  71. data/config/locales/hu.yml +0 -18
  72. data/config/locales/id-ID.yml +0 -18
  73. data/config/locales/it.yml +49 -18
  74. data/config/locales/ja.yml +43 -18
  75. data/config/locales/lb-LU.yml +1 -0
  76. data/config/locales/lv.yml +0 -17
  77. data/config/locales/nl.yml +4 -18
  78. data/config/locales/no.yml +0 -18
  79. data/config/locales/pl.yml +23 -23
  80. data/config/locales/pt-BR.yml +59 -18
  81. data/config/locales/pt.yml +0 -18
  82. data/config/locales/ro-RO.yml +24 -18
  83. data/config/locales/sk.yml +0 -18
  84. data/config/locales/sl.yml +0 -2
  85. data/config/locales/sv.yml +2 -17
  86. data/config/locales/tr-TR.yml +0 -18
  87. data/config/locales/zh-CN.yml +0 -18
  88. data/db/migrate/20210408204953_allow_null_logo_column_in_decidim_conferences_partners_table.rb +7 -0
  89. data/lib/decidim/api/conference_partner_type.rb +4 -0
  90. data/lib/decidim/api/conference_speaker_type.rb +4 -0
  91. data/lib/decidim/api/conference_type.rb +9 -1
  92. data/lib/decidim/conferences/admin_engine.rb +138 -8
  93. data/lib/decidim/conferences/engine.rb +6 -9
  94. data/lib/decidim/conferences/participatory_space.rb +40 -7
  95. data/lib/decidim/conferences/version.rb +1 -1
  96. metadata +26 -24
  97. data/app/assets/config/admin/decidim_conferences_manifest.js +0 -3
  98. data/app/assets/config/decidim_conferences_manifest.js +0 -2
  99. data/app/assets/javascripts/decidim/conferences/admin/conferences.js.es6 +0 -30
  100. data/app/assets/javascripts/decidim/conferences/conferences.js.es6 +0 -0
  101. data/app/views/decidim/conferences/conferences/_statistics.html.erb +0 -10
  102. data/config/locales/ja-JP.yml +0 -575
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52bc4e0c26ddf75a681b0bb366e8a4c73aa73f65ce09f695360df54e72b08442
4
- data.tar.gz: 716b357dc0c52c4758ddec7c5e6d375841294510cd1ca8745829f560ed23512f
3
+ metadata.gz: ee1804c9f6703c0cb245a2dae893c5c1bb631d70932cb7d9143822f37a9cc4aa
4
+ data.tar.gz: 88107bfa43fd1dc97572d16b4e6dcacdd04c72211ce8aa38880509298b123a05
5
5
  SHA512:
6
- metadata.gz: e5c276d6086e5e4904385b79217a7ce0cee89a45c36cb756ac261b7c4dfa2262a74b1fd1efd6711bd8e14c458854dfe94b0de683cb95d4eb2812257d41bce279
7
- data.tar.gz: a3afd154a79137fdabbe0cb2d55a230611a25df81ed424ee89bfb437804ac048490f4c419cce482ef9e3a35a02e4067185075bbf588a25a8a9cafdef2fdcae0d
6
+ metadata.gz: 9968aa877a530ae392f63f4c5364fc1d1a121763a4bd9030ad3b27b315f08c9c5a7df3e9926a7b293c1f6254d5a846e921ae3d402bfdbe4956bd01482f76fe7a
7
+ data.tar.gz: 50a5346c96ba2d2a1f2516ae46d26750ea1157a3aec498faefbd249b7c38f6c9dccb21c68aa8d62fdbb2cd2e32ebeab5d03065003c62e7a1b7b9578dfce7a40a
@@ -27,7 +27,7 @@ module Decidim
27
27
  end
28
28
 
29
29
  def resource_image_path
30
- model.hero_image.url
30
+ model.attached_uploader(:hero_image).path
31
31
  end
32
32
 
33
33
  def statuses
@@ -1,7 +1,7 @@
1
1
  <div class="column conference-speaker js-conference">
2
2
  <div class="speaker-img-wrapper">
3
3
  <div class="speaker-img">
4
- <%= image_tag avatar.url, alt: "speaker-image" %>
4
+ <%= image_tag avatar_path, alt: "speaker-image" %>
5
5
  </div>
6
6
  </div>
7
7
  <div class="speaker-data">
@@ -26,7 +26,7 @@
26
26
  <div class="column medium-6">
27
27
  <div class="speaker-img-wrapper">
28
28
  <div class="speaker-img">
29
- <%= image_tag avatar.url, alt: "speaker-image" %>
29
+ <%= image_tag avatar_path, alt: "speaker-image" %>
30
30
  </div>
31
31
  </div>
32
32
  <div class="speaker-data">
@@ -39,10 +39,10 @@ module Decidim
39
39
  speakers.map { |speaker| present(speaker) }
40
40
  end
41
41
 
42
- def avatar
43
- return model.user.avatar if model.user.present?
42
+ def avatar_path
43
+ return Decidim::UserPresenter.new(model.user).avatar_url if model.user.present?
44
44
 
45
- model.avatar
45
+ model.attached_uploader(:avatar).path
46
46
  end
47
47
 
48
48
  def has_profile?
@@ -8,7 +8,7 @@
8
8
  <div class="column">
9
9
  <%= link_to decidim_conferences.conference_path(conference), class: "card card--conference card--mini" do %>
10
10
  <div aria-hidden="true" class="card__image-top"
11
- style="background-image:url(<%= conference.hero_image.url %>)"></div>
11
+ style="background-image:url(<%= conference.attached_uploader(:hero_image).path %>)"></div>
12
12
  <div class="card__content">
13
13
  <span class="card__title card__link"><%= translated_attribute conference.title %></span>
14
14
  </div>
@@ -17,9 +17,9 @@ module Decidim
17
17
  end
18
18
 
19
19
  def logo
20
- return unless model.logo.presence
20
+ return unless model.logo.attached?
21
21
 
22
- "<div class='card p-m flex--cc'> #{image_tag model.logo.medium.url, alt: "logo"} </div>"
22
+ "<div class='card p-m flex--cc'> #{image_tag model.attached_uploader(:logo).path(variant: :medium), alt: "logo"} </div>"
23
23
  end
24
24
  end
25
25
  end
@@ -26,6 +26,7 @@ module Decidim
26
26
 
27
27
  Conference.transaction do
28
28
  copy_conference
29
+ copy_conference_attachments
29
30
  copy_conference_categories if @form.copy_categories?
30
31
  copy_conference_components if @form.copy_components?
31
32
  end
@@ -47,8 +48,6 @@ module Decidim
47
48
  description: @conference.description,
48
49
  short_description: @conference.short_description,
49
50
  location: @conference.location,
50
- hero_image: @conference.hero_image,
51
- banner_image: @conference.banner_image,
52
51
  promoted: @conference.promoted,
53
52
  scopes_enabled: @conference.scopes_enabled,
54
53
  scope: @conference.scope,
@@ -58,6 +57,14 @@ module Decidim
58
57
  )
59
58
  end
60
59
 
60
+ def copy_conference_attachments
61
+ [:hero_image, :banner_image].each do |attribute|
62
+ next unless @conference.attached_uploader(attribute).attached?
63
+
64
+ @copied_conference.send(attribute).attach(@conference.send(attribute).blob)
65
+ end
66
+ end
67
+
61
68
  def copy_conference_categories
62
69
  @conference.categories.each do |category|
63
70
  category_copied = category.dup
@@ -6,6 +6,8 @@ module Decidim
6
6
  # A command with all the business logic when creating a new conference
7
7
  # speaker in the system.
8
8
  class CreateConferenceSpeaker < Rectify::Command
9
+ include ::Decidim::AttachmentAttributesMethods
10
+
9
11
  # Public: Initializes the command.
10
12
  #
11
13
  # form - A form object with the params.
@@ -55,8 +57,6 @@ module Decidim
55
57
  :full_name,
56
58
  :twitter_handle,
57
59
  :personal_url,
58
- :avatar,
59
- :remove_avatar,
60
60
  :position,
61
61
  :affiliation,
62
62
  :short_bio
@@ -64,6 +64,8 @@ module Decidim
64
64
  decidim_conference_id: conference.id,
65
65
  conference: conference,
66
66
  user: form.user
67
+ ).merge(
68
+ attachment_attributes(:avatar)
67
69
  )
68
70
  conference_speaker = conference.speakers.build
69
71
  conference_speaker.conference = conference
@@ -6,6 +6,8 @@ module Decidim
6
6
  # A command with all the business logic when creating a new participatory
7
7
  # conference in the system.
8
8
  class UpdateConference < Rectify::Command
9
+ include ::Decidim::AttachmentAttributesMethods
10
+
9
11
  # Public: Initializes the command.
10
12
  #
11
13
  # conference - the Conference to update
@@ -85,16 +87,9 @@ module Decidim
85
87
  scopes_enabled: form.scopes_enabled,
86
88
  scope: form.scope,
87
89
  show_statistics: form.show_statistics
88
- }.merge(uploader_attributes)
89
- end
90
-
91
- def uploader_attributes
92
- {
93
- hero_image: form.hero_image,
94
- remove_hero_image: form.remove_hero_image,
95
- banner_image: form.banner_image,
96
- remove_banner_image: form.remove_banner_image
97
- }.delete_if { |_k, val| val.is_a?(Decidim::ApplicationUploader) }
90
+ }.merge(
91
+ attachment_attributes(:hero_image, :banner_image)
92
+ )
98
93
  end
99
94
 
100
95
  def send_notification_registrations_enabled
@@ -6,12 +6,13 @@ module Decidim
6
6
  # A command with all the business logic when updating a conference
7
7
  # speaker in the system.
8
8
  class UpdateConferenceSpeaker < Rectify::Command
9
+ include ::Decidim::AttachmentAttributesMethods
10
+
9
11
  # Public: Initializes the command.
10
12
  #
11
13
  # form - A form object with the params.
12
14
  # conference_speaker - The ConferenceSpeaker to update
13
15
  def initialize(form, conference_speaker)
14
- form.avatar = conference_speaker.avatar if form.avatar.blank?
15
16
  @form = form
16
17
  @conference_speaker = conference_speaker
17
18
  end
@@ -62,14 +63,9 @@ module Decidim
62
63
  :short_bio
63
64
  ).merge(
64
65
  user: form.user
65
- ).merge(uploader_attributes)
66
- end
67
-
68
- def uploader_attributes
69
- {
70
- avatar: form.avatar,
71
- remove_avatar: form.remove_avatar
72
- }.delete_if { |_k, val| val.is_a?(Decidim::ApplicationUploader) }
66
+ ).merge(
67
+ attachment_attributes(:avatar)
68
+ )
73
69
  end
74
70
 
75
71
  def update_conference_speaker!
@@ -35,8 +35,8 @@ module Decidim
35
35
  attr_reader :form, :conference
36
36
 
37
37
  def update_conference_diploma
38
- @conference.main_logo = @form.main_logo
39
- @conference.signature = @form.signature
38
+ @conference.main_logo = @form.main_logo if @form.main_logo.present?
39
+ @conference.signature = @form.signature if @form.signature.present?
40
40
  @conference.signature_name = @form.signature_name
41
41
  @conference.sign_date = @form.sign_date
42
42
 
@@ -6,13 +6,13 @@ module Decidim
6
6
  # A command with all the business logic when updating a conference
7
7
  # partner in the system.
8
8
  class UpdatePartner < Rectify::Command
9
+ include ::Decidim::AttachmentAttributesMethods
10
+
9
11
  # Public: Initializes the command.
10
12
  #
11
13
  # form - A form object with the params.
12
14
  # conference_partner - The ConferencePartner to update
13
15
  def initialize(form, conference_partner)
14
- form.logo = conference_partner.logo if form.logo.blank?
15
-
16
16
  @form = form
17
17
  @conference_partner = conference_partner
18
18
  end
@@ -54,9 +54,9 @@ module Decidim
54
54
  :name,
55
55
  :weight,
56
56
  :partner_type,
57
- :link,
58
- :logo,
59
- :remove_logo
57
+ :link
58
+ ).merge(
59
+ attachment_attributes(:logo)
60
60
  )
61
61
  end
62
62
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_dependency "decidim/admin/application_controller"
4
-
5
3
  module Decidim
6
4
  module Conferences
7
5
  module Admin
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_dependency "decidim/admin/application_controller"
4
-
5
3
  module Decidim
6
4
  module Conferences
7
5
  module Admin
@@ -41,9 +41,9 @@ module Decidim
41
41
  end
42
42
 
43
43
  def edit
44
- @conference_speaker = collection.find(params[:id])
45
- enforce_permission_to :update, :conference_speaker, speaker: @conference_speaker
46
- @form = form(ConferenceSpeakerForm).from_model(@conference_speaker)
44
+ @item = collection.find(params[:id])
45
+ enforce_permission_to :update, :conference_speaker, speaker: @item
46
+ @form = form(ConferenceSpeakerForm).from_model(@item)
47
47
  end
48
48
 
49
49
  def update
@@ -82,11 +82,7 @@ module Decidim
82
82
  end
83
83
 
84
84
  def conference_params
85
- {
86
- id: params[:slug],
87
- hero_image: current_conference.hero_image,
88
- banner_image: current_conference.banner_image
89
- }.merge(params[:conference].to_unsafe_h)
85
+ { id: params[:slug] }.merge(params[:conference].to_unsafe_h)
90
86
  end
91
87
  end
92
88
  end
@@ -16,7 +16,7 @@ module Decidim
16
16
  def update
17
17
  enforce_permission_to :update, :conference, conference: current_conference
18
18
 
19
- @form = form(DiplomaForm).from_params(diploma_params).with_context(conference: current_conference)
19
+ @form = form(DiplomaForm).from_params(diploma_params).with_context(conference: current_conference, current_organization: current_organization)
20
20
 
21
21
  UpdateDiploma.call(@form, current_conference) do
22
22
  on(:ok) do
@@ -51,9 +51,7 @@ module Decidim
51
51
 
52
52
  def diploma_params
53
53
  {
54
- id: params[:slug],
55
- signature: current_conference.signature,
56
- main_logo: current_conference.main_logo
54
+ id: params[:slug]
57
55
  }.merge(params[:conference].to_unsafe_h)
58
56
  end
59
57
  end
@@ -25,9 +25,9 @@ module Decidim
25
25
  attribute :scopes_enabled, Boolean
26
26
  attribute :scope_id, Integer
27
27
  attribute :hero_image
28
- attribute :remove_hero_image
28
+ attribute :remove_hero_image, Boolean, default: false
29
29
  attribute :banner_image
30
- attribute :remove_banner_image
30
+ attribute :remove_banner_image, Boolean, default: false
31
31
  attribute :show_statistics, Boolean
32
32
  attribute :start_date, Decidim::Attributes::LocalizedDate
33
33
  attribute :end_date, Decidim::Attributes::LocalizedDate
@@ -18,7 +18,7 @@ module Decidim
18
18
  attribute :twitter_handle, String
19
19
  attribute :personal_url, String
20
20
  attribute :avatar
21
- attribute :remove_avatar
21
+ attribute :remove_avatar, Boolean, default: false
22
22
  attribute :user_id, Integer
23
23
  attribute :existing_user, Boolean, default: false
24
24
  attribute :conference_meeting_ids, Array[Integer]
@@ -14,10 +14,10 @@ module Decidim
14
14
  attribute :partner_type, String
15
15
  attribute :weight, Integer, default: 0
16
16
  attribute :logo
17
- attribute :remove_logo
17
+ attribute :remove_logo, Boolean, default: false
18
18
 
19
19
  validates :name, :partner_type, presence: true, if: ->(form) { form.logo.present? }
20
- validates :logo, presence: true, unless: ->(form) { form.logo.present? }
20
+ validates :logo, presence: true, unless: :persisted?
21
21
  validates :logo, passthru: {
22
22
  to: Decidim::Conferences::Partner,
23
23
  with: {
@@ -55,17 +55,17 @@ module Decidim
55
55
  validates :slug, uniqueness: { scope: :organization }
56
56
  validates :slug, presence: true, format: { with: Decidim::Conference.slug_format }
57
57
 
58
- validates_upload :hero_image
59
- mount_uploader :hero_image, Decidim::HeroImageUploader
58
+ has_one_attached :hero_image
59
+ validates_upload :hero_image, uploader: Decidim::HeroImageUploader
60
60
 
61
- validates_upload :banner_image
62
- mount_uploader :banner_image, Decidim::HomepageImageUploader
61
+ has_one_attached :banner_image
62
+ validates_upload :banner_image, uploader: Decidim::HomepageImageUploader
63
63
 
64
- validates_upload :main_logo
65
- mount_uploader :main_logo, Decidim::Conferences::DiplomaUploader
64
+ has_one_attached :main_logo
65
+ validates_upload :main_logo, uploader: Decidim::Conferences::DiplomaUploader
66
66
 
67
- validates_upload :signature
68
- mount_uploader :signature, Decidim::Conferences::DiplomaUploader
67
+ has_one_attached :signature
68
+ validates_upload :signature, uploader: Decidim::Conferences::DiplomaUploader
69
69
 
70
70
  searchable_fields({
71
71
  scope_id: :decidim_scope_id,
@@ -18,8 +18,8 @@ module Decidim
18
18
 
19
19
  default_scope { order(full_name: :asc, created_at: :asc) }
20
20
 
21
- validates_avatar
22
- mount_uploader :avatar, Decidim::AvatarUploader
21
+ has_one_attached :avatar
22
+ validates_avatar :avatar, uploader: Decidim::AvatarUploader
23
23
 
24
24
  delegate :organization, to: :conference
25
25
 
@@ -14,8 +14,8 @@ module Decidim
14
14
 
15
15
  default_scope { order(partner_type: :desc, weight: :asc) }
16
16
 
17
- validates_avatar :logo
18
- mount_uploader :logo, Decidim::Conferences::PartnerLogoUploader
17
+ has_one_attached :logo
18
+ validates_avatar :logo, uploader: Decidim::Conferences::PartnerLogoUploader
19
19
 
20
20
  delegate :organization, to: :conference
21
21
 
@@ -0,0 +1,7 @@
1
+ import "src/decidim/conferences/admin/conferences"
2
+ import "src/decidim/conferences/admin/conference_speakers"
3
+ import "src/decidim/conferences/admin/conference_invite_form"
4
+ import "src/decidim/slug_form"
5
+
6
+ // Images
7
+ require.context("../images", true)
@@ -1,6 +1,6 @@
1
- ((exports) => {
2
- const { createFieldDependentInputs } = exports.DecidimAdmin;
1
+ import createFieldDependentInputs from "src/decidim/admin/field_dependent_inputs.component"
3
2
 
3
+ $(() => {
4
4
  const $attendeeType = $('[name="conference_registration_invite[existing_user]"');
5
5
 
6
6
  createFieldDependentInputs({
@@ -22,4 +22,4 @@
22
22
  return $("#conference_registration_invite_existing_user_true").is(":checked")
23
23
  }
24
24
  });
25
- })(window);
25
+ })
@@ -1,6 +1,6 @@
1
- ((exports) => {
2
- const { createFieldDependentInputs } = exports.DecidimAdmin;
1
+ import createFieldDependentInputs from "src/decidim/admin/field_dependent_inputs.component"
3
2
 
3
+ $(() => {
4
4
  const $conferenceSpeakerType = $("#conference_speaker_existing_user");
5
5
 
6
6
  createFieldDependentInputs({
@@ -23,4 +23,4 @@
23
23
  }
24
24
  });
25
25
 
26
- })(window);
26
+ })
@@ -0,0 +1,27 @@
1
+ $(() => {
2
+ const $conferenceScopeEnabled = $("#conference_scopes_enabled");
3
+ const $conferenceScopeId = $("#conference_scope_id");
4
+ const $form = $(".edit_conference, .new_conference");
5
+
6
+ if ($form.length > 0) {
7
+ $conferenceScopeEnabled.on("change", (event) => {
8
+ const checked = event.target.checked;
9
+ window.theDataPicker.enabled($conferenceScopeId, checked);
10
+ })
11
+ window.theDataPicker.enabled($conferenceScopeId, $conferenceScopeEnabled.prop("checked"));
12
+
13
+ const $registrationsEnabled = $form.find("#conference_registrations_enabled");
14
+ const $availableSlots = $form.find("#conference_available_slots");
15
+ const toggleDisabledFields = () => {
16
+ const enabled = $registrationsEnabled.prop("checked");
17
+ $availableSlots.attr("disabled", !enabled);
18
+
19
+ $form.find("#conference_registrations_terms .editor-container").each((idx, node) => {
20
+ const quill = Quill.find(node);
21
+ quill.enable(enabled);
22
+ })
23
+ };
24
+ $registrationsEnabled.on("change", toggleDisabledFields);
25
+ toggleDisabledFields();
26
+ }
27
+ });
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Conferences
5
5
  # A presenter to render statistics in the homepage.
6
- class ConferenceStatsPresenter < Rectify::Presenter
6
+ class ConferenceStatsPresenter < Decidim::StatsPresenter
7
7
  attribute :conference, Decidim::Conference
8
8
  include IconHelper
9
9
 
@@ -11,39 +11,25 @@ module Decidim
11
11
  def highlighted
12
12
  highlighted_stats = component_stats(priority: StatsRegistry::HIGH_PRIORITY)
13
13
  highlighted_stats.concat(component_stats(priority: StatsRegistry::MEDIUM_PRIORITY))
14
+ highlighted_stats.concat(comments_stats(:conferences))
14
15
  highlighted_stats = highlighted_stats.reject(&:empty?)
15
16
  highlighted_stats = highlighted_stats.reject { |_manifest, _name, data| data.zero? }
16
- grouped_highlighted_stats = highlighted_stats.group_by { |stats| stats.first.name }
17
+ grouped_highlighted_stats = highlighted_stats.group_by(&:first)
17
18
 
18
- safe_join(
19
- grouped_highlighted_stats.map do |_manifest_name, stats|
20
- content_tag :div, class: "process_stats-item" do
21
- safe_join(
22
- stats.each_with_index.map do |stat, index|
23
- render_stats_data(stat[0], stat[1], stat[2], index)
24
- end
25
- )
26
- end
27
- end
28
- )
19
+ statistics(grouped_highlighted_stats)
29
20
  end
30
21
 
31
22
  private
32
23
 
33
24
  def component_stats(conditions)
34
25
  Decidim.component_manifests.map do |component_manifest|
35
- component_manifest.stats.filter(conditions).with_context(published_components).map { |name, data| [component_manifest, name, data] }.flatten
26
+ component_manifest.stats
27
+ .filter(conditions)
28
+ .with_context(published_components)
29
+ .map { |name, data| [component_manifest.name, name, data] }.flatten
36
30
  end
37
31
  end
38
32
 
39
- def render_stats_data(component_manifest, name, data, index)
40
- safe_join([
41
- index.zero? ? manifest_icon(component_manifest, role: "img", "aria-hidden": true) : " /&nbsp".html_safe,
42
- content_tag(:span, "#{number_with_delimiter(data)} " + I18n.t(name, scope: "decidim.conferences.statistics"),
43
- class: "#{name} process_stats-text")
44
- ])
45
- end
46
-
47
33
  def published_components
48
34
  @published_components ||= Component.where(participatory_space: conference).published
49
35
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Conferences
5
5
  module Admin
6
- # A class used to find the admins for an conference.
6
+ # A class used to find the admins for an conference or an organization conferences.
7
7
  class AdminUsers < Rectify::Query
8
8
  # Syntactic sugar to initialize the class and return the queried objects.
9
9
  #
@@ -12,33 +12,46 @@ module Decidim
12
12
  new(conference).query
13
13
  end
14
14
 
15
+ # Syntactic sugar to initialize the class and return the queried objects.
16
+ #
17
+ # organization - an organization that needs to find its conference admins
18
+ def self.for_organization(organization)
19
+ new(nil, organization).query
20
+ end
21
+
15
22
  # Initializes the class.
16
23
  #
17
24
  # conference - an conference that needs to find its conference admins
18
- def initialize(conference)
25
+ # organization - an organization that needs to find its conference admins
26
+ def initialize(conference, organization = nil)
19
27
  @conference = conference
28
+ @organization = conference&.organization || organization
20
29
  end
21
30
 
22
31
  # Finds organization admins and the users with role admin for the given conference.
23
32
  #
24
33
  # Returns an ActiveRecord::Relation.
25
34
  def query
26
- Decidim::User.where(id: organization_admins).or(conference_user_admins)
35
+ organization.admins.or(conferences_user_admins)
27
36
  end
28
37
 
29
38
  private
30
39
 
31
- attr_reader :conference
40
+ attr_reader :conference, :organization
32
41
 
33
- def organization_admins
34
- conference.organization.admins
42
+ def conferences_user_admins
43
+ Decidim::User.where(
44
+ id: Decidim::ConferenceUserRole.where(conference: conferences, role: :admin)
45
+ .select(:decidim_user_id)
46
+ )
35
47
  end
36
48
 
37
- def conference_user_admins
38
- conference_user_admin_ids = Decidim::ConferenceUserRole
39
- .where(conference: conference, role: :admin)
40
- .pluck(:decidim_user_id)
41
- Decidim::User.where(id: conference_user_admin_ids)
49
+ def conferences
50
+ if conference
51
+ [conference]
52
+ else
53
+ Decidim::Conference.where(organization: organization)
54
+ end
42
55
  end
43
56
  end
44
57
  end
@@ -4,8 +4,10 @@ module Decidim
4
4
  module Conferences
5
5
  # This class deals with uploading the conference partner logo.
6
6
  class DiplomaUploader < ImageUploader
7
- version :thumb do
8
- process resize_to_fit: [275, 90]
7
+ set_variants do
8
+ {
9
+ thumb: { resize_to_fit: [275, 90] }
10
+ }
9
11
  end
10
12
  end
11
13
  end
@@ -4,11 +4,11 @@ module Decidim
4
4
  module Conferences
5
5
  # This class deals with uploading the conference partner logo.
6
6
  class PartnerLogoUploader < ImageUploader
7
- version :thumb do
8
- process resize_to_fit: [200, 55]
9
- end
10
- version :medium do
11
- process resize_to_fit: [600, 160]
7
+ set_variants do
8
+ {
9
+ thumb: { resize_to_fit: [200, 55] },
10
+ medium: { resize_to_fit: [600, 160] }
11
+ }
12
12
  end
13
13
  end
14
14
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim::Cw
4
+ module Conferences
5
+ # This class deals with uploading the conference partner logo.
6
+ class DiplomaUploader < Decidim::Cw::ImageUploader
7
+ set_variants do
8
+ {
9
+ thumb: { resize_to_fit: [275, 90] }
10
+ }
11
+ end
12
+ end
13
+ end
14
+ end