decidim-conferences 0.22.0 → 0.23.0

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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/conferences/conference_m_cell.rb +4 -0
  3. data/app/cells/decidim/conferences/registration_type_cell.rb +2 -2
  4. data/app/commands/decidim/conferences/admin/create_partner.rb +9 -9
  5. data/app/commands/decidim/conferences/admin/update_conference.rb +10 -3
  6. data/app/forms/decidim/conferences/admin/conference_form.rb +5 -2
  7. data/app/forms/decidim/conferences/admin/conference_speaker_form.rb +12 -1
  8. data/app/forms/decidim/conferences/admin/diploma_form.rb +6 -2
  9. data/app/forms/decidim/conferences/admin/partner_form.rb +16 -1
  10. data/app/models/decidim/conference.rb +16 -1
  11. data/app/models/decidim/conference_speaker.rb +5 -2
  12. data/app/models/decidim/conferences/media_link.rb +3 -0
  13. data/app/models/decidim/conferences/partner.rb +5 -1
  14. data/app/models/decidim/conferences/registration_type.rb +3 -0
  15. data/app/views/decidim/conferences/registration_types/index.html.erb +1 -1
  16. data/app/views/layouts/decidim/conference.html.erb +1 -0
  17. data/config/locales/am-ET.yml +1 -0
  18. data/config/locales/bg.yml +7 -0
  19. data/config/locales/ca.yml +1 -0
  20. data/config/locales/cs.yml +4 -3
  21. data/config/locales/da.yml +1 -0
  22. data/config/locales/en.yml +1 -0
  23. data/config/locales/eo.yml +1 -0
  24. data/config/locales/es-MX.yml +1 -0
  25. data/config/locales/es-PY.yml +1 -0
  26. data/config/locales/es.yml +2 -1
  27. data/config/locales/et.yml +1 -0
  28. data/config/locales/fi-plain.yml +1 -0
  29. data/config/locales/fi.yml +1 -0
  30. data/config/locales/fr-CA.yml +1 -0
  31. data/config/locales/fr.yml +4 -3
  32. data/config/locales/hr.yml +1 -0
  33. data/config/locales/is.yml +1 -0
  34. data/config/locales/it.yml +1 -0
  35. data/config/locales/ja-JP.yml +107 -107
  36. data/config/locales/ja.yml +576 -0
  37. data/config/locales/ko-KR.yml +1 -0
  38. data/config/locales/ko.yml +1 -0
  39. data/config/locales/lt.yml +1 -0
  40. data/config/locales/{lv-LV.yml → lv.yml} +0 -0
  41. data/config/locales/mt.yml +1 -0
  42. data/config/locales/nl.yml +1 -0
  43. data/config/locales/no.yml +9 -0
  44. data/config/locales/om-ET.yml +1 -0
  45. data/config/locales/pl.yml +19 -19
  46. data/config/locales/sl.yml +5 -0
  47. data/config/locales/so-SO.yml +1 -0
  48. data/config/locales/sv.yml +2 -2
  49. data/config/locales/ti-ER.yml +1 -0
  50. data/config/locales/vi-VN.yml +1 -0
  51. data/config/locales/vi.yml +1 -0
  52. data/config/locales/zh-CN.yml +576 -0
  53. data/config/locales/zh-TW.yml +1 -0
  54. data/lib/decidim/conferences/admin_engine.rb +1 -0
  55. data/lib/decidim/conferences/participatory_space.rb +11 -11
  56. data/lib/decidim/conferences/test/factories.rb +3 -3
  57. data/lib/decidim/conferences/version.rb +1 -1
  58. metadata +32 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e927274e7911f8f49d468aa0d0102712d9271549757ff974f97b65dee4f12800
4
- data.tar.gz: f0a57fd51a3fcec014bd6dbb1ddedf1a646d7bd25a9d726248e1de5f254c9914
3
+ metadata.gz: f1abe7fce04112e52d436ff9d8525b282e07aa0dc21315e041dca2a294e20fb0
4
+ data.tar.gz: 80eec51964b2fe9d03e7dbaadfb70c30f41ba3725c5d7cb706cf767e5b319b07
5
5
  SHA512:
6
- metadata.gz: 1fe6c3aea3cd56b87ff3771cb04965d3473f70553fbbef087dcacc7adbe097c3c7fa8501a79b390c29d81ae7781b3b1e3f511e9582ff08cf508d22ff1ac65455
7
- data.tar.gz: b3f935e675ed4cc6ab24b81243b4b157ca238f57a0eb7674db1e1e44dcc55aa789f341454cb0278a81acae1aef1476024651aa613d63e8a25e48c0b46c13c64c
6
+ metadata.gz: c55f072fecf62705bd252953da7bb5bcb052e0384db7091f63a5f2dccbfa1408d1261c092653f208b83fb2c66067b7f74fc324d8a6ebbf98214a4d9919fbe26b
7
+ data.tar.gz: bbde5bd70266e7eda4e0f379124d49ce1e9c3e73e4faf931f9072719c4e5d5b35865de4fd6e7980f591b683522a9ca4ed90577159d642cc331a2ac43813da300
@@ -14,6 +14,10 @@ module Decidim
14
14
 
15
15
  private
16
16
 
17
+ def title
18
+ decidim_html_escape(super)
19
+ end
20
+
17
21
  def has_image?
18
22
  true
19
23
  end
@@ -18,11 +18,11 @@ module Decidim
18
18
  delegate :current_user, to: :controller, prefix: false
19
19
 
20
20
  def title
21
- translated_attribute model.title
21
+ decidim_sanitize translated_attribute model.title
22
22
  end
23
23
 
24
24
  def description
25
- translated_attribute model.description
25
+ decidim_sanitize translated_attribute model.description
26
26
  end
27
27
 
28
28
  def price
@@ -49,15 +49,15 @@ module Decidim
49
49
  @partner = Decidim.traceability.create!(
50
50
  Decidim::Conferences::Partner,
51
51
  form.current_user,
52
- form.attributes.slice(
53
- :name,
54
- :weight,
55
- :link,
56
- :partner_type,
57
- :logo,
58
- :remove_avatar
59
- ).merge(
60
- conference: conference
52
+ { conference: conference }.merge(
53
+ form.attributes.slice(
54
+ :name,
55
+ :weight,
56
+ :link,
57
+ :partner_type,
58
+ :logo,
59
+ :remove_avatar
60
+ )
61
61
  ),
62
62
  log_info
63
63
  )
@@ -81,13 +81,20 @@ module Decidim
81
81
  location: form.location,
82
82
  start_date: form.start_date,
83
83
  end_date: form.end_date,
84
- hero_image: form.hero_image,
85
- banner_image: form.banner_image,
86
84
  promoted: form.promoted,
87
85
  scopes_enabled: form.scopes_enabled,
88
86
  scope: form.scope,
89
87
  show_statistics: form.show_statistics
90
- }
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) }
91
98
  end
92
99
 
93
100
  def send_notification_registrations_enabled
@@ -8,6 +8,7 @@ module Decidim
8
8
  #
9
9
  class ConferenceForm < Form
10
10
  include TranslatableAttributes
11
+ include Decidim::HasUploadValidations
11
12
 
12
13
  translatable_attribute :title, String
13
14
  translatable_attribute :slogan, String
@@ -45,13 +46,15 @@ module Decidim
45
46
  validates :registration_terms, translatable_presence: true, if: ->(form) { form.registrations_enabled? }
46
47
  validates :available_slots, numericality: { greater_than_or_equal_to: 0 }, if: ->(form) { form.registrations_enabled? }
47
48
 
48
- validates :hero_image, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } }, file_content_type: { allow: ["image/jpeg", "image/png"] }
49
- validates :banner_image, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } }, file_content_type: { allow: ["image/jpeg", "image/png"] }
49
+ validates :hero_image, passthru: { to: Decidim::Conference }
50
+ validates :banner_image, passthru: { to: Decidim::Conference }
50
51
  validate :available_slots_greater_than_or_equal_to_registrations_count, if: ->(form) { form.registrations_enabled? && form.available_slots.positive? }
51
52
 
52
53
  validates :start_date, presence: true, date: { before_or_equal_to: :end_date }
53
54
  validates :end_date, presence: true, date: { after_or_equal_to: :start_date }
54
55
 
56
+ alias organization current_organization
57
+
55
58
  def map_model(model)
56
59
  self.scope_id = model.decidim_scope_id
57
60
  end
@@ -26,7 +26,18 @@ module Decidim
26
26
  validates :full_name, presence: true, unless: proc { |object| object.existing_user }
27
27
  validates :user, presence: true, if: proc { |object| object.existing_user }
28
28
  validates :position, :affiliation, presence: true
29
- validates :avatar, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_avatar_size } }
29
+ validates :avatar, passthru: {
30
+ to: Decidim::ConferenceSpeaker,
31
+ with: {
32
+ # The speaker gets its organization context through the conference
33
+ # object which is why we need to create a dummy conference in order
34
+ # to pass the correct organization context to the file upload
35
+ # validators.
36
+ conference: lambda do |form|
37
+ Decidim::Conference.new(organization: form.current_organization)
38
+ end
39
+ }
40
+ }
30
41
  validate :personal_url_format
31
42
 
32
43
  def personal_url
@@ -7,6 +7,8 @@ module Decidim
7
7
  # from the admin dashboard
8
8
  #
9
9
  class DiplomaForm < Form
10
+ include Decidim::HasUploadValidations
11
+
10
12
  mimic :conference
11
13
 
12
14
  attribute :main_logo
@@ -16,8 +18,10 @@ module Decidim
16
18
 
17
19
  validates :signature_name, :sign_date, :main_logo, :signature, presence: true
18
20
 
19
- validates :main_logo, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } }, file_content_type: { allow: ["image/jpeg", "image/png"] }
20
- validates :signature, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } }, file_content_type: { allow: ["image/jpeg", "image/png"] }
21
+ validates :main_logo, passthru: { to: Decidim::Conference }
22
+ validates :signature, passthru: { to: Decidim::Conference }
23
+
24
+ alias organization current_organization
21
25
  end
22
26
  end
23
27
  end
@@ -5,6 +5,8 @@ module Decidim
5
5
  module Admin
6
6
  # A form object used to create conference members from the admin dashboard.
7
7
  class PartnerForm < Form
8
+ include Decidim::HasUploadValidations
9
+
8
10
  mimic :conference_partner
9
11
 
10
12
  attribute :name, String
@@ -15,11 +17,24 @@ module Decidim
15
17
  attribute :remove_logo
16
18
 
17
19
  validates :name, :partner_type, presence: true, if: ->(form) { form.logo.present? }
18
- validates :logo, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_avatar_size } }
20
+ validates :logo, passthru: {
21
+ to: Decidim::Conferences::Partner,
22
+ with: {
23
+ # The partner gets its organization context through the conference
24
+ # object which is why we need to create a dummy conference in order
25
+ # to pass the correct organization context to the file upload
26
+ # validators.
27
+ conference: lambda do |form|
28
+ Decidim::Conference.new(organization: form.current_organization)
29
+ end
30
+ }
31
+ }
19
32
  validate :link_format
20
33
  validates :weight, numericality: { greater_than_or_equal_to: 0 }
21
34
  validates :partner_type, inclusion: { in: Decidim::Conferences::Partner::TYPES }
22
35
 
36
+ alias organization current_organization
37
+
23
38
  def link
24
39
  return if super.blank?
25
40
 
@@ -10,13 +10,17 @@ module Decidim
10
10
  include Decidim::HasAttachmentCollections
11
11
  include Decidim::Participable
12
12
  include Decidim::Publicable
13
- include Decidim::Scopable
13
+ include Decidim::ScopableParticipatorySpace
14
14
  include Decidim::Followable
15
15
  include Decidim::HasReference
16
16
  include Decidim::Traceable
17
17
  include Decidim::Loggable
18
18
  include Decidim::ParticipatorySpaceResourceable
19
19
  include Decidim::Searchable
20
+ include Decidim::HasUploadValidations
21
+ include Decidim::TranslatableResource
22
+
23
+ translatable_fields :title, :slogan, :short_description, :description, :objectives, :registration_terms
20
24
 
21
25
  belongs_to :organization,
22
26
  foreign_key: "decidim_organization_id",
@@ -51,9 +55,16 @@ module Decidim
51
55
  validates :slug, uniqueness: { scope: :organization }
52
56
  validates :slug, presence: true, format: { with: Decidim::Conference.slug_format }
53
57
 
58
+ validates_upload :hero_image
54
59
  mount_uploader :hero_image, Decidim::HeroImageUploader
60
+
61
+ validates_upload :banner_image
55
62
  mount_uploader :banner_image, Decidim::HomepageImageUploader
63
+
64
+ validates_upload :main_logo
56
65
  mount_uploader :main_logo, Decidim::Conferences::DiplomaUploader
66
+
67
+ validates_upload :signature
57
68
  mount_uploader :signature, Decidim::Conferences::DiplomaUploader
58
69
 
59
70
  searchable_fields({
@@ -124,6 +135,10 @@ module Decidim
124
135
  roles.where(role: role_name)
125
136
  end
126
137
 
138
+ def attachment_context
139
+ :admin
140
+ end
141
+
127
142
  # Allow ransacker to search for a key in a hstore column (`title`.`en`)
128
143
  ransacker :title do |parent|
129
144
  Arel::Nodes::InfixOperation.new("->>", parent.table[:title], Arel::Nodes.build_quoted(I18n.locale.to_s))
@@ -6,16 +6,19 @@ module Decidim
6
6
  class ConferenceSpeaker < ApplicationRecord
7
7
  include Decidim::Traceable
8
8
  include Decidim::Loggable
9
+ include Decidim::HasUploadValidations
10
+ include Decidim::TranslatableResource
11
+
12
+ translatable_fields :position, :affiliation, :short_bio
9
13
 
10
14
  belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User", optional: true
11
15
  belongs_to :conference, foreign_key: "decidim_conference_id", class_name: "Decidim::Conference"
12
16
  has_many :conference_speaker_conference_meetings, dependent: :destroy
13
17
  has_many :conference_meetings, through: :conference_speaker_conference_meetings, foreign_key: "conference_speaker_id", class_name: "Decidim::ConferenceMeeting"
14
18
 
15
- validates :avatar, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_avatar_size } }
16
-
17
19
  default_scope { order(full_name: :asc, created_at: :asc) }
18
20
 
21
+ validates_avatar
19
22
  mount_uploader :avatar, Decidim::AvatarUploader
20
23
 
21
24
  delegate :organization, to: :conference
@@ -6,6 +6,9 @@ module Decidim
6
6
  class MediaLink < ApplicationRecord
7
7
  include Decidim::Traceable
8
8
  include Decidim::Loggable
9
+ include Decidim::TranslatableResource
10
+
11
+ translatable_fields :title
9
12
 
10
13
  belongs_to :conference, foreign_key: "decidim_conference_id", class_name: "Decidim::Conference"
11
14
 
@@ -6,15 +6,19 @@ module Decidim
6
6
  class Partner < ApplicationRecord
7
7
  include Decidim::Traceable
8
8
  include Decidim::Loggable
9
+ include Decidim::HasUploadValidations
9
10
 
10
11
  TYPES = %w(main_promotor collaborator).freeze
11
12
 
12
13
  belongs_to :conference, foreign_key: "decidim_conference_id", class_name: "Decidim::Conference"
13
- validates :logo, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_avatar_size } }
14
14
 
15
15
  default_scope { order(partner_type: :desc, weight: :asc) }
16
+
17
+ validates_avatar :logo
16
18
  mount_uploader :logo, Decidim::Conferences::PartnerLogoUploader
17
19
 
20
+ delegate :organization, to: :conference
21
+
18
22
  alias participatory_space conference
19
23
 
20
24
  def self.log_presenter_class_for(_log)
@@ -7,6 +7,9 @@ module Decidim
7
7
  include Decidim::Publicable
8
8
  include Decidim::Traceable
9
9
  include Decidim::Loggable
10
+ include Decidim::TranslatableResource
11
+
12
+ translatable_fields :title, :description
10
13
 
11
14
  belongs_to :conference, foreign_key: "decidim_conference_id", class_name: "Decidim::Conference"
12
15
  has_many :conference_meeting_registration_types, dependent: :destroy
@@ -23,7 +23,7 @@ edit_link(
23
23
  <%= cell "decidim/conferences/registration_type", registration_type, allowed: allowed_to?(:join, :conference, conference: current_participatory_space) %>
24
24
  <% end %>
25
25
  <% else %>
26
- No registrations
26
+ <%= t("registration_types.index.no_registrations", scope: "decidim.conferences") %>
27
27
  <% end %>
28
28
  </section>
29
29
  </div>
@@ -8,6 +8,7 @@
8
8
  <%= render "layouts/decidim/application" do %>
9
9
  <%= render partial: "layouts/decidim/conference_hero" %>
10
10
  <%= render partial: "layouts/decidim/conferences_nav" %>
11
+ <%= cell "decidim/translation_bar", current_organization %>
11
12
  <div class="wrapper">
12
13
  <%= yield %>
13
14
  </div>
@@ -0,0 +1 @@
1
+ am:
@@ -0,0 +1,7 @@
1
+ bg:
2
+ activemodel:
3
+ attributes:
4
+ conference:
5
+ assemblies_ids: Свързани събрания
6
+ banner_image: Банер изображение
7
+ consultations_ids: Свързани консултации
@@ -475,6 +475,7 @@ ca:
475
475
  index:
476
476
  choose_an_option: 'Tria el teu tipus d''inscripció:'
477
477
  login_as: Has iniciat la sessió com a %{name} <%{email}>
478
+ no_registrations: Sense insripcions
478
479
  register: Inscriu-te
479
480
  title: Tipus d'inscripció
480
481
  shared:
@@ -8,15 +8,15 @@ cs:
8
8
  copy_categories: Kopírovat kategorie
9
9
  copy_components: Kopírování komponent
10
10
  copy_features: Funkce kopírování
11
- decidim_scope_id: Rozsah
11
+ decidim_scope_id: Oblast působnosti
12
12
  description: Popis
13
13
  hashtag: Hashtag
14
14
  hero_image: Obrázek na hlavní stránce
15
15
  participatory_processes_ids: Související procesy účasti
16
16
  promoted: Propagováno
17
17
  published_at: Publikováno v
18
- scope_id: Rozsah
19
- scopes_enabled: Schopnosti povoleny
18
+ scope_id: Oblast působnosti
19
+ scopes_enabled: Oblasti působnosti povoleny
20
20
  short_description: Stručný popis
21
21
  show_statistics: Zobrazit statistiky
22
22
  slogan: Heslo
@@ -483,6 +483,7 @@ cs:
483
483
  index:
484
484
  choose_an_option: 'Vyberte možnost registrace:'
485
485
  login_as: Jste přihlášeni jako %{name} <%{email}>
486
+ no_registrations: Žádné registrace
486
487
  register: Registrovat
487
488
  title: Typy registrace
488
489
  shared:
@@ -0,0 +1 @@
1
+ da:
@@ -476,6 +476,7 @@ en:
476
476
  index:
477
477
  choose_an_option: 'Choose your registration option:'
478
478
  login_as: You are logged in as %{name} <%{email}>
479
+ no_registrations: No registrations
479
480
  register: Register
480
481
  title: Registration types
481
482
  shared:
@@ -0,0 +1 @@
1
+ eo:
@@ -475,6 +475,7 @@ es-MX:
475
475
  index:
476
476
  choose_an_option: 'Elige tu tipo de inscripción:'
477
477
  login_as: Has iniciado sesión como %{name} <%{email}>
478
+ no_registrations: No hay inscripciones
478
479
  register: Inscribirse
479
480
  title: Tipos de inscripción
480
481
  shared:
@@ -475,6 +475,7 @@ es-PY:
475
475
  index:
476
476
  choose_an_option: 'Elige tu tipo de inscripción:'
477
477
  login_as: Has iniciado sesión como %{name} <%{email}>
478
+ no_registrations: No hay inscripciones
478
479
  register: Inscribirse
479
480
  title: Tipos de inscripción
480
481
  shared:
@@ -475,6 +475,7 @@ es:
475
475
  index:
476
476
  choose_an_option: 'Elige tu tipo de inscripción:'
477
477
  login_as: Has iniciado sesión como %{name} <%{email}>
478
+ no_registrations: No hay inscripciones
478
479
  register: Inscribirse
479
480
  title: Tipos de inscripción
480
481
  shared:
@@ -530,7 +531,7 @@ es:
530
531
  notification_title: Se han habilitado las inscripciones a la conferencia <a href="%{resource_path}">%{resource_title}</a>.
531
532
  role_assigned:
532
533
  email_intro: Te han asignado el rol de %{role} en la jornada "%{resource_title}".
533
- email_outro: Recibes esta notifiación porque se te ha asignado el rol de %{role} en la jornada "%{resource_title}".
534
+ email_outro: Recibes esta notificación porque se te ha asignado el rol de %{role} en la jornada "%{resource_title}".
534
535
  email_subject: Se te ha asignado el rol de %{role} en "%{resource_title}".
535
536
  notification_title: Se te ha asignado el rol de %{role} en la jornada <a href="%{resource_url}">%{resource_title}</a>.
536
537
  upcoming_conference:
@@ -0,0 +1 @@
1
+ et:
@@ -475,6 +475,7 @@ fi-pl:
475
475
  index:
476
476
  choose_an_option: 'Valitse ilmoittautumisvaihtoehto:'
477
477
  login_as: Olet kirjautunut sisään henkilönä %{name} <%{email}>
478
+ no_registrations: Ei ilmoittautumisia
478
479
  register: Ilmoittaudu
479
480
  title: Ilmoittautumistyypit
480
481
  shared:
@@ -475,6 +475,7 @@ fi:
475
475
  index:
476
476
  choose_an_option: 'Valitse ilmoittautumisvaihtoehto:'
477
477
  login_as: Olet kirjautunut sisään henkilönä %{name} <%{email}>
478
+ no_registrations: Ei ilmoittautumisia
478
479
  register: Ilmoittaudu
479
480
  title: Ilmoittautumistyypit
480
481
  shared:
@@ -475,6 +475,7 @@ fr-CA:
475
475
  index:
476
476
  choose_an_option: 'Choisissez votre option d''inscription:'
477
477
  login_as: Vous êtes connecté en tant que %{name} <%{email}>
478
+ no_registrations: Pas d'inscriptions
478
479
  register: S'inscrire
479
480
  title: Types d'inscription
480
481
  shared: