decidim-admin 0.26.0 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-admin might be problematic. Click here for more details.

Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/admin/attachments_privacy_warning/show.erb +3 -0
  3. data/app/cells/decidim/admin/attachments_privacy_warning_cell.rb +19 -0
  4. data/app/commands/decidim/admin/block_user.rb +1 -1
  5. data/app/commands/decidim/admin/close_session_managed_user.rb +1 -1
  6. data/app/commands/decidim/admin/create_area.rb +1 -1
  7. data/app/commands/decidim/admin/create_area_type.rb +6 -3
  8. data/app/commands/decidim/admin/create_attachment.rb +14 -6
  9. data/app/commands/decidim/admin/create_attachment_collection.rb +13 -4
  10. data/app/commands/decidim/admin/create_category.rb +6 -4
  11. data/app/commands/decidim/admin/create_component.rb +1 -1
  12. data/app/commands/decidim/admin/create_import.rb +4 -5
  13. data/app/commands/decidim/admin/create_import_example.rb +1 -1
  14. data/app/commands/decidim/admin/create_newsletter.rb +1 -1
  15. data/app/commands/decidim/admin/create_participatory_space_private_user.rb +1 -1
  16. data/app/commands/decidim/admin/create_scope.rb +1 -1
  17. data/app/commands/decidim/admin/create_scope_type.rb +6 -3
  18. data/app/commands/decidim/admin/create_static_page.rb +1 -1
  19. data/app/commands/decidim/admin/create_static_page_topic.rb +1 -1
  20. data/app/commands/decidim/admin/deliver_newsletter.rb +6 -6
  21. data/app/commands/decidim/admin/destroy_area.rb +1 -1
  22. data/app/commands/decidim/admin/destroy_category.rb +6 -3
  23. data/app/commands/decidim/admin/destroy_component.rb +1 -1
  24. data/app/commands/decidim/admin/destroy_newsletter.rb +1 -1
  25. data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +1 -1
  26. data/app/commands/decidim/admin/destroy_scope.rb +1 -1
  27. data/app/commands/decidim/admin/destroy_share_token.rb +1 -1
  28. data/app/commands/decidim/admin/destroy_static_page.rb +1 -1
  29. data/app/commands/decidim/admin/destroy_static_page_topic.rb +1 -1
  30. data/app/commands/decidim/admin/hide_resource.rb +2 -2
  31. data/app/commands/decidim/admin/impersonate_user.rb +1 -1
  32. data/app/commands/decidim/admin/invite_admin.rb +1 -1
  33. data/app/commands/decidim/admin/officialize_user.rb +1 -1
  34. data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +7 -3
  35. data/app/commands/decidim/admin/process_user_group_verification_csv.rb +8 -4
  36. data/app/commands/decidim/admin/promote_managed_user.rb +1 -1
  37. data/app/commands/decidim/admin/publish_component.rb +1 -1
  38. data/app/commands/decidim/admin/reject_user_group.rb +1 -1
  39. data/app/commands/decidim/admin/remove_admin.rb +1 -1
  40. data/app/commands/decidim/admin/reorder_content_blocks.rb +1 -1
  41. data/app/commands/decidim/admin/transfer_user.rb +1 -1
  42. data/app/commands/decidim/admin/unblock_user.rb +1 -1
  43. data/app/commands/decidim/admin/unhide_resource.rb +1 -1
  44. data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
  45. data/app/commands/decidim/admin/unpublish_component.rb +1 -1
  46. data/app/commands/decidim/admin/unreport_resource.rb +1 -1
  47. data/app/commands/decidim/admin/unreport_user.rb +1 -1
  48. data/app/commands/decidim/admin/update_area.rb +1 -1
  49. data/app/commands/decidim/admin/update_area_type.rb +8 -3
  50. data/app/commands/decidim/admin/update_attachment.rb +4 -3
  51. data/app/commands/decidim/admin/update_attachment_collection.rb +8 -3
  52. data/app/commands/decidim/admin/update_category.rb +9 -5
  53. data/app/commands/decidim/admin/update_component.rb +8 -5
  54. data/app/commands/decidim/admin/update_component_permissions.rb +9 -6
  55. data/app/commands/decidim/admin/update_content_block.rb +1 -1
  56. data/app/commands/decidim/admin/update_external_domain_whitelist.rb +6 -3
  57. data/app/commands/decidim/admin/update_help_sections.rb +17 -3
  58. data/app/commands/decidim/admin/update_newsletter.rb +1 -1
  59. data/app/commands/decidim/admin/update_organization.rb +1 -1
  60. data/app/commands/decidim/admin/update_organization_appearance.rb +1 -1
  61. data/app/commands/decidim/admin/update_organization_tos_version.rb +1 -1
  62. data/app/commands/decidim/admin/update_resource_permissions.rb +2 -2
  63. data/app/commands/decidim/admin/update_scope.rb +1 -1
  64. data/app/commands/decidim/admin/update_scope_type.rb +8 -3
  65. data/app/commands/decidim/admin/update_static_page.rb +1 -1
  66. data/app/commands/decidim/admin/update_static_page_topic.rb +1 -1
  67. data/app/commands/decidim/admin/update_user_groups.rb +1 -1
  68. data/app/commands/decidim/admin/verify_user_group.rb +1 -1
  69. data/app/controllers/concerns/decidim/admin/filterable.rb +1 -1
  70. data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +3 -1
  71. data/app/controllers/decidim/admin/application_controller.rb +1 -0
  72. data/app/controllers/decidim/admin/area_types_controller.rb +6 -3
  73. data/app/controllers/decidim/admin/categories_controller.rb +3 -3
  74. data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
  75. data/app/controllers/decidim/admin/components/base_controller.rb +1 -0
  76. data/app/controllers/decidim/admin/components_controller.rb +1 -1
  77. data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +6 -3
  78. data/app/controllers/decidim/admin/concerns/has_attachments.rb +6 -3
  79. data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +7 -0
  80. data/app/controllers/decidim/admin/conflicts_controller.rb +3 -1
  81. data/app/controllers/decidim/admin/dashboard_controller.rb +4 -3
  82. data/app/controllers/decidim/admin/exports_controller.rb +4 -1
  83. data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
  84. data/app/controllers/decidim/admin/metrics_controller.rb +2 -1
  85. data/app/controllers/decidim/admin/moderations_controller.rb +9 -7
  86. data/app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb +1 -1
  87. data/app/controllers/decidim/admin/reminders_controller.rb +61 -0
  88. data/app/controllers/decidim/admin/resource_permissions_controller.rb +2 -2
  89. data/app/controllers/decidim/admin/scope_types_controller.rb +6 -3
  90. data/app/controllers/decidim/admin/static_pages_controller.rb +1 -7
  91. data/app/forms/decidim/admin/category_form.rb +1 -2
  92. data/app/forms/decidim/admin/component_form.rb +16 -7
  93. data/app/forms/decidim/admin/import_example_form.rb +1 -5
  94. data/app/forms/decidim/admin/import_form.rb +7 -10
  95. data/app/forms/decidim/admin/managed_user_promotion_form.rb +1 -1
  96. data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +7 -4
  97. data/app/forms/decidim/admin/permission_form.rb +9 -8
  98. data/app/forms/decidim/admin/permissions_form.rb +1 -10
  99. data/app/forms/decidim/admin/selective_newsletter_form.rb +1 -1
  100. data/app/forms/decidim/admin/user_group_csv_verification_form.rb +2 -2
  101. data/app/helpers/decidim/admin/bulk_actions_helper.rb +0 -4
  102. data/app/helpers/decidim/admin/moderations/reports_helper.rb +11 -2
  103. data/app/helpers/decidim/admin/newsletters_helper.rb +1 -1
  104. data/app/helpers/decidim/admin/reminders_helper.rb +12 -0
  105. data/app/packs/entrypoints/decidim_admin.js +2 -1
  106. data/app/packs/src/decidim/admin/admin_autocomplete.js +82 -0
  107. data/app/packs/src/decidim/admin/application.js +0 -16
  108. data/app/packs/stylesheets/decidim/admin/_decidim.scss +0 -1
  109. data/app/packs/stylesheets/decidim/admin/modules/_autocomplete.scss +5 -0
  110. data/app/packs/stylesheets/decidim/admin/modules/_modules.scss +2 -0
  111. data/app/packs/stylesheets/decidim/admin/modules/_upload_modal.scss +42 -0
  112. data/app/permissions/decidim/admin/permissions.rb +1 -0
  113. data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +3 -1
  114. data/app/queries/decidim/admin/active_users_counter.rb +1 -1
  115. data/app/queries/decidim/admin/newsletter_recipients.rb +5 -4
  116. data/app/queries/decidim/admin/user_filter.rb +1 -1
  117. data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
  118. data/app/views/decidim/admin/attachments/index.html.erb +1 -0
  119. data/app/views/decidim/admin/categories/_form.html.erb +0 -4
  120. data/app/views/decidim/admin/categories/show.html.erb +1 -2
  121. data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +6 -6
  122. data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -4
  123. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
  124. data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +20 -1
  125. data/app/views/decidim/admin/reminders/new.html.erb +21 -0
  126. data/app/views/decidim/admin/shared/_gallery.html.erb +6 -1
  127. data/app/views/decidim/admin/shared/_js-callout.html.erb +6 -0
  128. data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
  129. data/app/views/layouts/decidim/admin/_application.html.erb +2 -0
  130. data/config/locales/am-ET.yml +1 -0
  131. data/config/locales/ar.yml +242 -28
  132. data/config/locales/bg.yml +1 -0
  133. data/config/locales/ca.yml +28 -6
  134. data/config/locales/cs.yml +29 -5
  135. data/config/locales/da.yml +1 -0
  136. data/config/locales/de.yml +47 -5
  137. data/config/locales/el.yml +1 -6
  138. data/config/locales/en.yml +26 -5
  139. data/config/locales/eo.yml +1 -0
  140. data/config/locales/es-MX.yml +27 -5
  141. data/config/locales/es-PY.yml +27 -5
  142. data/config/locales/es.yml +28 -6
  143. data/config/locales/et.yml +1 -0
  144. data/config/locales/eu.yml +1 -6
  145. data/config/locales/fi-plain.yml +27 -5
  146. data/config/locales/fi.yml +27 -5
  147. data/config/locales/fr-CA.yml +26 -4
  148. data/config/locales/fr.yml +26 -4
  149. data/config/locales/ga-IE.yml +1 -1
  150. data/config/locales/gl.yml +16 -5
  151. data/config/locales/hr.yml +1 -0
  152. data/config/locales/hu.yml +25 -4
  153. data/config/locales/id-ID.yml +1 -3
  154. data/config/locales/is-IS.yml +2 -4
  155. data/config/locales/it.yml +6 -6
  156. data/config/locales/ja.yml +38 -17
  157. data/config/locales/ko.yml +1 -0
  158. data/config/locales/lb.yml +1 -6
  159. data/config/locales/lt.yml +946 -0
  160. data/config/locales/lv.yml +1 -3
  161. data/config/locales/mt.yml +1 -0
  162. data/config/locales/nl.yml +1 -6
  163. data/config/locales/no.yml +13 -7
  164. data/config/locales/om-ET.yml +1 -0
  165. data/config/locales/pl.yml +82 -5
  166. data/config/locales/pt-BR.yml +2 -7
  167. data/config/locales/pt.yml +1 -6
  168. data/config/locales/ro-RO.yml +7 -6
  169. data/config/locales/ru.yml +1 -3
  170. data/config/locales/si-LK.yml +1 -0
  171. data/config/locales/sk.yml +1 -3
  172. data/config/locales/sl.yml +1 -0
  173. data/config/locales/so-SO.yml +1 -0
  174. data/config/locales/sr-CS.yml +1 -2
  175. data/config/locales/sv.yml +30 -8
  176. data/config/locales/sw-KE.yml +1 -0
  177. data/config/locales/ti-ER.yml +1 -0
  178. data/config/locales/tr-TR.yml +1 -4
  179. data/config/locales/uk.yml +1 -2
  180. data/config/locales/val-ES.yml +1 -0
  181. data/config/locales/vi.yml +1 -0
  182. data/config/locales/zh-CN.yml +1 -3
  183. data/config/locales/zh-TW.yml +1 -0
  184. data/lib/decidim/admin/engine.rb +0 -1
  185. data/lib/decidim/admin/import/importer.rb +9 -7
  186. data/lib/decidim/admin/import/readers/json.rb +1 -1
  187. data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +15 -2
  188. data/lib/decidim/admin/test/commands/create_category_examples.rb +16 -6
  189. data/lib/decidim/admin/test/commands/destroy_category_examples.rb +29 -1
  190. data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +15 -2
  191. data/lib/decidim/admin/test/commands/update_category_examples.rb +16 -6
  192. data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +4 -4
  193. data/lib/decidim/admin/test/filters_participatory_space_users_examples.rb +4 -4
  194. data/lib/decidim/admin/test/forms/category_form_examples.rb +1 -21
  195. data/lib/decidim/admin/test/manage_attachments_examples.rb +9 -2
  196. data/lib/decidim/admin/test/manage_categories_examples.rb +0 -10
  197. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +0 -2
  198. data/lib/decidim/admin/test/manage_moderations_examples.rb +26 -0
  199. data/lib/decidim/admin/version.rb +1 -1
  200. metadata +21 -15
  201. data/app/packs/src/decidim/admin/autocomplete.component.js +0 -146
  202. data/app/packs/src/decidim/admin/autocomplete.component.test.js +0 -19
  203. data/app/packs/stylesheets/decidim/admin/components/_autocomplete_select.component.scss +0 -19
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sv:
2
3
  activemodel:
3
4
  attributes:
@@ -123,6 +124,10 @@ sv:
123
124
  file: Fil
124
125
  errors:
125
126
  models:
127
+ newsletter:
128
+ attributes:
129
+ base:
130
+ at_least_one_space: Välj minst ett deltagarutrymme
126
131
  organization:
127
132
  attributes:
128
133
  official_img_footer:
@@ -256,6 +261,8 @@ sv:
256
261
  update:
257
262
  error: Det gick inte att uppdatera bilagan.
258
263
  success: Bilagan har uppdaterats.
264
+ attachments_privacy_warning:
265
+ message: Var försiktig när du arbetar med bilagor i ett privat utrymme. En deltagare skulle kunna dela detta dokument utanför plattformen.
259
266
  autocomplete:
260
267
  no_results: Hittade inga resultat
261
268
  search_prompt: Sök genom att skriva minst tre tecken
@@ -338,7 +345,7 @@ sv:
338
345
  dashboard:
339
346
  show:
340
347
  view_more_logs: Visa fler loggar
341
- welcome: Välkommen till Decidims administratörspanel.
348
+ welcome: Välkommen till Adminpanelen.
342
349
  domain_whitelist:
343
350
  form:
344
351
  domain_too_short: Domänen är för kort
@@ -521,7 +528,7 @@ sv:
521
528
  area_types: Typer av område
522
529
  areas: Områden
523
530
  configuration: Konfiguration
524
- dashboard: Kontrollpanel
531
+ dashboard: Adminpanel
525
532
  external_domain_whitelist: Tillåtna externa domäner
526
533
  help_sections: Hjälpavsnitt
527
534
  homepage: Hemsida
@@ -532,7 +539,7 @@ sv:
532
539
  reported_users: Rapporterade användare
533
540
  scope_types: Omfattningstyper
534
541
  scopes: Omfattningar
535
- settings: inställningar
542
+ settings: Inställningar
536
543
  static_pages: Sidor
537
544
  user_groups: Grupper
538
545
  users: Deltagare
@@ -831,9 +838,23 @@ sv:
831
838
  invalid: Det gick inte att läsa CSV-filen.
832
839
  success: CSV-filen har skickats in och vi skickar inbjudningar via e-brev till deltagarna. Det kan ta en stund.
833
840
  new:
841
+ destroy:
842
+ button: Radera alla privata deltagare
843
+ confirm: Är du säker på att du vill radera alla privata deltagare? Den här åtgärden kan inte ångras.
844
+ empty: Det finns inga privata deltagare.
845
+ explanation: Det finns %{count} privata deltagare.
846
+ title: Radera privata deltagare
834
847
  explanation: 'Skicka in din CSV-fil. Den måste ha två kolumner över de användare som du vill lägga till deltagarutrymmet, utan rubriker, med e-postadressen i den första kolumnen i filen och namnet i den sista kolumnen i filen (e-post, namn). Undvik olämpliga karaktärer som `<>?%&^*#@()[]=+:;"{}\|` i användarnamn.'
835
848
  title: Skicka CSV-fil
836
849
  upload: Skicka
850
+ reminders:
851
+ create:
852
+ error: Det gick inte att skapa påminnelser.
853
+ success:
854
+ one: "%{count} användare kommer påminnas."
855
+ other: "%{count} användare kommer påminnas."
856
+ new:
857
+ submit: Skicka
837
858
  resource_permissions:
838
859
  edit:
839
860
  submit: Skicka in
@@ -891,6 +912,7 @@ sv:
891
912
  gallery:
892
913
  add_images: Lägg till bilder
893
914
  delete_image: Ta bort bild
915
+ edit_images: Redigera bilder
894
916
  gallery_legend: Lägg till ett bildgalleri (Frivilligt)
895
917
  static_page_topics:
896
918
  create:
@@ -940,7 +962,7 @@ sv:
940
962
  area_types: Områdestyper
941
963
  areas: Områden
942
964
  authorization_workflows: Verifieringsmetoder
943
- dashboard: Kontrollpanel
965
+ dashboard: Adminpanel
944
966
  impersonatable_users: Hanterbara deltagare
945
967
  impersonations: Deltagarhantering
946
968
  metrics: Metrik
@@ -951,7 +973,7 @@ sv:
951
973
  static_pages: Sidor
952
974
  statistics: Aktivitet
953
975
  user_groups: Grupper
954
- users: Deltagare
976
+ users: Administratörer
955
977
  user_group:
956
978
  csv_verify:
957
979
  invalid: Det gick inte att läsa CSV-filen.
@@ -987,7 +1009,7 @@ sv:
987
1009
  role: Roll
988
1010
  new:
989
1011
  create: Bjud in
990
- title: Bjud in användaren som administratör
1012
+ title: Bjud in ny administratör
991
1013
  users_statistics:
992
1014
  users_count:
993
1015
  admins: Administratörer
@@ -1038,7 +1060,7 @@ sv:
1038
1060
  hidden_at: Dold
1039
1061
  participatory_space: Deltagarutrymme
1040
1062
  report_count: Antal
1041
- reportable_id: Id
1063
+ reportable_id: ID
1042
1064
  reportable_type: Typ
1043
1065
  reported_content_url: Rapporterad innehållsadress
1044
1066
  reports: Rapporter
@@ -1059,6 +1081,6 @@ sv:
1059
1081
  newsletters:
1060
1082
  title: Nyhetsbrev
1061
1083
  settings:
1062
- title: inställningar
1084
+ title: Inställningar
1063
1085
  users:
1064
1086
  title: Deltagare
@@ -1 +1,2 @@
1
+ ---
1
2
  sw:
@@ -1 +1,2 @@
1
+ ---
1
2
  ti:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  tr:
2
3
  activemodel:
3
4
  attributes:
@@ -296,7 +297,6 @@ tr:
296
297
  dashboard:
297
298
  show:
298
299
  view_more_logs: Daha fazla günlükleri görüntüle
299
- welcome: Decidim Yönetici Paneline hoş geldiniz.
300
300
  exports:
301
301
  export_as: "%{name} olarak %{export_format}"
302
302
  formats:
@@ -801,7 +801,6 @@ tr:
801
801
  static_pages: Sayfalar
802
802
  statistics: Aktivite
803
803
  user_groups: Kullanıcı Grupları
804
- users: Katılımcılar
805
804
  user_group:
806
805
  csv_verify:
807
806
  invalid: CSV dosyasını okurken bir hata oluştu.
@@ -837,7 +836,6 @@ tr:
837
836
  role: Rol
838
837
  new:
839
838
  create: Davet et
840
- title: Kullanıcıyı yönetici olarak davet et
841
839
  users_statistics:
842
840
  users_count:
843
841
  admins: Yöneticiler
@@ -874,7 +872,6 @@ tr:
874
872
  hidden_at: Gizli
875
873
  participatory_space: Katılımcı alanı
876
874
  report_count: saymak
877
- reportable_id: Id
878
875
  reportable_type: Türü
879
876
  reported_content_url: Raporlanan içerik URL'si
880
877
  reports: Raporlar
@@ -1,3 +1,4 @@
1
+ ---
1
2
  uk:
2
3
  activemodel:
3
4
  attributes:
@@ -223,7 +224,6 @@ uk:
223
224
  dashboard:
224
225
  show:
225
226
  view_more_logs: Переглянути інші журнали
226
- welcome: Ласкаво просимо до адмін-панелі Десідім!
227
227
  exports:
228
228
  export_as: "%{name} як %{export_format}"
229
229
  notice: Зараз відбувається збереження у вигляді файлу. Ви отримаєте електронного листа після його завершення.
@@ -557,7 +557,6 @@ uk:
557
557
  role: Роль
558
558
  new:
559
559
  create: Запросити
560
- title: Запросити учасника в якості адміністратора
561
560
  users_statistics:
562
561
  users_count:
563
562
  admins: Адміністратори
@@ -1,3 +1,4 @@
1
+ ---
1
2
  val:
2
3
  decidim:
3
4
  admin:
@@ -1 +1,2 @@
1
+ ---
1
2
  vi:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  zh-CN:
2
3
  activemodel:
3
4
  attributes:
@@ -273,7 +274,6 @@ zh-CN:
273
274
  dashboard:
274
275
  show:
275
276
  view_more_logs: 查看更多日志
276
- welcome: 欢迎来到Decidim管理面板
277
277
  exports:
278
278
  export_as: "%{name} 为 %{export_format}"
279
279
  formats:
@@ -731,7 +731,6 @@ zh-CN:
731
731
  static_pages: 页 次
732
732
  statistics: 活动
733
733
  user_groups: 群組
734
- users: 参加者
735
734
  user_group:
736
735
  csv_verify:
737
736
  invalid: 读取CSV文件时出现问题。
@@ -767,7 +766,6 @@ zh-CN:
767
766
  role: 作用
768
767
  new:
769
768
  create: 邀请
770
- title: 邀请参与者作为管理员
771
769
  users_statistics:
772
770
  users_count:
773
771
  admins: 管理员
@@ -1 +1,2 @@
1
+ ---
1
2
  zh-TW:
@@ -7,7 +7,6 @@ require "devise"
7
7
  require "devise-i18n"
8
8
  require "decidim/core"
9
9
  require "foundation_rails_helper"
10
- require "rectify"
11
10
  require "doorkeeper"
12
11
  require "doorkeeper-i18n"
13
12
  require "hashdiff"
@@ -10,6 +10,8 @@ module Decidim
10
10
  # You can also use the ImporterFactory class to create an Importer
11
11
  # instance.
12
12
  class Importer
13
+ include Decidim::ProcessesFileLocally
14
+
13
15
  delegate :errors, to: :verifier
14
16
 
15
17
  # Public: Initializes an Importer.
@@ -72,15 +74,15 @@ module Decidim
72
74
  return @collection_data if @collection_data
73
75
 
74
76
  @collection_data = []
75
- reader.new(file).read_rows do |rowdata, index|
76
- if index.zero?
77
- @data_headers = rowdata.map { |d| d.to_s.to_sym }
78
- else
79
- @collection_data << Hash[
80
- rowdata.each_with_index.map do |val, ind|
77
+ process_file_locally(file) do |file_path|
78
+ reader.new(file_path).read_rows do |rowdata, index|
79
+ if index.zero?
80
+ @data_headers = rowdata.map { |d| d.to_s.to_sym }
81
+ else
82
+ @collection_data << rowdata.each_with_index.to_h do |val, ind|
81
83
  [@data_headers[ind], val]
82
84
  end
83
- ]
85
+ end
84
86
  end
85
87
  end
86
88
 
@@ -39,7 +39,7 @@ module Decidim
39
39
  columns = data.shift
40
40
  json_data = data.map do |row|
41
41
  deep_hash(
42
- columns.each_with_index.map { |col, ind| [col, row[ind]] }.to_h
42
+ columns.each_with_index.to_h { |col, ind| [col, row[ind]] }
43
43
  )
44
44
  end
45
45
 
@@ -7,6 +7,7 @@ module Decidim
7
7
  shared_examples_for "CreateAttachmentCollection command" do
8
8
  describe "call" do
9
9
  let(:organization) { create(:organization) }
10
+ let(:user) { create(:user, organization: organization) }
10
11
  let(:form_params) do
11
12
  {
12
13
  "attachment_collection" => {
@@ -27,11 +28,11 @@ module Decidim
27
28
  current_organization: organization
28
29
  )
29
30
  end
30
- let(:command) { described_class.new(form, collection_for) }
31
+ let(:command) { described_class.new(form, collection_for, user) }
31
32
 
32
33
  describe "when the form is not valid" do
33
34
  before do
34
- expect(form).to receive(:invalid?).and_return(true)
35
+ allow(form).to receive(:invalid?).and_return(true)
35
36
  end
36
37
 
37
38
  it "broadcasts invalid" do
@@ -55,6 +56,18 @@ module Decidim
55
56
  command.call
56
57
  end.to change(collection_for.attachment_collections, :count).by(1)
57
58
  end
59
+
60
+ it "traces the action", versioning: true do
61
+ expect(Decidim.traceability)
62
+ .to receive(:perform_action!)
63
+ .with(:create, Decidim::AttachmentCollection, user, {})
64
+ .and_call_original
65
+
66
+ expect { command.call }.to change(Decidim::ActionLog, :count)
67
+ action_log = Decidim::ActionLog.last
68
+ expect(action_log.action).to eq("create")
69
+ expect(action_log.version).to be_present
70
+ end
58
71
  end
59
72
  end
60
73
  end
@@ -7,15 +7,13 @@ module Decidim
7
7
  shared_examples_for "CreateCategory command" do
8
8
  describe "call" do
9
9
  let(:organization) { create(:organization) }
10
+ let(:user) { create(:user, organization: organization) }
10
11
  let(:form_params) do
11
12
  {
12
13
  "category" => {
13
14
  "name_en" => Decidim::Faker::Localized.paragraph(sentence_count: 3),
14
15
  "name_es" => Decidim::Faker::Localized.paragraph(sentence_count: 3),
15
- "name_ca" => Decidim::Faker::Localized.paragraph(sentence_count: 3),
16
- "description_en" => Decidim::Faker::Localized.paragraph(sentence_count: 3),
17
- "description_es" => Decidim::Faker::Localized.paragraph(sentence_count: 3),
18
- "description_ca" => Decidim::Faker::Localized.paragraph(sentence_count: 3)
16
+ "name_ca" => Decidim::Faker::Localized.paragraph(sentence_count: 3)
19
17
  }
20
18
  }
21
19
  end
@@ -27,11 +25,11 @@ module Decidim
27
25
  current_organization: organization
28
26
  )
29
27
  end
30
- let(:command) { described_class.new(form, participatory_space) }
28
+ let(:command) { described_class.new(form, participatory_space, user) }
31
29
 
32
30
  describe "when the form is not valid" do
33
31
  before do
34
- expect(form).to receive(:invalid?).and_return(true)
32
+ allow(form).to receive(:invalid?).and_return(true)
35
33
  end
36
34
 
37
35
  it "broadcasts invalid" do
@@ -55,6 +53,18 @@ module Decidim
55
53
  command.call
56
54
  end.to change(participatory_space.categories, :count).by(1)
57
55
  end
56
+
57
+ it "traces the action", versioning: true do
58
+ expect(Decidim.traceability)
59
+ .to receive(:perform_action!)
60
+ .with(:create, Decidim::Category, user, {})
61
+ .and_call_original
62
+
63
+ expect { command.call }.to change(Decidim::ActionLog, :count)
64
+ action_log = Decidim::ActionLog.last
65
+ expect(action_log.action).to eq("create")
66
+ expect(action_log.version).to be_present
67
+ end
58
68
  end
59
69
  end
60
70
  end
@@ -7,8 +7,9 @@ module Decidim
7
7
  shared_examples_for "DestroyCategory command" do
8
8
  describe "call" do
9
9
  let(:organization) { create(:organization) }
10
+ let(:user) { create(:user, organization: organization) }
10
11
  let(:category) { create(:category, participatory_space: participatory_space) }
11
- let(:command) { described_class.new(category) }
12
+ let(:command) { described_class.new(category, user) }
12
13
 
13
14
  describe "when the category is not present" do
14
15
  let(:category) { nil }
@@ -28,6 +29,21 @@ module Decidim
28
29
  end
29
30
  end
30
31
 
32
+ context "when the category is a subcategory" do
33
+ let!(:parent_category) { create :category, participatory_space: participatory_space }
34
+
35
+ before do
36
+ category.parent = parent_category
37
+ end
38
+
39
+ it "destroy the category" do
40
+ category
41
+ expect do
42
+ command.call
43
+ end.to change(Category, :count).by(-1)
44
+ end
45
+ end
46
+
31
47
  describe "when the data is valid" do
32
48
  it "broadcasts ok" do
33
49
  expect { command.call }.to broadcast(:ok)
@@ -39,6 +55,18 @@ module Decidim
39
55
  command.call
40
56
  end.to change(Category, :count).by(-1)
41
57
  end
58
+
59
+ it "traces the action", versioning: true do
60
+ expect(Decidim.traceability)
61
+ .to receive(:perform_action!)
62
+ .with(:delete, category, user)
63
+ .and_call_original
64
+
65
+ expect { command.call }.to change(Decidim::ActionLog, :count)
66
+ action_log = Decidim::ActionLog.last
67
+ expect(action_log.action).to eq("delete")
68
+ expect(action_log.version).to be_present
69
+ end
42
70
  end
43
71
  end
44
72
  end
@@ -7,6 +7,7 @@ module Decidim
7
7
  shared_examples_for "UpdateAttachmentCollection command" do
8
8
  describe "call" do
9
9
  let(:organization) { create(:organization) }
10
+ let(:user) { create(:user, organization: organization) }
10
11
  let(:attachment_collection) { create(:attachment_collection, collection_for: collection_for) }
11
12
  let(:form_params) do
12
13
  {
@@ -28,11 +29,11 @@ module Decidim
28
29
  current_organization: organization
29
30
  )
30
31
  end
31
- let(:command) { described_class.new(attachment_collection, form) }
32
+ let(:command) { described_class.new(attachment_collection, form, user) }
32
33
 
33
34
  describe "when the form is not valid" do
34
35
  before do
35
- expect(form).to receive(:invalid?).and_return(true)
36
+ allow(form).to receive(:invalid?).and_return(true)
36
37
  end
37
38
 
38
39
  it "broadcasts invalid" do
@@ -58,6 +59,18 @@ module Decidim
58
59
 
59
60
  expect(translated(attachment_collection.name)).to eq("New title")
60
61
  end
62
+
63
+ it "traces the action", versioning: true do
64
+ expect(Decidim.traceability)
65
+ .to receive(:perform_action!)
66
+ .with(:update, Decidim::AttachmentCollection, user, {})
67
+ .and_call_original
68
+
69
+ expect { command.call }.to change(Decidim::ActionLog, :count)
70
+ action_log = Decidim::ActionLog.last
71
+ expect(action_log.action).to eq("update")
72
+ expect(action_log.version).to be_present
73
+ end
61
74
  end
62
75
  end
63
76
  end
@@ -7,16 +7,14 @@ module Decidim
7
7
  shared_examples_for "UpdateCategory command" do
8
8
  describe "call" do
9
9
  let(:organization) { create(:organization) }
10
+ let(:user) { create(:user, organization: organization) }
10
11
  let(:category) { create(:category, participatory_space: participatory_space) }
11
12
  let(:form_params) do
12
13
  {
13
14
  "category" => {
14
15
  "name_en" => "New title",
15
16
  "name_es" => "Title",
16
- "name_ca" => "Title",
17
- "description_en" => "Description",
18
- "description_es" => "Description",
19
- "description_ca" => "Description"
17
+ "name_ca" => "Title"
20
18
  }
21
19
  }
22
20
  end
@@ -28,11 +26,11 @@ module Decidim
28
26
  current_organization: organization
29
27
  )
30
28
  end
31
- let(:command) { described_class.new(category, form) }
29
+ let(:command) { described_class.new(category, form, user) }
32
30
 
33
31
  describe "when the form is not valid" do
34
32
  before do
35
- expect(form).to receive(:invalid?).and_return(true)
33
+ allow(form).to receive(:invalid?).and_return(true)
36
34
  end
37
35
 
38
36
  it "broadcasts invalid" do
@@ -58,6 +56,18 @@ module Decidim
58
56
 
59
57
  expect(translated(category.name)).to eq("New title")
60
58
  end
59
+
60
+ it "traces the action", versioning: true do
61
+ expect(Decidim.traceability)
62
+ .to receive(:perform_action!)
63
+ .with(:update, Decidim::Category, user, {})
64
+ .and_call_original
65
+
66
+ expect { command.call }.to change(Decidim::ActionLog, :count)
67
+ action_log = Decidim::ActionLog.last
68
+ expect(action_log.action).to eq("update")
69
+ expect(action_log.version).to be_present
70
+ end
61
71
  end
62
72
  end
63
73
  end
@@ -99,7 +99,7 @@ shared_examples "filterable participatory space user roles" do
99
99
  apply_filter("Invite accepted", "Yes")
100
100
 
101
101
  within ".stack tbody" do
102
- expect(page).to have_content(invited_user_2.name)
102
+ expect(page).to have_content(invited_user2.name)
103
103
  expect(page).to have_css("tr", count: 1)
104
104
  end
105
105
  end
@@ -110,7 +110,7 @@ shared_examples "filterable participatory space user roles" do
110
110
  apply_filter("Invite accepted", "No")
111
111
 
112
112
  within ".stack tbody" do
113
- expect(page).to have_content(invited_user_1.name)
113
+ expect(page).to have_content(invited_user1.name)
114
114
  expect(page).to have_css("tr", count: 1)
115
115
  end
116
116
  end
@@ -123,7 +123,7 @@ shared_examples "filterable participatory space user roles" do
123
123
  apply_filter("Ever logged in", "Yes")
124
124
 
125
125
  within ".stack tbody" do
126
- expect(page).to have_content(invited_user_2.name)
126
+ expect(page).to have_content(invited_user2.name)
127
127
  expect(page).to have_css("tr", count: 1)
128
128
  end
129
129
  end
@@ -134,7 +134,7 @@ shared_examples "filterable participatory space user roles" do
134
134
  apply_filter("Ever logged in", "No")
135
135
 
136
136
  within ".stack tbody" do
137
- expect(page).to have_content(invited_user_1.name)
137
+ expect(page).to have_content(invited_user1.name)
138
138
  expect(page).to have_css("tr", count: 1)
139
139
  end
140
140
  end
@@ -7,7 +7,7 @@ shared_examples "filterable participatory space users" do
7
7
  apply_filter("Invitation sent", "Not sent")
8
8
 
9
9
  within ".stack tbody" do
10
- expect(page).to have_content(invited_user_2.name)
10
+ expect(page).to have_content(invited_user2.name)
11
11
  expect(page).to have_css("tr", count: 1)
12
12
  end
13
13
  end
@@ -18,7 +18,7 @@ shared_examples "filterable participatory space users" do
18
18
  apply_filter("Invitation sent", "Sent")
19
19
 
20
20
  within ".stack tbody" do
21
- expect(page).to have_content(invited_user_1.name)
21
+ expect(page).to have_content(invited_user1.name)
22
22
  expect(page).to have_css("tr", count: 1)
23
23
  end
24
24
  end
@@ -31,7 +31,7 @@ shared_examples "filterable participatory space users" do
31
31
  apply_filter("Invitation accepted", "Not accepted")
32
32
 
33
33
  within ".stack tbody" do
34
- expect(page).to have_content(invited_user_2.name)
34
+ expect(page).to have_content(invited_user2.name)
35
35
  expect(page).to have_css("tr", count: 1)
36
36
  end
37
37
  end
@@ -42,7 +42,7 @@ shared_examples "filterable participatory space users" do
42
42
  apply_filter("Invitation accepted", "Accepted")
43
43
 
44
44
  within ".stack tbody" do
45
- expect(page).to have_content(invited_user_1.name)
45
+ expect(page).to have_content(invited_user1.name)
46
46
  expect(page).to have_css("tr", count: 1)
47
47
  end
48
48
  end
@@ -21,13 +21,6 @@ module Decidim
21
21
  ca: "Nom"
22
22
  }
23
23
  end
24
- let(:description) do
25
- {
26
- en: "Description",
27
- es: "Descripción",
28
- ca: "Descripció"
29
- }
30
- end
31
24
  let(:parent_id) { nil }
32
25
  let(:attributes) do
33
26
  {
@@ -35,10 +28,7 @@ module Decidim
35
28
  "name_en" => name[:en],
36
29
  "name_es" => name[:es],
37
30
  "name_ca" => name[:ca],
38
- "parent_id" => parent_id,
39
- "description_en" => description[:en],
40
- "description_es" => description[:es],
41
- "description_ca" => description[:ca]
31
+ "parent_id" => parent_id
42
32
  }
43
33
  }
44
34
  end
@@ -59,16 +49,6 @@ module Decidim
59
49
  it { is_expected.to be_invalid }
60
50
  end
61
51
 
62
- context "when some language in description is missing" do
63
- let(:description) do
64
- {
65
- ca: "Descripció"
66
- }
67
- end
68
-
69
- it { is_expected.to be_invalid }
70
- end
71
-
72
52
  context "when the parent_id is set" do
73
53
  let!(:category) { create :category, participatory_space: participatory_space }
74
54
 
@@ -48,8 +48,11 @@ shared_examples "manage attachments examples" do
48
48
  es: "Este documento contiene información importante",
49
49
  ca: "Aquest document conté informació important"
50
50
  )
51
+ end
52
+
53
+ dynamically_attach_file(:attachment_file, Decidim::Dev.asset("Exampledocument.pdf"))
51
54
 
52
- attach_file :attachment_file, Decidim::Dev.asset("Exampledocument.pdf")
55
+ within ".new_attachment" do
53
56
  find("*[type=submit]").click
54
57
  end
55
58
 
@@ -81,7 +84,11 @@ shared_examples "manage attachments examples" do
81
84
  )
82
85
 
83
86
  select translated(attachment_collection.name, locale: :en), from: "attachment_attachment_collection_id"
84
- attach_file :attachment_file, Decidim::Dev.asset("Exampledocument.pdf")
87
+ end
88
+
89
+ dynamically_attach_file(:attachment_file, Decidim::Dev.asset("Exampledocument.pdf"))
90
+
91
+ within ".new_attachment" do
85
92
  find("*[type=submit]").click
86
93
  end
87
94