decidim-admin 0.28.2 → 0.29.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/admin/content_block_cell.rb +0 -1
  3. data/app/cells/decidim/admin/results_per_page/show.erb +2 -2
  4. data/app/cells/decidim/admin/results_per_page_cell.rb +0 -2
  5. data/app/commands/decidim/admin/create_area.rb +4 -32
  6. data/app/commands/decidim/admin/create_area_type.rb +4 -33
  7. data/app/commands/decidim/admin/create_attachment.rb +5 -4
  8. data/app/commands/decidim/admin/create_attachment_collection.rb +3 -3
  9. data/app/commands/decidim/admin/create_category.rb +4 -37
  10. data/app/commands/decidim/admin/create_component.rb +7 -40
  11. data/app/commands/decidim/admin/create_newsletter.rb +11 -29
  12. data/app/commands/decidim/admin/create_participatory_space_private_user.rb +3 -3
  13. data/app/commands/decidim/admin/create_scope.rb +15 -32
  14. data/app/commands/decidim/admin/create_scope_type.rb +3 -32
  15. data/app/commands/decidim/admin/create_static_page.rb +6 -47
  16. data/app/commands/decidim/admin/create_static_page_topic.rb +4 -26
  17. data/app/commands/decidim/admin/deliver_newsletter.rb +4 -5
  18. data/app/commands/decidim/admin/destroy_area.rb +2 -25
  19. data/app/commands/decidim/admin/destroy_category.rb +4 -29
  20. data/app/commands/decidim/admin/destroy_component.rb +5 -42
  21. data/app/commands/decidim/admin/destroy_newsletter.rb +2 -30
  22. data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +5 -32
  23. data/app/commands/decidim/admin/destroy_scope.rb +6 -33
  24. data/app/commands/decidim/admin/officialize_user.rb +1 -1
  25. data/app/commands/decidim/admin/participatory_space/create_admin.rb +4 -4
  26. data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +5 -4
  27. data/app/commands/decidim/admin/promote_managed_user.rb +4 -5
  28. data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
  29. data/app/commands/decidim/admin/update_area.rb +2 -41
  30. data/app/commands/decidim/admin/update_area_type.rb +2 -42
  31. data/app/commands/decidim/admin/update_attachment.rb +10 -7
  32. data/app/commands/decidim/admin/update_attachment_collection.rb +3 -3
  33. data/app/commands/decidim/admin/update_category.rb +2 -45
  34. data/app/commands/decidim/admin/update_component.rb +4 -5
  35. data/app/commands/decidim/admin/update_component_permissions.rb +3 -3
  36. data/app/commands/decidim/admin/{update_external_domain_whitelist.rb → update_external_domain_allowlist.rb} +6 -5
  37. data/app/commands/decidim/admin/update_help_sections.rb +6 -3
  38. data/app/commands/decidim/admin/update_newsletter.rb +8 -8
  39. data/app/commands/decidim/admin/update_organization.rb +9 -53
  40. data/app/commands/decidim/admin/update_organization_appearance.rb +10 -81
  41. data/app/commands/decidim/admin/update_scope.rb +7 -40
  42. data/app/commands/decidim/admin/update_scope_type.rb +2 -42
  43. data/app/commands/decidim/admin/update_static_page.rb +5 -46
  44. data/app/commands/decidim/admin/update_static_page_topic.rb +2 -43
  45. data/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
  46. data/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +2 -2
  47. data/app/controllers/concerns/decidim/admin/filterable.rb +78 -3
  48. data/app/controllers/concerns/decidim/admin/global_moderation_context.rb +1 -1
  49. data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +0 -7
  50. data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +1 -1
  51. data/app/controllers/decidim/admin/application_controller.rb +1 -0
  52. data/app/controllers/decidim/admin/area_types_controller.rb +8 -9
  53. data/app/controllers/decidim/admin/areas_controller.rb +1 -1
  54. data/app/controllers/decidim/admin/authorization_workflows_controller.rb +1 -1
  55. data/app/controllers/decidim/admin/categories_controller.rb +2 -2
  56. data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
  57. data/app/controllers/decidim/admin/components_controller.rb +2 -2
  58. data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +2 -2
  59. data/app/controllers/decidim/admin/concerns/has_attachments.rb +2 -2
  60. data/app/controllers/decidim/admin/concerns/has_private_users.rb +1 -1
  61. data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +1 -1
  62. data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
  63. data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +1 -1
  64. data/app/controllers/decidim/admin/moderations/reports_controller.rb +4 -4
  65. data/app/controllers/decidim/admin/moderations_controller.rb +7 -7
  66. data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -1
  67. data/app/controllers/decidim/admin/newsletters_controller.rb +5 -5
  68. data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -1
  69. data/app/controllers/decidim/admin/organization_controller.rb +1 -1
  70. data/app/controllers/decidim/admin/{organization_external_domain_whitelist_controller.rb → organization_external_domain_allowlist_controller.rb} +7 -7
  71. data/app/controllers/decidim/admin/scope_types_controller.rb +7 -8
  72. data/app/controllers/decidim/admin/scopes_controller.rb +1 -1
  73. data/app/controllers/decidim/admin/share_tokens_controller.rb +1 -1
  74. data/app/controllers/decidim/admin/static_page_topics_controller.rb +2 -2
  75. data/app/controllers/decidim/admin/static_pages_controller.rb +2 -2
  76. data/app/forms/decidim/admin/attachment_form.rb +7 -1
  77. data/app/forms/decidim/admin/organization_appearance_form.rb +0 -3
  78. data/app/forms/decidim/admin/{organization_external_domain_whitelist_form.rb → organization_external_domain_allowlist_form.rb} +3 -3
  79. data/app/forms/decidim/admin/organization_form.rb +2 -2
  80. data/app/forms/decidim/admin/static_page_form.rb +0 -1
  81. data/app/helpers/decidim/admin/filterable_helper.rb +19 -3
  82. data/app/helpers/decidim/admin/moderations/reports_helper.rb +3 -1
  83. data/app/helpers/decidim/admin/newsletters_helper.rb +3 -3
  84. data/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb +2 -2
  85. data/app/packs/entrypoints/decidim_admin.js +4 -1
  86. data/app/packs/src/decidim/admin/application.js +19 -15
  87. data/app/packs/src/decidim/admin/css_preview.js +39 -0
  88. data/app/packs/src/decidim/admin/form.js +18 -1
  89. data/app/packs/src/decidim/admin/participatory_space_search.js +1 -1
  90. data/app/packs/src/decidim/admin/proposal_infinite_edit.js +2 -2
  91. data/app/packs/src/decidim/admin/sync_radio_buttons.js +27 -0
  92. data/app/packs/src/decidim/admin/text_copy.js +19 -0
  93. data/app/packs/stylesheets/decidim/admin/_cards.scss +1 -1
  94. data/app/packs/stylesheets/decidim/admin/_datepicker.scss +62 -0
  95. data/app/packs/stylesheets/decidim/admin/_item_edit.scss +1 -1
  96. data/app/packs/stylesheets/decidim/admin/_item_show.scss +8 -0
  97. data/app/packs/stylesheets/decidim/admin/_proposal_status.scss +5 -0
  98. data/app/packs/stylesheets/decidim/admin/application.scss +2 -0
  99. data/app/permissions/decidim/admin/permissions.rb +2 -2
  100. data/app/queries/decidim/admin/user_filter.rb +4 -4
  101. data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
  102. data/app/views/decidim/admin/attachment_collections/index.html.erb +1 -1
  103. data/app/views/decidim/admin/attachments/_form.html.erb +21 -2
  104. data/app/views/decidim/admin/attachments/index.html.erb +2 -2
  105. data/app/views/decidim/admin/authorization_workflows/index.html.erb +26 -8
  106. data/app/views/decidim/admin/categories/index.html.erb +2 -2
  107. data/app/views/decidim/admin/components/_form.html.erb +1 -1
  108. data/app/views/decidim/admin/dashboard/_pending_moderations.html.erb +1 -1
  109. data/app/views/decidim/admin/dashboard/show.html.erb +1 -1
  110. data/app/views/decidim/admin/exports/_dropdown.html.erb +1 -1
  111. data/app/views/decidim/admin/impersonatable_users/index.html.erb +3 -3
  112. data/app/views/decidim/admin/imports/_dropdown.html.erb +1 -1
  113. data/app/views/decidim/admin/imports/new.html.erb +2 -2
  114. data/app/views/decidim/admin/logs/_filters.html.erb +3 -3
  115. data/app/views/decidim/admin/managed_users/promotions/new.html.erb +1 -1
  116. data/app/views/decidim/admin/moderated_users/index.html.erb +2 -2
  117. data/app/views/decidim/admin/moderations/index.html.erb +5 -5
  118. data/app/views/decidim/admin/moderations/reports/index.html.erb +6 -6
  119. data/app/views/decidim/admin/moderations/reports/show.html.erb +4 -4
  120. data/app/views/decidim/admin/newsletter_templates/index.html.erb +2 -2
  121. data/app/views/decidim/admin/newsletter_templates/show.html.erb +7 -7
  122. data/app/views/decidim/admin/newsletters/index.html.erb +1 -1
  123. data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +3 -3
  124. data/app/views/decidim/admin/newsletters/show.html.erb +1 -1
  125. data/app/views/decidim/admin/organization/_form.html.erb +3 -3
  126. data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +0 -3
  127. data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -5
  128. data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/_external_domain.html.erb +4 -4
  129. data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/_form.html.erb +2 -2
  130. data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/edit.html.erb +2 -2
  131. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
  132. data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +1 -1
  133. data/app/views/decidim/admin/share_tokens/_share_tokens.html.erb +1 -1
  134. data/app/views/decidim/admin/shared/_adjacent_navigation.html.erb +30 -0
  135. data/app/views/decidim/admin/shared/_admin_confirm_modal.html.erb +7 -7
  136. data/app/views/decidim/admin/shared/_filters.html.erb +1 -1
  137. data/app/views/decidim/admin/shared/_gallery.html.erb +1 -1
  138. data/app/views/decidim/admin/shared/landing_page/_content_blocks.html.erb +2 -2
  139. data/app/views/decidim/admin/static_page_topics/index.html.erb +1 -1
  140. data/app/views/decidim/admin/static_pages/_form.html.erb +0 -4
  141. data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
  142. data/app/views/layouts/decidim/admin/_admin_timeout_modal.html.erb +2 -2
  143. data/app/views/layouts/decidim/admin/_application.html.erb +4 -4
  144. data/app/views/layouts/decidim/admin/_callouts_full.html.erb +1 -1
  145. data/app/views/layouts/decidim/admin/_js_configuration.html.erb +3 -1
  146. data/app/views/layouts/decidim/admin/_title_bar.html.erb +2 -2
  147. data/app/views/layouts/decidim/admin/_title_bar_responsive.html.erb +2 -2
  148. data/config/locales/ar.yml +0 -7
  149. data/config/locales/bg.yml +15 -10
  150. data/config/locales/ca.yml +16 -11
  151. data/config/locales/cs.yml +15 -10
  152. data/config/locales/de.yml +15 -10
  153. data/config/locales/el.yml +0 -12
  154. data/config/locales/en.yml +16 -11
  155. data/config/locales/es-MX.yml +16 -11
  156. data/config/locales/es-PY.yml +16 -11
  157. data/config/locales/es.yml +16 -11
  158. data/config/locales/eu.yml +16 -11
  159. data/config/locales/fi-plain.yml +14 -9
  160. data/config/locales/fi.yml +14 -9
  161. data/config/locales/fr-CA.yml +14 -9
  162. data/config/locales/fr.yml +13 -8
  163. data/config/locales/ga-IE.yml +0 -3
  164. data/config/locales/gl.yml +0 -5
  165. data/config/locales/hu.yml +9 -10
  166. data/config/locales/id-ID.yml +0 -3
  167. data/config/locales/is-IS.yml +0 -3
  168. data/config/locales/it.yml +0 -8
  169. data/config/locales/ja.yml +16 -11
  170. data/config/locales/kaa.yml +0 -3
  171. data/config/locales/ko.yml +0 -6
  172. data/config/locales/lb.yml +0 -8
  173. data/config/locales/lt.yml +0 -13
  174. data/config/locales/lv.yml +0 -3
  175. data/config/locales/nl.yml +0 -8
  176. data/config/locales/no.yml +0 -8
  177. data/config/locales/pl.yml +14 -9
  178. data/config/locales/pt-BR.yml +8 -10
  179. data/config/locales/pt.yml +0 -8
  180. data/config/locales/ro-RO.yml +0 -12
  181. data/config/locales/ru.yml +0 -3
  182. data/config/locales/sk.yml +0 -3
  183. data/config/locales/sq-AL.yml +0 -3
  184. data/config/locales/sr-CS.yml +0 -3
  185. data/config/locales/sv.yml +0 -8
  186. data/config/locales/th-TH.yml +0 -3
  187. data/config/locales/tr-TR.yml +0 -5
  188. data/config/locales/uk.yml +0 -3
  189. data/config/locales/zh-CN.yml +0 -3
  190. data/config/locales/zh-TW.yml +0 -12
  191. data/config/routes.rb +1 -1
  192. data/decidim-admin.gemspec +1 -1
  193. data/lib/decidim/admin/import/creator.rb +1 -1
  194. data/lib/decidim/admin/import/importer_factory.rb +2 -2
  195. data/lib/decidim/admin/menu.rb +4 -4
  196. data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +3 -2
  197. data/lib/decidim/admin/test/commands/create_category_examples.rb +4 -2
  198. data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +3 -2
  199. data/lib/decidim/admin/test/commands/update_category_examples.rb +3 -2
  200. data/lib/decidim/admin/test/filterable_examples.rb +5 -3
  201. data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +5 -5
  202. data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +1 -1
  203. data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +12 -12
  204. data/lib/decidim/admin/test/manage_attachments_examples.rb +51 -15
  205. data/lib/decidim/admin/test/manage_categories_examples.rb +13 -13
  206. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
  207. data/lib/decidim/admin/test/manage_hide_content_examples.rb +4 -4
  208. data/lib/decidim/admin/test/manage_moderations_examples.rb +21 -21
  209. data/lib/decidim/admin/test/manage_paginated_collection_examples.rb +3 -3
  210. data/lib/decidim/admin/test/manage_participatory_space_publications_examples.rb +2 -2
  211. data/lib/decidim/admin/version.rb +1 -1
  212. metadata +24 -22
  213. data/app/commands/decidim/admin/destroy_share_token.rb +0 -46
  214. data/app/commands/decidim/admin/destroy_static_page.rb +0 -40
  215. data/app/commands/decidim/admin/destroy_static_page_topic.rb +0 -40
  216. data/app/views/layouts/decidim/admin/login.html.erb +0 -19
  217. /data/app/packs/src/decidim/admin/{external_domain_whitelist.js → external_domain_allowlist.js} +0 -0
@@ -12,10 +12,12 @@ module Decidim
12
12
  translatable_attribute :description, String
13
13
  attribute :weight, Integer, default: 0
14
14
  attribute :attachment_collection_id, Integer
15
+ attribute :link, String
15
16
 
16
17
  mimic :attachment
17
18
 
18
- validates :file, presence: true, unless: :persisted?
19
+ validates :file, presence: true, unless: :persisted_or_link?
20
+ validates :link, url: true
19
21
  validates :file, passthru: { to: Decidim::Attachment }
20
22
  validates :title, :description, translatable_presence: true
21
23
  validates :attachment_collection, presence: true, if: ->(form) { form.attachment_collection_id.present? }
@@ -25,6 +27,10 @@ module Decidim
25
27
 
26
28
  alias organization current_organization
27
29
 
30
+ def persisted_or_link?
31
+ persisted? || link.present?
32
+ end
33
+
28
34
  def attachment_collections
29
35
  @attachment_collections ||= attached_to.attachment_collections
30
36
  end
@@ -30,9 +30,6 @@ module Decidim
30
30
  attribute :primary_color, String
31
31
  attribute :secondary_color, String
32
32
  attribute :tertiary_color, String
33
- attribute :success_color, String
34
- attribute :warning_color, String
35
- attribute :alert_color, String
36
33
 
37
34
  translatable_attribute :cta_button_text, String
38
35
  translatable_attribute :description, String
@@ -2,20 +2,20 @@
2
2
 
3
3
  module Decidim
4
4
  module Admin
5
- class OrganizationExternalDomainWhitelistForm < Form
5
+ class OrganizationExternalDomainAllowlistForm < Form
6
6
  attribute :external_domains, Array[Decidim::Admin::ExternalDomainForm]
7
7
 
8
8
  validate :external_domains_validator
9
9
 
10
10
  def map_model(model)
11
- self.external_domains = model.external_domain_whitelist.map do |external_domain|
11
+ self.external_domains = model.external_domain_allowlist.map do |external_domain|
12
12
  ExternalDomainForm.new(value: external_domain)
13
13
  end
14
14
  end
15
15
 
16
16
  def external_domains_validator
17
17
  @external_domains_validator ||= external_domains.reject(&:deleted).each do |domain|
18
- errors.add(:external_domains, I18n.t("decidim.admin.domain_whitelist.form.domain_too_short")) if domain.value.length <= 3
18
+ errors.add(:external_domains, I18n.t("decidim.admin.domain_allowlist.form.domain_too_short")) if domain.value.length <= 3
19
19
  end.map(&:value).uniq
20
20
  end
21
21
  end
@@ -10,7 +10,7 @@ module Decidim
10
10
 
11
11
  mimic :organization
12
12
 
13
- attribute :name, String
13
+ translatable_attribute :name, String
14
14
  attribute :reference_prefix, String
15
15
  attribute :time_zone, String
16
16
  attribute :twitter_handler, String
@@ -37,7 +37,7 @@ module Decidim
37
37
 
38
38
  validates :welcome_notification_subject, :welcome_notification_body, translatable_presence: true, if: proc { |form| form.customize_welcome_notification }
39
39
 
40
- validates :name, presence: true
40
+ validates :name, translatable_presence: true
41
41
  validates :time_zone, presence: true
42
42
  validates :time_zone, time_zone: true
43
43
  validates :default_locale, :reference_prefix, presence: true
@@ -11,7 +11,6 @@ module Decidim
11
11
  translatable_attribute :title, String
12
12
  translatable_attribute :content, String
13
13
  attribute :changed_notably, Boolean
14
- attribute :show_in_footer, Boolean
15
14
  attribute :allow_public_access, Boolean
16
15
  attribute :weight, Integer
17
16
  attribute :topic_id, Integer
@@ -32,7 +32,7 @@ module Decidim
32
32
  links.index_with { nil }
33
33
  end
34
34
 
35
- # To be overriden. Useful for adding links that do not match with the filter.
35
+ # To be overridden. Useful for adding links that do not match with the filter.
36
36
  # Must return an Array.
37
37
  def extra_dropdown_submenu_options_items(_filter, _i18n_scope)
38
38
  []
@@ -98,9 +98,14 @@ module Decidim
98
98
  end
99
99
 
100
100
  def applied_filters_tags(i18n_ctx)
101
- ransack_params.slice(*filters).map do |filter, value|
101
+ tags = ransack_params.slice(*filters).map do |filter, value|
102
102
  applied_filter_tag(filter, value, filterable_i18n_scope_from_ctx(i18n_ctx))
103
- end.join.html_safe
103
+ end
104
+ return if tags.blank?
105
+
106
+ tags << remove_all_filters_tag if tags.count > 1
107
+
108
+ tags.join.html_safe
104
109
  end
105
110
 
106
111
  def applied_filter_tag(filter, value, i18n_scope)
@@ -111,6 +116,13 @@ module Decidim
111
116
  end
112
117
  end
113
118
 
119
+ def remove_all_filters_tag
120
+ link_to(url_for(blank_query_params), class: "label bg-transparent") do
121
+ concat t("decidim.admin.filters.remove_all")
122
+ concat icon("delete-bin-line", aria_label: t("decidim.admin.filters.remove_all"), role: "img")
123
+ end
124
+ end
125
+
114
126
  def remove_filter_icon_link(filter)
115
127
  icon_link_to(
116
128
  "delete-bin-line",
@@ -125,6 +137,10 @@ module Decidim
125
137
  i18n_scope += ".#{i18n_ctx}" if i18n_ctx
126
138
  i18n_scope
127
139
  end
140
+
141
+ def filtered_adjacent_paths(item, path_method)
142
+ adjacent_items(item).transform_values(&method(path_method))
143
+ end
128
144
  end
129
145
  end
130
146
  end
@@ -25,9 +25,11 @@ module Decidim
25
25
  when Decidim::Meetings::Meeting
26
26
  content_tag :li do
27
27
  link_to resource_locator(author).path, target: "_blank", rel: "noopener" do
28
- decidim_sanitize(translated_attribute(author.title))
28
+ decidim_sanitize_translated(author.title)
29
29
  end
30
30
  end
31
+ when Decidim::Organization
32
+ content_tag :li, organization_name(author)
31
33
  else
32
34
  content_tag(:li, author.name)
33
35
  end
@@ -65,7 +65,7 @@ module Decidim
65
65
 
66
66
  def sent_to_spaces(newsletter)
67
67
  html = "<p style='margin-bottom:0;'> "
68
- newsletter.sended_to_partipatory_spaces.try(:each) do |type|
68
+ newsletter.sent_to_participatory_spaces.try(:each) do |type|
69
69
  next if type["ids"].blank?
70
70
 
71
71
  html += t("index.segmented_to", scope: "decidim.admin.newsletters", subject: t("activerecord.models.decidim/#{type["manifest_name"].singularize}.other"))
@@ -74,7 +74,7 @@ module Decidim
74
74
  else
75
75
  Decidim.find_participatory_space_manifest(type["manifest_name"].to_sym)
76
76
  .participatory_spaces.call(current_organization).where(id: type["ids"]).each do |space|
77
- html += "<strong>#{decidim_html_escape(translated_attribute(space.title))}</strong>"
77
+ html += "<strong>#{decidim_escape_translated(space.title)}</strong>"
78
78
  end
79
79
  end
80
80
  html += "<br/>"
@@ -88,7 +88,7 @@ module Decidim
88
88
  concat t("index.segmented_to", scope: "decidim.admin.newsletters", subject: nil)
89
89
  if newsletter.sent_scopes.any?
90
90
  newsletter.sent_scopes.each do |scope|
91
- concat content_tag(:strong, decidim_html_escape(translated_attribute(scope.name)).to_s)
91
+ concat content_tag(:strong, decidim_escape_translated(scope.name).to_s)
92
92
  end
93
93
  else
94
94
  concat content_tag(:strong, t("index.no_scopes", scope: "decidim.admin.newsletters"))
@@ -17,10 +17,10 @@ module Decidim
17
17
  private_user_form = ParticipatorySpacePrivateUserForm.from_params(params, privatable_to:)
18
18
  .with_context(
19
19
  current_user:,
20
- current_particiaptory_space: privatable_to
20
+ current_participatory_space: privatable_to
21
21
  )
22
22
 
23
- Decidim::Admin::CreateParticipatorySpacePrivateUser.call(private_user_form, current_user, privatable_to, via_csv: true)
23
+ Decidim::Admin::CreateParticipatorySpacePrivateUser.call(private_user_form, privatable_to, via_csv: true)
24
24
  end
25
25
  end
26
26
  end
@@ -8,7 +8,7 @@ import "src/decidim/admin/resources_permissions"
8
8
  import "src/decidim/admin/welcome_notification"
9
9
  import "src/decidim/admin/newsletters"
10
10
  import "src/decidim/admin/form"
11
- import "src/decidim/admin/external_domain_whitelist"
11
+ import "src/decidim/admin/external_domain_allowlist"
12
12
  import "src/decidim/admin/draggable-list"
13
13
  import "src/decidim/admin/sortable"
14
14
  import "src/decidim/admin/moderations"
@@ -17,6 +17,9 @@ import "src/decidim/slug_form"
17
17
  import "src/decidim/admin/admin_autocomplete"
18
18
  import "src/decidim/admin/triadic_color_picker"
19
19
  import "src/decidim/admin/participatory_space_search"
20
+ import "src/decidim/admin/css_preview"
21
+ import "src/decidim/admin/sync_radio_buttons"
22
+ import "src/decidim/admin/text_copy"
20
23
 
21
24
  // CSS
22
25
  import "entrypoints/decidim_admin.scss";
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable no-invalid-this */
2
2
 
3
- import toggleNav from "src/decidim/admin/toggle_nav"
4
- import createSortList from "src/decidim/admin/sort_list.component"
5
- import FormFilterComponent from "src/decidim/form_filter"
6
- import Configuration from "src/decidim/configuration"
7
- import InputCharacterCounter from "src/decidim/input_character_counter"
8
- import managedUsersForm from "src/decidim/admin/managed_users"
3
+ import toggleNav from "src/decidim/admin/toggle_nav";
4
+ import createSortList from "src/decidim/admin/sort_list.component";
5
+ import FormFilterComponent from "src/decidim/form_filter";
6
+ import Configuration from "src/decidim/configuration";
7
+ import InputCharacterCounter from "src/decidim/input_character_counter";
8
+ import managedUsersForm from "src/decidim/admin/managed_users";
9
9
 
10
10
  window.Decidim = window.Decidim || {};
11
- window.Decidim.managedUsersForm = managedUsersForm
12
- window.Decidim.config = new Configuration()
11
+ window.Decidim.managedUsersForm = managedUsersForm;
12
+ window.Decidim.config = new Configuration();
13
13
  window.Decidim.InputCharacterCounter = InputCharacterCounter;
14
14
 
15
15
  // REDESIGN_PENDING: deprecated
@@ -31,23 +31,27 @@ $(() => {
31
31
  toggleNav();
32
32
 
33
33
  createSortList("#steps tbody", {
34
- placeholder: $('<tr style="border-style: dashed; border-color: #000"><td colspan="4">&nbsp;</td></tr>')[0],
34
+ placeholder: $(
35
+ '<tr style="border-style: dashed; border-color: #000"><td colspan="4">&nbsp;</td></tr>'
36
+ )[0],
35
37
  onSortUpdate: ($children) => {
36
- const sortUrl = $("#steps tbody").data("sort-url")
37
- const order = $children.map((index, child) => $(child).data("id")).toArray();
38
+ const sortUrl = $("#steps tbody").data("sort-url");
39
+ const order = $children.
40
+ map((index, child) => $(child).data("id")).
41
+ toArray();
38
42
 
39
43
  $.ajax({
40
44
  method: "POST",
41
45
  url: sortUrl,
42
46
  contentType: "application/json",
43
- data: JSON.stringify({ items_ids: order }) }, // eslint-disable-line camelcase
44
- );
47
+ data: JSON.stringify({ items_ids: order }) // eslint-disable-line camelcase
48
+ });
45
49
  }
46
- })
50
+ });
47
51
 
48
52
  $("form.new_filter").each(function () {
49
53
  const formFilter = new FormFilterComponent($(this));
50
54
 
51
55
  formFilter.mountComponent();
52
- })
56
+ });
53
57
  });
@@ -0,0 +1,39 @@
1
+ // Preview CSS changes in real time through data attributes when the change event is dispatched.
2
+ //
3
+ // @example
4
+ // ```erb
5
+ // <%= form.radio_button :text_color, "Blue"
6
+ // data: {
7
+ // "css-preview" => true,
8
+ // "css-preview-updates" => "[data-css-example]:color:blue;"
9
+ // } %>
10
+ //
11
+ // <%= form.radio_button :text_color, "Red"
12
+ // data: {
13
+ // "css-preview" => true,
14
+ // "css-preview-updates" => "[data-css-example]:color:red;"
15
+ // } %>
16
+ //
17
+ // <div data-css-example>This is an example</div>
18
+ // ```
19
+ //
20
+ // It supports multiple rules separated by semicolons:
21
+ // selector:property:value; selector:property:value;
22
+ //
23
+ // for example:
24
+ // strong[data-css-example]:color:#0000ff; strong[data-css-example]:backgroundColor:#eeeeee;
25
+ //
26
+ window.addEventListener("DOMContentLoaded", () => {
27
+ document.querySelectorAll("input[data-css-preview=true]").forEach((element) => {
28
+ element.addEventListener("change", (event) => {
29
+ const updateRules = event.target.dataset.cssPreviewUpdates.split(";");
30
+
31
+ updateRules.forEach((rule) => {
32
+ const [target, property, value] = rule.split(":");
33
+ if (target !== "") {
34
+ document.querySelector(target).style[property.trim()] = value.trim();
35
+ }
36
+ });
37
+ })
38
+ })
39
+ })
@@ -28,7 +28,7 @@ $(() => {
28
28
  // - amendment_promotion_enabled
29
29
 
30
30
  // (1) Hides target fields if amendments_enabled component setting is NOT checked.
31
- // (2) Toggles visibilty of target fields when amendments_enabled component setting is clicked.
31
+ // (2) Toggles visibility of target fields when amendments_enabled component setting is clicked.
32
32
  const $amendmentsEnabled = $("input#component_settings_amendments_enabled");
33
33
 
34
34
  if ($amendmentsEnabled.length > 0) {
@@ -42,4 +42,21 @@ $(() => {
42
42
  $amendmentStepSettings.toggle();
43
43
  });
44
44
  }
45
+
46
+ // Toggles visibility of the attachments_allowed help text when the checkbox is clicked.
47
+ // Show the help text if the checkbox is checked.
48
+ const $attachmentsAllowedCheckbox = $("#component_settings_attachments_allowed");
49
+ const $attachmentsHelpText = $(".attachments_allowed_container .help-text");
50
+
51
+ if (!$attachmentsAllowedCheckbox.is(":checked")) {
52
+ $attachmentsHelpText.hide();
53
+ }
54
+
55
+ $attachmentsAllowedCheckbox.on("change", () => {
56
+ if ($attachmentsAllowedCheckbox.is(":checked")) {
57
+ $attachmentsHelpText.show();
58
+ } else {
59
+ $attachmentsHelpText.hide();
60
+ }
61
+ });
45
62
  });
@@ -25,7 +25,7 @@ const apiRequest = (query) => {
25
25
  /**
26
26
  * Resolves the different root fields for listing different participatory spaces
27
27
  * available in the instance. Returns all LIST kind root fields that list
28
- * records implemeting the ParticipatorySpaceInterface.
28
+ * records implementing the ParticipatorySpaceInterface.
29
29
  *
30
30
  * @returns {Promise} A promise resolving the root fields for querying different
31
31
  * participatory spaces.
@@ -1,10 +1,10 @@
1
1
  $(() => {
2
- const $limitiedTimeLabel = $("label[for='component_settings_proposal_edit_time_limited']")
2
+ const $limitedTimeLabel = $("label[for='component_settings_proposal_edit_time_limited']")
3
3
  const $limitedTimeRadioButton = $("#component_settings_proposal_edit_time_limited")
4
4
  const $infiniteTimeRadioButton = $("#component_settings_proposal_edit_time_infinite")
5
5
  const $editTimeContainer = $(".proposal_edit_before_minutes_container")
6
6
 
7
- $editTimeContainer.detach().appendTo($limitiedTimeLabel)
7
+ $editTimeContainer.detach().appendTo($limitedTimeLabel)
8
8
 
9
9
  if ($infiniteTimeRadioButton.is(":checked")) {
10
10
  $editTimeContainer.hide();
@@ -0,0 +1,27 @@
1
+ // Check one radio button when another is checked
2
+ //
3
+ // @example
4
+ // ```erb
5
+ // <%= form.radio_button :text_color, "Blue",
6
+ // data: {
7
+ // "sync-radio-buttons" => true,
8
+ // "sync-radio-buttons-value" => "unique-key"
9
+ // } %>
10
+ //
11
+ // <%= form.radio_button :bg_color, "Blue,"
12
+ // data: {
13
+ // "sync-radio-buttons-value-target" => "unique-key"
14
+ // } %>
15
+ // ```
16
+ //
17
+ window.addEventListener("DOMContentLoaded", () => {
18
+ document.querySelectorAll("input[data-sync-radio-buttons=true]").forEach((element) => {
19
+ element.addEventListener("change", (event) => {
20
+ const value = event.target.dataset.syncRadioButtonsValue;
21
+ const radio = document.querySelector(`input[data-sync-radio-buttons-value-target=${value}]`);
22
+
23
+ radio.checked = true;
24
+ radio.dispatchEvent(new Event("change"));
25
+ })
26
+ })
27
+ })
@@ -0,0 +1,19 @@
1
+ // Copy the value of a text input or textarea to another element.
2
+ //
3
+ // @example
4
+ // ```erb
5
+ // <%= form.translated :text_field, :example, data: { "text-copy" => true, "target" => "strong[data-copy-example]" } %>
6
+ //
7
+ // <div data-copy-example>
8
+ // <%= t(".preview") %>
9
+ // </div>
10
+ // ```
11
+ //
12
+ window.addEventListener("DOMContentLoaded", () => {
13
+ document.querySelectorAll("input[data-text-copy=true], textarea[data-text-copy=true]").forEach((element) => {
14
+ element.addEventListener("change", (event) => {
15
+ const target = document.querySelector(event.target.dataset.target);
16
+ target.innerText = event.target.value;
17
+ })
18
+ });
19
+ })
@@ -107,7 +107,7 @@
107
107
  }
108
108
 
109
109
  .fcell .label {
110
- @apply p-2 mb-2;
110
+ @apply p-2;
111
111
  }
112
112
 
113
113
  .card-section-draggable-list {
@@ -0,0 +1,62 @@
1
+ .wc-datepicker {
2
+ @apply z-[2];
3
+
4
+ &__current-month {
5
+ @apply mt-4;
6
+ }
7
+
8
+ &__next-month-button,
9
+ &__previous-month-button {
10
+ > svg {
11
+ @apply fill-none w-16 h-16;
12
+ }
13
+ }
14
+ }
15
+
16
+ .datepicker {
17
+ &__clock-button {
18
+ @apply top-0;
19
+ }
20
+
21
+ &__calendar-button {
22
+ @apply top-0;
23
+ }
24
+
25
+ &__pick-calendar {
26
+ @apply z-[3];
27
+ }
28
+
29
+ &__close-calendar {
30
+ @apply z-[3];
31
+ }
32
+
33
+ &__time-frame {
34
+ @apply z-[1];
35
+ }
36
+
37
+ &__hour-picker,
38
+ &__minute-picker {
39
+ @apply left-2 ml-px;
40
+ }
41
+
42
+ &__hour-down,
43
+ &__hour-up,
44
+ &__minute-up,
45
+ &__minute-down {
46
+ @apply h-6 w-full;
47
+
48
+ > svg {
49
+ @apply w-10 h-6 pr-1;
50
+ }
51
+ }
52
+ }
53
+
54
+ .item__edit {
55
+ &-form {
56
+ .form {
57
+ [type="number"].wc-datepicker__year-select {
58
+ @apply text-sm;
59
+ }
60
+ }
61
+ }
62
+ }
@@ -101,7 +101,7 @@
101
101
  }
102
102
 
103
103
  &-sticky {
104
- @apply w-full fixed left-0 bottom-0 bg-gray-2 border-t border-white;
104
+ @apply w-full fixed left-0 bottom-0 bg-gray-2 border-t border-white z-[4];
105
105
 
106
106
  &-container {
107
107
  @apply px-8 py-4 flex gap-x-4 justify-end;
@@ -16,6 +16,14 @@
16
16
  @apply font-normal;
17
17
  }
18
18
  }
19
+
20
+ &--with-action-options {
21
+ @apply flex-row flex-wrap;
22
+ }
23
+
24
+ &__action-options {
25
+ @apply flex bg-background p-8 w-full mt-4 w-full;
26
+ }
19
27
  }
20
28
 
21
29
  .item_show__content {
@@ -0,0 +1,5 @@
1
+ .proposal-status__color {
2
+ label {
3
+ @apply sr-only;
4
+ }
5
+ }
@@ -35,4 +35,6 @@
35
35
  @import "stylesheets/decidim/admin/_data_picker.scss";
36
36
  @import "stylesheets/decidim/admin/_legacy_foundation.scss";
37
37
  @import "stylesheets/decidim/admin/_sidebar-menu.scss";
38
+ @import "stylesheets/decidim/admin/_datepicker.scss";
38
39
  @import "stylesheets/decidim/admin/_minimap.scss";
40
+ @import "stylesheets/decidim/admin/_proposal_status.scss";
@@ -218,11 +218,11 @@ module Decidim
218
218
  @organization ||= context.fetch(:organization, nil) || context.fetch(:current_organization, nil)
219
219
  end
220
220
 
221
- def user_can_enter_space_area?(**args)
221
+ def user_can_enter_space_area?(**)
222
222
  return unless permission_action.action == :enter &&
223
223
  permission_action.subject == :space_area
224
224
 
225
- space_allows_admin_access_to_current_action?(**args)
225
+ space_allows_admin_access_to_current_action?(**)
226
226
  end
227
227
 
228
228
  def space_allows_admin_access_to_current_action?(require_admin_terms_accepted: false)
@@ -2,10 +2,10 @@
2
2
 
3
3
  module Decidim
4
4
  module Admin
5
- # A class used to filter users by whitelisted scope or searches on their
5
+ # A class used to filter users by allowed scope or searches on their
6
6
  # name
7
7
  class UserFilter < Decidim::Query
8
- WHITELISTED_STATE_SCOPES = %w(
8
+ ALLOWED_STATE_SCOPES = %w(
9
9
  officialized
10
10
  not_officialized
11
11
  managed
@@ -32,7 +32,7 @@ module Decidim
32
32
  @state = state
33
33
  end
34
34
 
35
- # List the User groups by the diferents filters.
35
+ # List the User groups by the different filters.
36
36
  def query
37
37
  users = scope
38
38
  users = filter_by_search(users)
@@ -50,7 +50,7 @@ module Decidim
50
50
  end
51
51
 
52
52
  def filter_by_state(users)
53
- return users unless WHITELISTED_STATE_SCOPES.include?(state)
53
+ return users unless ALLOWED_STATE_SCOPES.include?(state)
54
54
 
55
55
  users.public_send(state)
56
56
  end
@@ -24,7 +24,7 @@ module Decidim
24
24
  @state = state
25
25
  end
26
26
 
27
- # List the User groups by the diferent filters.
27
+ # List the User groups by the different filters.
28
28
  def query
29
29
  @user_groups = filter_by_search(@user_groups)
30
30
  @user_groups = filter_by_state(@user_groups)
@@ -14,7 +14,7 @@
14
14
  <thead>
15
15
  <tr>
16
16
  <th><%= t("activemodel.attributes.attachment_collection.name") %></th>
17
- <th class="actions"></th>
17
+ <th></th>
18
18
  </tr>
19
19
  </thead>
20
20
  <tbody>
@@ -17,8 +17,27 @@
17
17
  <%= form.select :attachment_collection_id, @form.attachment_collections.map { |c| [translated_attribute(c.name), c.id] }, include_blank: true %>
18
18
  </div>
19
19
 
20
- <div class="row column">
21
- <%= form.upload :file, button_class: "button button__sm button__transparent-secondary" %>
20
+ <div class="p-6" data-file-or-link-tabs-controller>
21
+ <%= cell "decidim/tab_panels", [
22
+ {
23
+ enabled: true,
24
+ id: "file",
25
+ text: "Upload file",
26
+ icon: "file-upload-line",
27
+ method: :cell,
28
+ selected: form.object.file.present?,
29
+ args: ["/decidim/attachments_file_tab", form]
30
+ },
31
+ {
32
+ enabled: true,
33
+ id: "link",
34
+ text: "Link",
35
+ icon: "link",
36
+ method: :cell,
37
+ selected: form.object.link.present?,
38
+ args: ["/decidim/attachments_link_tab", form]
39
+ }
40
+ ] %>
22
41
  </div>
23
42
  </div>
24
43
  </div>
@@ -18,7 +18,7 @@
18
18
  <th><%= t("models.attachment.fields.collection", scope: "decidim.admin") %></th>
19
19
  <th><%= t("models.attachment.fields.content_type", scope: "decidim.admin") %></th>
20
20
  <th><%= t("models.attachment.fields.file_size", scope: "decidim.admin") %></th>
21
- <th class="actions"></th>
21
+ <th></th>
22
22
  </tr>
23
23
  </thead>
24
24
  <tbody>
@@ -34,7 +34,7 @@
34
34
  <%= attachment.file_type %>
35
35
  </td>
36
36
  <td>
37
- <%= number_to_human_size(attachment.file_size) %>
37
+ <%= attachment.file? ? number_to_human_size(attachment.file_size) : "-" %>
38
38
  </td>
39
39
  <td class="table-list__actions">
40
40
  <% if allowed_to? :update, :attachment, attachment: attachment %>