decidim-admin 0.29.2 → 0.30.0.rc2

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 (236) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/admin/multi_select_picker/show.erb +10 -0
  3. data/app/cells/decidim/admin/multi_select_picker_cell.rb +38 -0
  4. data/app/commands/decidim/admin/bulk_action.rb +92 -0
  5. data/app/commands/decidim/admin/bulk_block_users.rb +75 -0
  6. data/app/commands/decidim/admin/bulk_unblock_users.rb +66 -0
  7. data/app/commands/decidim/admin/bulk_unreport_users.rb +69 -0
  8. data/app/commands/decidim/admin/content_blocks/update_content_block.rb +1 -1
  9. data/app/commands/decidim/admin/create_participatory_space_private_user.rb +3 -1
  10. data/app/commands/decidim/admin/create_share_token.rb +39 -0
  11. data/app/commands/decidim/admin/create_taxonomy.rb +23 -0
  12. data/app/commands/decidim/admin/create_taxonomy_filter.rb +24 -0
  13. data/app/commands/decidim/admin/destroy_share_token.rb +22 -0
  14. data/app/commands/decidim/admin/destroy_taxonomy.rb +18 -0
  15. data/app/commands/decidim/admin/destroy_taxonomy_filter.rb +20 -0
  16. data/app/commands/decidim/admin/hide_menu_component.rb +37 -0
  17. data/app/commands/decidim/admin/hide_resource.rb +4 -3
  18. data/app/commands/decidim/admin/publish_all_participatory_space_private_users.rb +50 -0
  19. data/app/commands/decidim/admin/publish_component.rb +3 -0
  20. data/app/commands/decidim/admin/reorder_components.rb +47 -0
  21. data/app/commands/decidim/admin/reorder_taxonomies.rb +76 -0
  22. data/app/commands/decidim/admin/unhide_resource.rb +11 -3
  23. data/app/commands/decidim/admin/unpublish_all_participatory_space_private_users.rb +50 -0
  24. data/app/commands/decidim/admin/unreport_resource.rb +11 -3
  25. data/app/commands/decidim/admin/update_component_permissions.rb +53 -13
  26. data/app/commands/decidim/admin/update_participatory_space_private_user.rb +11 -0
  27. data/app/commands/decidim/admin/update_share_token.rb +24 -0
  28. data/app/commands/decidim/admin/update_taxonomy.rb +20 -0
  29. data/app/commands/decidim/admin/update_taxonomy_filter.rb +28 -0
  30. data/app/controllers/concerns/decidim/admin/component_taxonomies_helper.rb +19 -0
  31. data/app/controllers/concerns/decidim/admin/filterable.rb +15 -18
  32. data/app/controllers/concerns/decidim/admin/has_trashable_resources.rb +170 -0
  33. data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +2 -29
  34. data/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb +12 -2
  35. data/app/controllers/concerns/decidim/admin/taxonomies/filterable.rb +27 -0
  36. data/app/controllers/decidim/admin/application_controller.rb +1 -2
  37. data/app/controllers/decidim/admin/areas_controller.rb +1 -0
  38. data/app/controllers/decidim/admin/block_user_controller.rb +42 -0
  39. data/app/controllers/decidim/admin/component_permissions_controller.rb +2 -4
  40. data/app/controllers/decidim/admin/components_controller.rb +50 -9
  41. data/app/controllers/decidim/admin/concerns/has_private_users.rb +59 -2
  42. data/app/controllers/decidim/admin/global_moderations_controller.rb +4 -0
  43. data/app/controllers/decidim/admin/moderated_users_controller.rb +26 -0
  44. data/app/controllers/decidim/admin/moderations_controller.rb +18 -0
  45. data/app/controllers/decidim/admin/newsletters_controller.rb +50 -7
  46. data/app/controllers/decidim/admin/resource_permissions_controller.rb +1 -1
  47. data/app/controllers/decidim/admin/scopes_controller.rb +1 -0
  48. data/app/controllers/decidim/admin/share_tokens_controller.rb +109 -7
  49. data/app/controllers/decidim/admin/taxonomies_controller.rb +129 -0
  50. data/app/controllers/decidim/admin/taxonomy_filters_controller.rb +112 -0
  51. data/app/controllers/decidim/admin/taxonomy_filters_selector_controller.rb +81 -0
  52. data/app/controllers/decidim/admin/taxonomy_items_controller.rb +91 -0
  53. data/app/forms/concerns/decidim/has_taxonomy_form_attributes.rb +57 -0
  54. data/app/forms/decidim/admin/block_users_form.rb +21 -0
  55. data/app/forms/decidim/admin/import_example_form.rb +1 -1
  56. data/app/forms/decidim/admin/newsletter_form.rb +1 -1
  57. data/app/forms/decidim/admin/participatory_space_private_user_form.rb +5 -0
  58. data/app/forms/decidim/admin/selective_newsletter_form.rb +46 -11
  59. data/app/forms/decidim/admin/share_token_form.rb +55 -0
  60. data/app/forms/decidim/admin/taxonomy_filter_form.rb +85 -0
  61. data/app/forms/decidim/admin/taxonomy_form.rb +20 -0
  62. data/app/forms/decidim/admin/taxonomy_item_form.rb +54 -0
  63. data/app/helpers/decidim/admin/application_helper.rb +0 -1
  64. data/app/helpers/decidim/admin/bulk_actions_helper.rb +0 -31
  65. data/app/helpers/decidim/admin/moderations/reports_helper.rb +1 -1
  66. data/app/helpers/decidim/admin/moderations_helper.rb +1 -1
  67. data/app/helpers/decidim/admin/newsletters_helper.rb +57 -27
  68. data/app/helpers/decidim/admin/scopes_helper.rb +0 -6
  69. data/app/helpers/decidim/admin/search_form_helper.rb +1 -1
  70. data/app/helpers/decidim/admin/settings_helper.rb +85 -11
  71. data/app/jobs/decidim/admin/newsletter_job.rb +3 -1
  72. data/app/packs/entrypoints/decidim_admin.js +4 -0
  73. data/app/packs/src/decidim/admin/application.js +2 -0
  74. data/app/packs/src/decidim/admin/draggable-table.js +33 -0
  75. data/app/packs/src/decidim/admin/form.js +0 -1
  76. data/app/packs/src/decidim/admin/global_moderations.js +186 -0
  77. data/app/packs/src/decidim/admin/managed_moderated_users.js +186 -0
  78. data/app/packs/src/decidim/admin/newsletters.js +164 -82
  79. data/app/packs/src/decidim/admin/proposal_infinite_edit.js +3 -6
  80. data/app/packs/src/decidim/admin/sortable.js +28 -16
  81. data/app/packs/src/decidim/admin/taxonomy_filters.js +93 -0
  82. data/app/packs/stylesheets/decidim/admin/_component-show.scss +66 -5
  83. data/app/packs/stylesheets/decidim/admin/_legacy_foundation.scss +13 -0
  84. data/app/packs/stylesheets/decidim/admin/_select_picker.scss +20 -0
  85. data/app/packs/stylesheets/decidim/admin/_table-list.scss +22 -0
  86. data/app/packs/stylesheets/decidim/admin/_taxonomies.scss +74 -0
  87. data/app/packs/stylesheets/decidim/admin/application.scss +3 -0
  88. data/app/permissions/decidim/admin/permissions.rb +32 -1
  89. data/app/queries/decidim/admin/newsletter_recipients.rb +50 -14
  90. data/app/views/decidim/admin/areas/index.html.erb +3 -0
  91. data/app/views/decidim/admin/block_user/bulk_new.html.erb +45 -0
  92. data/app/views/decidim/admin/components/_actions.html.erb +50 -33
  93. data/app/views/decidim/admin/components/{_component.html.erb → _component_row.html.erb} +10 -5
  94. data/app/views/decidim/admin/components/_components_table.html.erb +18 -0
  95. data/app/views/decidim/admin/components/_form.html.erb +0 -12
  96. data/app/views/decidim/admin/components/_taxonomy_filters_drawer.html.erb +2 -0
  97. data/app/views/decidim/admin/components/_visibility_label.html.erb +9 -0
  98. data/app/views/decidim/admin/components/index.html.erb +12 -14
  99. data/app/views/decidim/admin/components/manage_trash.html.erb +11 -0
  100. data/app/views/decidim/admin/moderated_users/_bulk-actions.html.erb +6 -0
  101. data/app/views/decidim/admin/moderated_users/bulk_actions/_block.html.erb +20 -0
  102. data/app/views/decidim/admin/moderated_users/bulk_actions/_dropdown.html.erb +40 -0
  103. data/app/views/decidim/admin/moderated_users/bulk_actions/_unblock.html.erb +20 -0
  104. data/app/views/decidim/admin/moderated_users/bulk_actions/_unreport.html.erb +20 -0
  105. data/app/views/decidim/admin/moderated_users/index.html.erb +14 -6
  106. data/app/views/decidim/admin/moderations/_bulk-actions.html.erb +7 -0
  107. data/app/views/decidim/admin/moderations/_moderation-tr.html.erb +50 -0
  108. data/app/views/decidim/admin/moderations/_moderations-thead.html.erb +18 -0
  109. data/app/views/decidim/admin/moderations/bulk_actions/_dropdown.html.erb +43 -0
  110. data/app/views/decidim/admin/moderations/bulk_actions/_hide.html.erb +20 -0
  111. data/app/views/decidim/admin/moderations/bulk_actions/_unhide.html.erb +20 -0
  112. data/app/views/decidim/admin/moderations/bulk_actions/_unreport.html.erb +20 -0
  113. data/app/views/decidim/admin/moderations/index.html.erb +13 -81
  114. data/app/views/decidim/admin/newsletters/confirm_recipients.html.erb +64 -0
  115. data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +44 -20
  116. data/app/views/decidim/admin/participatory_space_private_users/_form.html.erb +6 -0
  117. data/app/views/decidim/admin/participatory_space_private_users/edit.html.erb +19 -0
  118. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +15 -1
  119. data/app/views/decidim/admin/resource_permissions/_options_form.html.erb +5 -0
  120. data/app/views/decidim/admin/resource_permissions/edit.html.erb +2 -2
  121. data/app/views/decidim/admin/scope_types/index.html.erb +3 -0
  122. data/app/views/decidim/admin/scopes/index.html.erb +3 -0
  123. data/app/views/decidim/admin/share_tokens/_form.html.erb +52 -0
  124. data/app/views/decidim/admin/share_tokens/edit.html.erb +33 -0
  125. data/app/views/decidim/admin/share_tokens/index.html.erb +47 -0
  126. data/app/views/decidim/admin/share_tokens/new.html.erb +69 -0
  127. data/app/views/decidim/admin/taxonomies/_filters.html.erb +19 -0
  128. data/app/views/decidim/admin/taxonomies/_form.html.erb +5 -0
  129. data/app/views/decidim/admin/taxonomies/_row.html.erb +40 -0
  130. data/app/views/decidim/admin/taxonomies/_row_children.html.erb +8 -0
  131. data/app/views/decidim/admin/taxonomies/_table.html.erb +86 -0
  132. data/app/views/decidim/admin/taxonomies/_taxonomy_actions.html.erb +15 -0
  133. data/app/views/decidim/admin/taxonomies/edit.html.erb +87 -0
  134. data/app/views/decidim/admin/taxonomies/index.html.erb +28 -0
  135. data/app/views/decidim/admin/taxonomies/new.html.erb +16 -0
  136. data/app/views/decidim/admin/taxonomy_filters/_check_boxes.html.erb +10 -0
  137. data/app/views/decidim/admin/taxonomy_filters/_form.html.erb +96 -0
  138. data/app/views/decidim/admin/taxonomy_filters/_table.html.erb +33 -0
  139. data/app/views/decidim/admin/taxonomy_filters/edit.html.erb +22 -0
  140. data/app/views/decidim/admin/taxonomy_filters/index.html.erb +26 -0
  141. data/app/views/decidim/admin/taxonomy_filters/new.html.erb +32 -0
  142. data/app/views/decidim/admin/taxonomy_filters_selector/_check_boxes.html.erb +7 -0
  143. data/app/views/decidim/admin/taxonomy_filters_selector/_component_table.html.erb +25 -0
  144. data/app/views/decidim/admin/taxonomy_filters_selector/_taxonomies_select.html.erb +16 -0
  145. data/app/views/decidim/admin/taxonomy_filters_selector/index.html.erb +1 -0
  146. data/app/views/decidim/admin/taxonomy_filters_selector/new.html.erb +27 -0
  147. data/app/views/decidim/admin/taxonomy_filters_selector/show.html.erb +18 -0
  148. data/app/views/decidim/admin/taxonomy_items/_form.html.erb +8 -0
  149. data/app/views/decidim/admin/taxonomy_items/edit.html.erb +12 -0
  150. data/app/views/decidim/admin/taxonomy_items/new.html.erb +12 -0
  151. data/app/views/layouts/decidim/admin/taxonomy_filters.html.erb +17 -0
  152. data/app/views/layouts/decidim/admin/taxonomy_filters_selector.html.erb +10 -0
  153. data/config/locales/ar.yml +45 -37
  154. data/config/locales/bg.yml +48 -51
  155. data/config/locales/bs-BA.yml +1 -27
  156. data/config/locales/ca.yml +301 -50
  157. data/config/locales/cs.yml +299 -46
  158. data/config/locales/de.yml +301 -50
  159. data/config/locales/el.yml +1 -50
  160. data/config/locales/en.yml +301 -50
  161. data/config/locales/es-MX.yml +298 -47
  162. data/config/locales/es-PY.yml +298 -47
  163. data/config/locales/es.yml +298 -47
  164. data/config/locales/eu.yml +302 -51
  165. data/config/locales/fi-plain.yml +298 -47
  166. data/config/locales/fi.yml +298 -47
  167. data/config/locales/fr-CA.yml +184 -47
  168. data/config/locales/fr.yml +184 -47
  169. data/config/locales/ga-IE.yml +0 -23
  170. data/config/locales/gl.yml +1 -46
  171. data/config/locales/hu.yml +1 -51
  172. data/config/locales/id-ID.yml +0 -24
  173. data/config/locales/is-IS.yml +0 -30
  174. data/config/locales/it.yml +2 -46
  175. data/config/locales/ja.yml +299 -50
  176. data/config/locales/kaa.yml +0 -7
  177. data/config/locales/ko.yml +0 -50
  178. data/config/locales/lb.yml +1 -46
  179. data/config/locales/lt.yml +1 -50
  180. data/config/locales/lv.yml +1 -28
  181. data/config/locales/nl.yml +1 -46
  182. data/config/locales/no.yml +1 -46
  183. data/config/locales/pl.yml +3 -51
  184. data/config/locales/pt-BR.yml +38 -50
  185. data/config/locales/pt.yml +29 -49
  186. data/config/locales/ro-RO.yml +38 -52
  187. data/config/locales/ru.yml +1 -24
  188. data/config/locales/sk.yml +1 -28
  189. data/config/locales/sl.yml +0 -5
  190. data/config/locales/sq-AL.yml +0 -22
  191. data/config/locales/sr-CS.yml +1 -27
  192. data/config/locales/sv.yml +296 -46
  193. data/config/locales/th-TH.yml +0 -10
  194. data/config/locales/tr-TR.yml +1 -44
  195. data/config/locales/uk.yml +0 -23
  196. data/config/locales/zh-CN.yml +0 -38
  197. data/config/locales/zh-TW.yml +1 -50
  198. data/config/routes.rb +13 -12
  199. data/decidim-admin.gemspec +1 -1
  200. data/lib/decidim/admin/engine.rb +2 -1
  201. data/lib/decidim/admin/import/creator.rb +2 -6
  202. data/lib/decidim/admin/import/readers/json.rb +1 -1
  203. data/lib/decidim/admin/menu.rb +9 -1
  204. data/lib/decidim/admin/search_form_builder.rb +1 -1
  205. data/lib/decidim/admin/test/destroy_admin_examples.rb +2 -2
  206. data/lib/decidim/admin/test/filterable_examples.rb +100 -9
  207. data/lib/decidim/admin/test/forms/attachment_collection_form_examples.rb +1 -1
  208. data/lib/decidim/admin/test/forms/attachment_form_examples.rb +1 -1
  209. data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +2 -4
  210. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
  211. data/lib/decidim/admin/test/manage_hide_content_examples.rb +0 -1
  212. data/lib/decidim/admin/test/manage_moderations_examples.rb +3 -3
  213. data/lib/decidim/admin/test/manage_resource_soft_deletion_examples.rb +113 -0
  214. data/lib/decidim/admin/test/manage_taxonomy_filters_examples.rb +127 -0
  215. data/lib/decidim/admin/test/taxonomy_filters_examples.rb +32 -0
  216. data/lib/decidim/admin/test.rb +3 -1
  217. data/lib/decidim/admin/version.rb +1 -1
  218. metadata +103 -29
  219. data/app/commands/decidim/admin/create_category.rb +0 -15
  220. data/app/commands/decidim/admin/destroy_category.rb +0 -15
  221. data/app/commands/decidim/admin/destroy_component.rb +0 -19
  222. data/app/commands/decidim/admin/update_category.rb +0 -11
  223. data/app/controllers/decidim/admin/categories_controller.rb +0 -98
  224. data/app/forms/decidim/admin/category_form.rb +0 -32
  225. data/app/helpers/decidim/admin/resource_scope_helper.rb +0 -52
  226. data/app/packs/src/decidim/admin/scope_picker_enabler.component.js +0 -12
  227. data/app/views/decidim/admin/categories/_form.html.erb +0 -18
  228. data/app/views/decidim/admin/categories/edit.html.erb +0 -19
  229. data/app/views/decidim/admin/categories/index.html.erb +0 -65
  230. data/app/views/decidim/admin/categories/new.html.erb +0 -19
  231. data/app/views/decidim/admin/share_tokens/_share_tokens.html.erb +0 -45
  232. data/lib/decidim/admin/test/commands/create_category_examples.rb +0 -74
  233. data/lib/decidim/admin/test/commands/destroy_category_examples.rb +0 -83
  234. data/lib/decidim/admin/test/commands/update_category_examples.rb +0 -76
  235. data/lib/decidim/admin/test/forms/category_form_examples.rb +0 -70
  236. data/lib/decidim/admin/test/manage_categories_examples.rb +0 -128
@@ -41,7 +41,6 @@ module Decidim
41
41
  allow! if user_action?
42
42
  allow! if admin_user_action?
43
43
 
44
- allow! if permission_action.subject == :category
45
44
  allow! if permission_action.subject == :component
46
45
  allow! if permission_action.subject == :attachment
47
46
  allow! if permission_action.subject == :editor_image
@@ -59,6 +58,22 @@ module Decidim
59
58
  allow! if permission_action.subject == :help_sections
60
59
  allow! if permission_action.subject == :share_token
61
60
  allow! if permission_action.subject == :reminder
61
+
62
+ if permission_action.action.in? [:manage_trash, :restore, :soft_delete]
63
+ if permission_action.action == :soft_delete
64
+ toggle_allow(trashable_deleted_resource.respond_to?(:deleted?) && !trashable_deleted_resource.deleted?)
65
+ elsif permission_action.action == :restore
66
+ toggle_allow(trashable_deleted_resource&.deleted?)
67
+ else
68
+ allow!
69
+ end
70
+ end
71
+
72
+ if permission_action.subject == :taxonomy
73
+ permission_action.action == :destroy ? allow_destroy_taxonomy? : allow!
74
+ end
75
+ allow! if permission_action.subject == :taxonomy_filter
76
+ allow! if permission_action.subject == :taxonomy_item
62
77
  end
63
78
 
64
79
  permission_action
@@ -66,6 +81,10 @@ module Decidim
66
81
 
67
82
  private
68
83
 
84
+ def trashable_deleted_resource
85
+ context.fetch(:trashable_deleted_resource, nil)
86
+ end
87
+
69
88
  def user_manager?
70
89
  user && !user.admin? && user.role?("user_manager")
71
90
  end
@@ -253,6 +272,18 @@ module Decidim
253
272
  def available_authorization_handlers?
254
273
  user.organization.available_authorization_handlers.any?
255
274
  end
275
+
276
+ def allow_destroy_taxonomy?
277
+ return unless permission_action.action == :destroy
278
+
279
+ taxonomy = context.fetch(:taxonomy, nil)
280
+
281
+ toggle_allow(taxonomy&.removable?)
282
+ end
283
+
284
+ def component
285
+ context.fetch(:component, nil)
286
+ end
256
287
  end
257
288
  end
258
289
  end
@@ -22,15 +22,15 @@ module Decidim
22
22
  def query
23
23
  recipients = recipients_base_query
24
24
 
25
- recipients = recipients.interested_in_scopes(@form.scope_ids) if @form.scope_ids.present?
25
+ return recipients if @form.send_to_all_users
26
+ return verified_users if @form.send_to_verified_users
26
27
 
27
- followers = recipients.where(id: user_id_of_followers) if @form.send_to_followers
28
+ if filters_present?
29
+ filtered_recipients = apply_filters(recipients)
30
+ return recipients.none if filtered_recipients.empty?
28
31
 
29
- participants = recipients.where(id: participant_ids) if @form.send_to_participants
30
-
31
- recipients = participants if @form.send_to_participants
32
- recipients = followers if @form.send_to_followers
33
- recipients = (followers + participants).uniq if @form.send_to_followers && @form.send_to_participants
32
+ return filtered_recipients
33
+ end
34
34
 
35
35
  recipients
36
36
  end
@@ -45,26 +45,49 @@ module Decidim
45
45
  .confirmed
46
46
  end
47
47
 
48
+ def filters_present?
49
+ @form.send_to_followers || @form.send_to_participants || @form.send_to_private_members
50
+ end
51
+
52
+ def apply_filters(recipients)
53
+ filters = [
54
+ user_id_of_followers,
55
+ participant_ids,
56
+ private_member_ids
57
+ ].compact.flatten.uniq
58
+
59
+ filters.empty? ? recipients.none : recipients.where(id: filters)
60
+ end
61
+
48
62
  # Return the ids of the ParticipatorySpace selected
49
63
  # in form, grouped by type
50
64
  # This will be used to take followers and
51
65
  # participants of each ParticipatorySpace
52
66
  def spaces
53
- return if @form.participatory_space_types.blank?
67
+ return [] if @form.participatory_space_types.blank?
54
68
 
55
69
  @spaces ||= @form.participatory_space_types.map do |type|
56
70
  next if type.ids.blank?
57
71
 
72
+ ids = type.ids
73
+
58
74
  object_class = Decidim.participatory_space_registry.find(type.manifest_name).model_class_name.constantize
59
75
 
60
- if type.ids.include?("all")
61
- object_class.where(organization: @organization)
62
- else
63
- object_class.where(id: type.ids.compact_blank)
64
- end
76
+ ids.include?("all") ? object_class.where(organization: @form.organization) : object_class.where(id: ids.compact_blank)
65
77
  end.flatten.compact
66
78
  end
67
79
 
80
+ def verified_users
81
+ users = recipients_base_query
82
+
83
+ verified_users = Decidim::Authorization.select(:decidim_user_id)
84
+ .where(decidim_user_id: users.select(:id))
85
+ .where.not(granted_at: nil)
86
+ .where(name: @form.verification_types)
87
+ .distinct
88
+ users.where(id: verified_users)
89
+ end
90
+
68
91
  # Return the ids of Users that are following
69
92
  # the spaces selected in form
70
93
  def user_id_of_followers
@@ -74,7 +97,7 @@ module Decidim
74
97
  Decidim::Follow.user_follower_ids_for_participatory_spaces(spaces)
75
98
  end
76
99
 
77
- # Return the ids of Users that have participate
100
+ # Return the ids of Users that have participated in
78
101
  # the spaces selected in form
79
102
  def participant_ids
80
103
  return if spaces.blank?
@@ -95,6 +118,19 @@ module Decidim
95
118
 
96
119
  participant_ids.flatten.compact.uniq
97
120
  end
121
+
122
+ def private_spaces
123
+ return [] if spaces.blank?
124
+
125
+ spaces.select { |space| space.try(:private_space?) }
126
+ end
127
+
128
+ def private_member_ids
129
+ return unless @form.send_to_private_members
130
+ return [] if private_spaces.blank?
131
+
132
+ Decidim::ParticipatorySpacePrivateUser.private_user_ids_for_participatory_spaces(private_spaces)
133
+ end
98
134
  end
99
135
  end
100
136
  end
@@ -8,6 +8,9 @@
8
8
  <% end %>
9
9
  </h1>
10
10
  </div>
11
+
12
+ <div class="callout warning"><%= t("areas.deprecated", scope: "decidim.admin") %></div>
13
+
11
14
  <% if @areas.any? %>
12
15
  <div class="table-scroll">
13
16
  <table class="table-list">
@@ -0,0 +1,45 @@
1
+ <% add_decidim_page_title(t(".title")) %>
2
+ <div class="item_show__header">
3
+ <h1 class="item_show__header-title">
4
+ <%= t(".title") %>
5
+ </h1>
6
+ </div>
7
+
8
+ <div class="item__edit item__edit-1col">
9
+ <div class="item__edit-form">
10
+ <%= decidim_form_for(@form, url: bulk_create_moderated_users_path, method: :post, html: { class: "form-defaults form import_participatory_process" }) do |f| %>
11
+ <div class="form__wrapper">
12
+ <div class="card pt-4">
13
+ <div class="card-section">
14
+ <div class="row column">
15
+ <%= t(".description") %>
16
+ </div>
17
+
18
+ <% if @form.hide %>
19
+ <%= cell("decidim/announcement", t(".already_reported_html"), callout_class: "alert" ) %>
20
+ <% end %>
21
+
22
+ <% if Decidim.module_installed?(:templates) %>
23
+ <%= render "decidim/templates/admin/block_user_templates/template_chooser", form: f %>
24
+ <% end %>
25
+
26
+ <div class="row column">
27
+
28
+ <% @form.user_ids.each do |id| %>
29
+ <%= hidden_field_tag "user_ids[]", id %>
30
+ <% end %>
31
+ <%= f.hidden_field :hide %>
32
+ <%= f.text_area :justification, required: true, label: t(".justification") %>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="item__edit-sticky">
39
+ <div class="item__edit-sticky-container">
40
+ <%= f.submit t(".action"), class: "button button__sm button__secondary" %>
41
+ </div>
42
+ </div>
43
+ <% end %>
44
+ </div>
45
+ </div>
@@ -1,44 +1,61 @@
1
- <% if component.manifest.admin_engine %>
2
- <%= icon_link_to "pencil-line", manage_component_path(component), t("actions.manage", scope: "decidim.admin"), class: "action-icon--manage" %>
1
+ <% if view == :deleted %>
2
+ <% if allowed_to? :restore, :component, trashable_deleted_resource: component %>
3
+ <%= icon_link_to "refresh-line", url_for(action: :restore, id: component, controller: "components"), t("decidim.admin.actions.restore"), method: :patch, class: "action-icon--restore" %>
4
+ <% end %>
3
5
  <% else %>
4
- <span class="action-space icon"></span>
5
- <% end %>
6
+ <% if component.manifest.admin_engine %>
7
+ <%= icon_link_to "pencil-line", manage_component_path(component), t("actions.manage", scope: "decidim.admin"), class: "action-icon--manage" %>
8
+ <% else %>
9
+ <span class="action-space icon"></span>
10
+ <% end %>
6
11
 
7
- <% if allowed_to? :share, :component, component: component %>
8
- <%= icon_link_to "share-line", url_for(action: :share, id: component, controller: "components"), t("actions.share", scope: "decidim.admin"), target: :blank, class: "action-icon--share" %>
9
- <% else %>
10
- <span class="action-space icon"></span>
11
- <% end %>
12
- <% if allowed_to? :update, :component, component: component %>
13
- <%= icon_link_to "settings-4-line", url_for(action: :edit, id: component, controller: "components"), t("actions.configure", scope: "decidim.admin"), class: "action-icon--configure" %>
14
- <% else %>
15
- <span class="action-space icon"></span>
16
- <% end %>
12
+ <% if component.manifest.admin_engine && allowed_to?(:share, :component, component: component) %>
13
+ <%= icon_link_to "share-line", component_share_tokens_path(component_id: component), t("actions.share_tokens", scope: "decidim.admin"), class: "action-icon--share" %>
14
+ <% else %>
15
+ <span class="action-space icon"></span>
16
+ <% end %>
17
17
 
18
- <% if allowed_to?(:update, :component, component: component) %>
19
- <% if component.published? %>
20
- <%= icon_link_to "close-circle-line", url_for(action: :unpublish, id: component, controller: "components"), t("actions.unpublish", scope: "decidim.admin"), class: "action-icon--unpublish", method: :put %>
18
+ <% if allowed_to? :update, :component, component: component %>
19
+ <%= icon_link_to "settings-4-line", url_for(action: :edit, id: component, controller: "components"), t("actions.configure", scope: "decidim.admin"), class: "action-icon--configure" %>
21
20
  <% else %>
22
- <%= icon_link_to "check-line", url_for(action: :publish, id: component, controller: "components"), t("actions.publish", scope: "decidim.admin"), class: "action-icon--publish", method: :put %>
21
+ <span class="action-space icon"></span>
23
22
  <% end %>
24
- <% else %>
25
- <span class="action-space icon"></span>
26
- <% end %>
27
23
 
28
- <%= icon_link_to "eye-line", main_component_path(component), t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview", target: :blank, data: { "external-link": false } %>
24
+ <% if allowed_to?(:update, :component, component: component) %>
25
+ <% if component.published? %>
26
+ <% if component.visible? %>
27
+ <%= icon_link_to "eye-close", url_for(action: :hide, id: component, controller: "components"), t("actions.menu_hidden", scope: "decidim.admin"), class: "action-icon--unpublish", method: :put %>
28
+ <% else %>
29
+ <%= icon_link_to "close-circle-line", url_for(action: :unpublish, id: component, controller: "components"), t("actions.unpublish", scope: "decidim.admin"), class: "action-icon--menu-hidden", method: :put %>
30
+ <% end %>
31
+ <% else %>
32
+ <%= icon_link_to "check-line", url_for(action: :publish, id: component, controller: "components"), t("actions.publish", scope: "decidim.admin"), class: "action-icon--publish", method: :put %>
33
+ <% end %>
34
+ <% else %>
35
+ <span class="action-space icon"></span>
36
+ <% end %>
29
37
 
30
- <% if allowed_to? :update, :component, component: component %>
31
- <% if component.manifest.actions.empty? %>
32
- <%= icon "key-2-line", class: "action-icon action-icon--disabled" %>
38
+ <%= icon_link_to "eye-line", main_component_path(component), t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview", target: :blank, data: { "external-link": false } %>
39
+
40
+ <% if allowed_to? :update, :component, component: component %>
41
+ <% if component.manifest.actions.empty? %>
42
+ <%= icon "key-2-line", class: "action-icon action-icon--disabled" %>
43
+ <% else %>
44
+ <%= icon_link_to "key-2-line", url_for(action: :edit, component_id: component, controller: "component_permissions"), t("actions.permissions", scope: "decidim.admin"), class: "action-icon--permissions" %>
45
+ <% end %>
33
46
  <% else %>
34
- <%= icon_link_to "key-2-line", url_for(action: :edit, component_id: component, controller: "component_permissions"), t("actions.permissions", scope: "decidim.admin"), class: "action-icon--permissions" %>
47
+ <span class="action-space icon"></span>
35
48
  <% end %>
36
- <% else %>
37
- <span class="action-space icon"></span>
38
- <% end %>
39
49
 
40
- <% if allowed_to? :destroy, :component, component: component %>
41
- <%= icon_link_to "delete-bin-line", url_for(action: :destroy, id: component, controller: "components"), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete %>
42
- <% else %>
43
- <span class="action-space icon"></span>
50
+ <% if allowed_to?(:soft_delete, :component, trashable_deleted_resource: component) %>
51
+ <% resources_count = component.primary_stat || 0 %>
52
+
53
+ <% if component.published? %>
54
+ <%= icon "delete-bin-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.soft_delete", scope: "decidim.admin") %>
55
+ <% else %>
56
+ <%= icon_link_to "delete-bin-line", url_for(action: :soft_delete, id: component, controller: "components"), t("actions.soft_delete", scope: "decidim.admin", resources_count:), method: :patch, class: "action-icon--delete", data: { confirm: (t("actions.confirm_delete_component", scope: "decidim.admin", resources_count:)) } %>
57
+ <% end %>
58
+ <% else %>
59
+ <span class="action-space icon"></span>
60
+ <% end %>
44
61
  <% end %>
@@ -1,6 +1,9 @@
1
1
  <% if user_role_config.component_is_accessible?(component.manifest_name) %>
2
- <tr class="component-<%= component.id %>">
3
- <td>
2
+ <tr class="draggable-content component-<%= component.id %>" draggable="true" data-record-id="<%= component.id %>">
3
+ <td class="text-center dragging-handle">
4
+ <%= icon("draggable", class: "dragger") %>
5
+ </td>
6
+ <td class="!text-left">
4
7
  <% if component.manifest.admin_engine %>
5
8
  <%= link_to translated_attribute(component.name), manage_component_path(component) %><br>
6
9
  <% else %>
@@ -10,12 +13,14 @@
10
13
  <td>
11
14
  <%= t "decidim.components.#{component.manifest.name}.name" %>
12
15
  </td>
13
- <%= td_resource_scope_for(component.scope) %>
16
+ <td>
17
+ <%= render partial: "decidim/admin/components/visibility_label", locals: { component: } %>
18
+ </td>
14
19
  <td class="table-list__actions">
15
20
  <% if lookup_context.find_all("decidim/#{component.manifest_name}/admin/component/_actions").any? %>
16
- <%= render partial: "decidim/#{component.manifest_name}/admin/component/actions", locals: { component: } %>
21
+ <%= render partial: "decidim/#{component.manifest_name}/admin/component/actions", locals: { component:, view: } %>
17
22
  <% else %>
18
- <%= render partial: "actions", locals: { component: } %>
23
+ <%= render partial: "actions", locals: { component:, view: } %>
19
24
  <% end %>
20
25
  </td>
21
26
  </tr>
@@ -0,0 +1,18 @@
1
+ <div class="table-scroll">
2
+ <table class="table-list">
3
+ <thead>
4
+ <tr>
5
+ <th></th>
6
+ <th class="!text-left"><%= t("index.headers.name", scope: "decidim.admin.components") %></th>
7
+ <th><%= t("index.headers.type", scope: "decidim.admin.components") %></th>
8
+ <th><%= t("index.headers.visibility", scope: "decidim.admin.components") %></th>
9
+ <th><%= t("index.headers.actions", scope: "decidim.admin.components") %></th>
10
+ </tr>
11
+ </thead>
12
+ <tbody class="draggable-table" data-sort-url="<%= reorder_components_path %>" data-draggable-table>
13
+ <% components.each do |component| %>
14
+ <%= render partial: "component_row", locals: { component:, view: } %>
15
+ <% end %>
16
+ </tbody>
17
+ </table>
18
+ </div>
@@ -13,9 +13,6 @@
13
13
  <div class="row column">
14
14
  <%= form.translated :text_field, :name, autofocus: true, aria: { label: :name } %>
15
15
  </div>
16
- <div class="row column">
17
- <%= form.number_field :weight %>
18
- </div>
19
16
  </div>
20
17
  </div>
21
18
  <% if form.object.settings? %>
@@ -114,13 +111,4 @@
114
111
  </div>
115
112
  </div>
116
113
  <% end %>
117
- <% if component && component.persisted? && !component.published? %>
118
- <div class="card" data-component="accordion" id="accordion-share_tokens">
119
- <div id="panel-share_tokens" class="card-section">
120
- <div class="row column">
121
- <%= render partial: "decidim/admin/share_tokens/share_tokens", locals: { share_tokens: form.object.share_tokens } %>
122
- </div>
123
- </div>
124
- </div>
125
- <% end %>
126
114
  </div>
@@ -0,0 +1,2 @@
1
+ <div class="js-taxonomy-filters-drawer-container min-h-screen"
2
+ data-index-url="<%= decidim_admin.taxonomy_filters_selector_index_path(component_id: @component.id) %>"></div>
@@ -0,0 +1,9 @@
1
+ <% if component.published? %>
2
+ <% if component.visible? %>
3
+ <strong class="label success"><%= t(".published") %></strong>
4
+ <% else %>
5
+ <strong class="label warning"><%= t(".menu_hidden") %></strong>
6
+ <% end %>
7
+ <% else %>
8
+ <strong class="label alert"><%= t(".unpublished") %></strong>
9
+ <% end %>
@@ -27,18 +27,16 @@
27
27
  </h1>
28
28
  </div>
29
29
 
30
- <div class="table-scroll">
31
- <table class="table-list">
32
- <thead>
33
- <th><%= t(".headers.name") %></th>
34
- <th><%= t(".headers.type") %></th>
35
- <%= th_resource_scope_label(t(".headers.scope")) %>
36
- <th><%= t(".headers.actions") %></th>
37
- </thead>
38
-
39
- <tbody>
40
- <%= render partial: "component", collection: @components %>
41
- </tbody>
42
- </table>
43
- </div>
30
+ <%= render partial: "components_table", locals: { components: @components, view: :index } %>
31
+ <% if allowed_to?(:manage_trash, :component, participatory_space: current_participatory_space) %>
32
+ <div class="card mt-4">
33
+ <%= link_to manage_trash_components_path, class: "flex items-center underline text-secondary" do %>
34
+ <%= icon "delete-bin-2-line", class: "mr-2 fill-current text-secondary", role: "img" %>
35
+ <%= t("actions.view_deleted_components", scope: "decidim.admin") %>
36
+ <span class="ml-2">
37
+ <%= icon_with_tooltip("information-line", t("tooltips.deleted_component_info", scope: "decidim.admin")) %>
38
+ </span>
39
+ <% end %>
40
+ </div>
41
+ <% end %>
44
42
  </div>
@@ -0,0 +1,11 @@
1
+ <% add_decidim_page_title(t("components.manage_trash.title", scope: "decidim.admin")) %>
2
+
3
+ <div class="card">
4
+ <div class="item_show__header">
5
+ <h1 class="item_show__header-title">
6
+ <%= t("components.manage_trash.title", scope: "decidim.admin") %>
7
+ </h1>
8
+ </div>
9
+ </div>
10
+
11
+ <%= render partial: "components_table", locals: { components: trashable_deleted_collection, view: :deleted } %>
@@ -0,0 +1,6 @@
1
+ <div class="flex align-middle gap-x-4 ml-auto" id="js-other-actions-wrapper">
2
+ <%= render partial: "decidim/admin/moderated_users/bulk_actions/dropdown" %>
3
+ </div>
4
+ <%= render partial: "decidim/admin/moderated_users/bulk_actions/block" %>
5
+ <%= render partial: "decidim/admin/moderated_users/bulk_actions/unreport" %>
6
+ <%= render partial: "decidim/admin/moderated_users/bulk_actions/unblock" %>
@@ -0,0 +1,20 @@
1
+ <div id="js-block-moderated_users-actions" class="hide js-bulk-action-form">
2
+ <%= form_tag(bulk_new_moderated_users_path, method: :post, id: "js-form-block-moderated_users", class: "form form-defaults flex items-center gap-x-2") do %>
3
+
4
+ <div class="hide">
5
+ <% moderated_users.each do |moderation| %>
6
+ <%= check_box_tag "user_ids[]", moderation.user.id, false, class: "js-check-all-moderated_users js-moderated_user-id-#{moderation.user.id}" %>
7
+ <% end %>
8
+ </div>
9
+
10
+ <%= submit_tag(
11
+ t("decidim.admin.moderated_users.index.actions.bulk_actions.block.update_moderated_user_button"),
12
+ id: "js-submit-block-moderated_users",
13
+ class: "button button__sm button__secondary small button--simple float-left"
14
+ ) %>
15
+
16
+ <button id="js-cancel-block-moderated_users" class="button button__sm button__secondary js-cancel-bulk-action" type="button">
17
+ <%= t("decidim.admin.moderated_users.index.cancel") %>
18
+ </button>
19
+ <% end %>
20
+ </div>
@@ -0,0 +1,40 @@
1
+ <div id="js-bulk-actions-wrapper">
2
+ <button
3
+ id="js-bulk-actions-button"
4
+ class="button button__sm button__secondary"
5
+ type="button"
6
+ data-toggle="js-bulk-actions-dropdown">
7
+ <%= t("decidim.admin.moderated_users.index.actions.bulk_actions.actions_dropdown") %>
8
+ <%= icon "arrow-down-s-line", class: "dropdown-filter-icon" %>
9
+ </button>
10
+
11
+ <div
12
+ id="js-bulk-actions-dropdown"
13
+ class="dropdown-pane"
14
+ data-position="bottom"
15
+ data-alignment="right"
16
+ data-dropdown="dropdown"
17
+ data-auto-focus="false"
18
+ data-events="resize">
19
+ <ul>
20
+ <% if params[:blocked] %>
21
+ <li>
22
+ <button type="button" data-action="unblock-moderated_users">
23
+ <%= t("decidim.admin.moderated_users.index.actions.bulk_actions.unblock.title") %>
24
+ </button>
25
+ </li>
26
+ <% else %>
27
+ <li>
28
+ <button type="button" data-action="block-moderated_users">
29
+ <%= t("decidim.admin.moderated_users.index.actions.bulk_actions.block.title") %>
30
+ </button>
31
+ </li>
32
+ <li>
33
+ <button type="button" data-action="unreport-moderated_users">
34
+ <%= t("decidim.admin.moderated_users.index.actions.bulk_actions.unreport.title") %>
35
+ </button>
36
+ </li>
37
+ <% end %>
38
+ </ul>
39
+ </div>
40
+ </div>
@@ -0,0 +1,20 @@
1
+ <div id="js-unblock-moderated_users-actions" class="hide js-bulk-action-form">
2
+ <%= form_tag(bulk_destroy_moderated_users_path, method: :delete, id: "js-form-unblock-moderated_users", class: "form form-defaults flex items-center gap-x-2") do %>
3
+
4
+ <div class="hide">
5
+ <% moderated_users.each do |moderation| %>
6
+ <%= check_box_tag "user_ids[]", moderation.user.id, false, class: "js-check-all-moderated_users js-moderated_user-id-#{moderation.user.id}" %>
7
+ <% end %>
8
+ </div>
9
+
10
+ <%= submit_tag(
11
+ t("decidim.admin.moderated_users.index.actions.bulk_actions.unblock.update_moderated_user_button"),
12
+ id: "js-submit-unblock-moderated_users",
13
+ class: "button button__sm button__secondary small button--simple float-left"
14
+ ) %>
15
+
16
+ <button id="js-cancel-unblock-moderated_users" class="button button__sm button__secondary js-cancel-bulk-action" type="button">
17
+ <%= t("decidim.admin.moderated_users.index.cancel") %>
18
+ </button>
19
+ <% end %>
20
+ </div>
@@ -0,0 +1,20 @@
1
+ <div id="js-unreport-moderated_users-actions" class="hide js-bulk-action-form">
2
+ <%= form_tag(bulk_unreport_moderated_users_path, method: :patch, id: "js-form-unreport-moderated_users", class: "form form-defaults flex items-center gap-x-2") do %>
3
+
4
+ <div class="hide">
5
+ <% moderated_users.each do |moderation| %>
6
+ <%= check_box_tag "user_ids[]", moderation.user.id, false, class: "js-check-all-moderated_users js-moderated_user-id-#{moderation.user.id}" %>
7
+ <% end %>
8
+ </div>
9
+
10
+ <%= submit_tag(
11
+ t("decidim.admin.moderated_users.index.actions.ignore.update_moderated_user_button"),
12
+ id: "js-submit-unreport-moderated_users",
13
+ class: "button button__sm button__secondary small button--simple float-left"
14
+ ) %>
15
+
16
+ <button id="js-cancel-unreport-moderated_users" class="button button__sm button__secondary js-cancel-bulk-action" type="button">
17
+ <%= t("decidim.admin.moderated_users.index.cancel") %>
18
+ </button>
19
+ <% end %>
20
+ </div>
@@ -1,12 +1,18 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="item_show__header">
3
3
  <h1 class="item_show__header-title">
4
- <%= t(".title") %>
4
+ <div>
5
+ <%= t(".title") %>
6
+ <span id="js-selected-moderated_users-count" class="component-counter " title="<%= t("decidim.admin.moderated_users.index.selected") %>"></span>
7
+ </div>
5
8
 
6
- <div class="card__filter">
7
- <%= link_to t("decidim.admin.moderated_users.tabs.unblocked"), moderated_users_path %>
8
- |
9
- <%= link_to t("decidim.admin.moderated_users.tabs.blocked"), moderated_users_path(blocked: true) %>
9
+ <div class="flex items-center gap-x-4">
10
+ <%= render partial: "bulk-actions" %>
11
+ <div class="card__filter">
12
+ <%= link_to t("decidim.admin.moderated_users.tabs.unblocked"), moderated_users_path %>
13
+ |
14
+ <%= link_to t("decidim.admin.moderated_users.tabs.blocked"), moderated_users_path(blocked: true) %>
15
+ </div>
10
16
  </div>
11
17
  </h1>
12
18
  </div>
@@ -16,6 +22,7 @@
16
22
  <table class="table-list">
17
23
  <thead>
18
24
  <tr>
25
+ <th><%= check_box_tag "moderated_users_bulk", "all", false, class: "js-check-all" %></th>
19
26
  <th><%= t(".name") %></th>
20
27
  <th><%= t(".nickname") %></th>
21
28
  <th><%= t(".reason") %></th>
@@ -27,6 +34,7 @@
27
34
  <tbody>
28
35
  <% @moderated_users.each do |moderation| %>
29
36
  <tr data-id="<%= moderation.id %>">
37
+ <td><%= check_box_tag "user_ids_s[]", moderation.user.id, false, class: "js-check-all-moderated_users js-moderated_user-list-check js-moderated_user-id-#{moderation.user.id}" %><br></td>
30
38
  <% if moderation.user.nickname.present? %>
31
39
  <td><%= link_to moderation.user.name, decidim.profile_path(moderation.user.nickname) %></td>
32
40
  <td><%= link_to moderation.user.nickname, decidim.profile_path(moderation.user.nickname) %></td>
@@ -53,7 +61,7 @@
53
61
  <% if moderation.user.blocked? %>
54
62
  <%= icon_link_to "refresh-line", user_block_path(user_id: moderation.user.id), t(".actions.unblock"), class: "action-icon action-icon--disabled", method: :delete %>
55
63
  <% else %>
56
- <%= icon_link_to "lock-2-line", new_user_block_path(user_id: moderation.user.id), t(".actions.block"), class: "action-icon action-icon" %>
64
+ <%= icon_link_to "lock-2-line", new_user_block_path(user_id: moderation.user.id), t(".actions.block"), class: "action-icon action-icon" %>
57
65
  <% end %>
58
66
  <% end %>
59
67
  </td>
@@ -0,0 +1,7 @@
1
+ <div class="flex align-middle gap-x-4 ml-auto" id="js-other-actions-wrapper">
2
+ <%= render partial: "decidim/admin/moderations/bulk_actions/dropdown" %>
3
+ </div>
4
+
5
+ <%= render partial: "decidim/admin/moderations/bulk_actions/hide" %>
6
+ <%= render partial: "decidim/admin/moderations/bulk_actions/unreport" %>
7
+ <%= render partial: "decidim/admin/moderations/bulk_actions/unhide" %>