decidim-admin 0.28.0 → 0.28.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/admin/content_block_cell.rb +1 -1
  3. data/app/commands/decidim/admin/destroy_category.rb +1 -1
  4. data/app/controllers/decidim/admin/application_controller.rb +2 -1
  5. data/app/controllers/decidim/admin/area_types_controller.rb +1 -1
  6. data/app/controllers/decidim/admin/authorization_workflows_controller.rb +5 -1
  7. data/app/controllers/decidim/admin/conflicts_controller.rb +23 -0
  8. data/app/controllers/decidim/admin/impersonatable_users_controller.rb +3 -1
  9. data/app/controllers/decidim/admin/impersonations_controller.rb +1 -0
  10. data/app/controllers/decidim/admin/managed_users/impersonation_logs_controller.rb +2 -0
  11. data/app/controllers/decidim/admin/moderated_users_controller.rb +10 -0
  12. data/app/controllers/decidim/admin/moderations_controller.rb +10 -0
  13. data/app/controllers/decidim/admin/officializations_controller.rb +2 -0
  14. data/app/controllers/decidim/admin/organization_controller.rb +7 -4
  15. data/app/controllers/decidim/admin/scope_types_controller.rb +1 -1
  16. data/app/controllers/decidim/admin/static_page_topics_controller.rb +10 -0
  17. data/app/controllers/decidim/admin/user_groups_controller.rb +2 -0
  18. data/app/controllers/decidim/admin/users_controller.rb +2 -0
  19. data/app/events/decidim/resource_hidden_event.rb +5 -1
  20. data/app/helpers/decidim/admin/admin_terms_helper.rb +1 -1
  21. data/app/helpers/decidim/admin/filterable_helper.rb +1 -1
  22. data/app/packs/entrypoints/decidim_admin_overrides.scss +2 -0
  23. data/app/packs/images/decidim/admin/.keep +0 -0
  24. data/app/packs/src/decidim/admin/application.js +14 -1
  25. data/app/packs/src/decidim/admin/choose_language.js +2 -0
  26. data/app/packs/src/decidim/admin/dynamic_fields.component.js +2 -1
  27. data/app/packs/src/decidim/admin/participatory_space_search.js +1 -1
  28. data/app/packs/stylesheets/decidim/admin/_filters.scss +1 -1
  29. data/app/packs/stylesheets/decidim/admin/_legacy_foundation.scss +10 -0
  30. data/app/packs/stylesheets/decidim/admin/_sidebar-menu.scss +4 -4
  31. data/app/packs/stylesheets/decidim/admin/_tabs.scss +6 -0
  32. data/app/packs/stylesheets/decidim/admin/decidim_application.scss +5 -0
  33. data/app/views/decidim/admin/admin_terms/show.html.erb +2 -2
  34. data/app/views/decidim/admin/area_types/edit.html.erb +2 -2
  35. data/app/views/decidim/admin/area_types/index.html.erb +2 -2
  36. data/app/views/decidim/admin/area_types/new.html.erb +2 -2
  37. data/app/views/decidim/admin/areas/edit.html.erb +2 -2
  38. data/app/views/decidim/admin/areas/index.html.erb +2 -2
  39. data/app/views/decidim/admin/areas/new.html.erb +2 -2
  40. data/app/views/decidim/admin/attachment_collections/edit.html.erb +2 -2
  41. data/app/views/decidim/admin/attachment_collections/index.html.erb +2 -2
  42. data/app/views/decidim/admin/attachment_collections/new.html.erb +2 -2
  43. data/app/views/decidim/admin/attachments/edit.html.erb +2 -2
  44. data/app/views/decidim/admin/attachments/index.html.erb +2 -2
  45. data/app/views/decidim/admin/attachments/new.html.erb +2 -2
  46. data/app/views/decidim/admin/authorization_workflows/index.html.erb +2 -2
  47. data/app/views/decidim/admin/block_user/new.html.erb +3 -4
  48. data/app/views/decidim/admin/categories/edit.html.erb +2 -2
  49. data/app/views/decidim/admin/categories/index.html.erb +7 -3
  50. data/app/views/decidim/admin/categories/new.html.erb +2 -2
  51. data/app/views/decidim/admin/components/edit.html.erb +2 -2
  52. data/app/views/decidim/admin/components/index.html.erb +2 -2
  53. data/app/views/decidim/admin/components/new.html.erb +2 -2
  54. data/app/views/decidim/admin/conflicts/index.html.erb +2 -2
  55. data/app/views/decidim/admin/dashboard/show.html.erb +2 -2
  56. data/app/views/decidim/admin/help_sections/_form.html.erb +2 -2
  57. data/app/views/decidim/admin/impersonatable_users/index.html.erb +2 -2
  58. data/app/views/decidim/admin/impersonations/new.html.erb +2 -2
  59. data/app/views/decidim/admin/imports/new.html.erb +2 -2
  60. data/app/views/decidim/admin/managed_users/impersonation_logs/index.html.erb +2 -2
  61. data/app/views/decidim/admin/managed_users/promotions/new.html.erb +2 -2
  62. data/app/views/decidim/admin/moderated_users/index.html.erb +2 -2
  63. data/app/views/decidim/admin/moderations/index.html.erb +2 -2
  64. data/app/views/decidim/admin/moderations/reports/index.html.erb +2 -2
  65. data/app/views/decidim/admin/moderations/reports/show.html.erb +2 -2
  66. data/app/views/decidim/admin/newsletter_templates/index.html.erb +5 -6
  67. data/app/views/decidim/admin/newsletter_templates/show.html.erb +16 -12
  68. data/app/views/decidim/admin/newsletters/edit.html.erb +2 -2
  69. data/app/views/decidim/admin/newsletters/index.html.erb +2 -2
  70. data/app/views/decidim/admin/newsletters/new.html.erb +2 -2
  71. data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +13 -9
  72. data/app/views/decidim/admin/newsletters/show.html.erb +29 -26
  73. data/app/views/decidim/admin/officializations/index.html.erb +1 -1
  74. data/app/views/decidim/admin/officializations/new.html.erb +2 -2
  75. data/app/views/decidim/admin/organization/_form.html.erb +5 -3
  76. data/app/views/decidim/admin/organization/edit.html.erb +2 -2
  77. data/app/views/decidim/admin/organization_appearance/edit.html.erb +2 -2
  78. data/app/views/decidim/admin/organization_external_domain_whitelist/edit.html.erb +2 -2
  79. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +2 -2
  80. data/app/views/decidim/admin/participatory_space_private_users/new.html.erb +2 -2
  81. data/app/views/decidim/admin/resource_permissions/edit.html.erb +2 -2
  82. data/app/views/decidim/admin/scope_types/edit.html.erb +2 -2
  83. data/app/views/decidim/admin/scope_types/index.html.erb +2 -2
  84. data/app/views/decidim/admin/scope_types/new.html.erb +2 -2
  85. data/app/views/decidim/admin/scopes/edit.html.erb +2 -2
  86. data/app/views/decidim/admin/scopes/index.html.erb +2 -2
  87. data/app/views/decidim/admin/scopes/new.html.erb +2 -2
  88. data/app/views/decidim/admin/shared/_filters.html.erb +1 -1
  89. data/app/views/decidim/admin/shared/_js-callout.html.erb +2 -2
  90. data/app/views/decidim/admin/shared/landing_page/_content_blocks.html.erb +2 -2
  91. data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +2 -2
  92. data/app/views/decidim/admin/static_page_topics/edit.html.erb +2 -2
  93. data/app/views/decidim/admin/static_page_topics/index.html.erb +2 -2
  94. data/app/views/decidim/admin/static_page_topics/new.html.erb +2 -2
  95. data/app/views/decidim/admin/static_pages/edit.html.erb +2 -2
  96. data/app/views/decidim/admin/static_pages/index.html.erb +2 -2
  97. data/app/views/decidim/admin/static_pages/new.html.erb +2 -2
  98. data/app/views/decidim/admin/user_groups/index.html.erb +2 -2
  99. data/app/views/decidim/admin/user_groups_csv_verifications/new.html.erb +2 -2
  100. data/app/views/decidim/admin/users/index.html.erb +2 -2
  101. data/app/views/decidim/admin/users/new.html.erb +2 -2
  102. data/app/views/layouts/decidim/admin/_breadcrumb.html.erb +1 -1
  103. data/app/views/layouts/decidim/admin/_header.html.erb +4 -0
  104. data/app/views/layouts/decidim/admin/_js_configuration.html.erb +1 -0
  105. data/app/views/layouts/decidim/admin/_sidebar_menu.html.erb +2 -2
  106. data/config/assets.rb +1 -0
  107. data/config/locales/ar.yml +11 -8
  108. data/config/locales/bg.yml +1025 -3
  109. data/config/locales/ca.yml +4 -1
  110. data/config/locales/cs.yml +6 -8
  111. data/config/locales/de.yml +15 -12
  112. data/config/locales/el.yml +2 -12
  113. data/config/locales/en.yml +4 -1
  114. data/config/locales/es-MX.yml +11 -8
  115. data/config/locales/es-PY.yml +11 -8
  116. data/config/locales/es.yml +20 -17
  117. data/config/locales/eu.yml +8 -5
  118. data/config/locales/fi-plain.yml +4 -1
  119. data/config/locales/fi.yml +6 -3
  120. data/config/locales/fr-CA.yml +5 -2
  121. data/config/locales/fr.yml +4 -1
  122. data/config/locales/ga-IE.yml +2 -4
  123. data/config/locales/gl.yml +8 -7
  124. data/config/locales/he-IL.yml +50 -0
  125. data/config/locales/hu.yml +36 -6
  126. data/config/locales/id-ID.yml +5 -0
  127. data/config/locales/is-IS.yml +5 -0
  128. data/config/locales/it.yml +8 -9
  129. data/config/locales/ja.yml +8 -4
  130. data/config/locales/ko.yml +774 -0
  131. data/config/locales/lb.yml +8 -10
  132. data/config/locales/lt.yml +3 -14
  133. data/config/locales/lv.yml +8 -0
  134. data/config/locales/nl.yml +7 -9
  135. data/config/locales/no.yml +20 -9
  136. data/config/locales/pl.yml +74 -4
  137. data/config/locales/pt-BR.yml +50 -12
  138. data/config/locales/pt.yml +8 -10
  139. data/config/locales/ro-RO.yml +2 -13
  140. data/config/locales/ru.yml +5 -0
  141. data/config/locales/sk.yml +5 -0
  142. data/config/locales/sl.yml +5 -0
  143. data/config/locales/sq-AL.yml +490 -0
  144. data/config/locales/sr-CS.yml +5 -0
  145. data/config/locales/sv.yml +7 -9
  146. data/config/locales/th-TH.yml +101 -0
  147. data/config/locales/tr-TR.yml +11 -0
  148. data/config/locales/uk.yml +5 -0
  149. data/config/locales/zh-CN.yml +5 -0
  150. data/config/locales/zh-TW.yml +3 -11
  151. data/decidim-admin.gemspec +43 -0
  152. data/lib/decidim/admin/engine.rb +1 -25
  153. data/lib/decidim/admin/menu.rb +13 -4
  154. data/lib/decidim/admin/test/admin_participatory_space_access_examples.rb +27 -0
  155. data/lib/decidim/admin/test/commands/destroy_category_examples.rb +9 -0
  156. data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +180 -0
  157. data/lib/decidim/admin/test/invite_participatory_space_collaborators_shared_examples.rb +67 -0
  158. data/lib/decidim/admin/test/invite_participatory_space_moderators_shared_examples.rb +77 -0
  159. data/lib/decidim/admin/test/invite_participatory_space_users_shared_context.rb +33 -0
  160. data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +12 -11
  161. data/lib/decidim/admin/test/manage_categories_examples.rb +11 -8
  162. data/lib/decidim/admin/test/manage_hide_content_examples.rb +4 -0
  163. data/lib/decidim/admin/test.rb +1 -0
  164. data/lib/decidim/admin/version.rb +1 -1
  165. metadata +20 -13
  166. data/app/mailers/decidim/admin/application_mailer.rb +0 -12
  167. data/config/environment.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40ed6d9572b43902816815e55d3bdabfb7e16d319ab328cc705f753aa053a5e8
4
- data.tar.gz: 73e23f6a91596b65503a49bda5397bf843da48175f48f696fc527dcc95951822
3
+ metadata.gz: 75ccdc4a2f091d223bff9fa56f75347e91c6d8752bfba25eaf0a758191d705c0
4
+ data.tar.gz: f451da89da78adc0809dd9fee4af0f87761870f5cbb8eee8cc9c20868dc9b023
5
5
  SHA512:
6
- metadata.gz: 7ea41cc7a5afa9e4c4ead314708c89187da26170c96f21a9817d2d9591e2e1dd4d8e682991724e2b8b89bdf1d90d6df14cb84e5fcfb8c823b59f8a17c3e77177
7
- data.tar.gz: b881939bb98f615689a21e0f5396fed9b8f63e781fdf10659e6a21858a42623c6697466bcd3d5255a6f586bd0e64af1d7c9eccb935081987ec1952045eb19840
6
+ metadata.gz: 11998db7b9f88af5bef0396a5adb179a9495a8acb21e80b55f9a2e3257557356a5c414039016cf826e06a16e1e6fb5adcbe4e36830000beff84ee9c1abd41852
7
+ data.tar.gz: 5fbf7d4e81e2fd1a366310eb5dbfd1d6aad2473d3d54af70ef1e6a095739468c8c0cf6e17df1208d6829af345fe52b4aa713d5abb7443f8da15fb63ae44ba929
@@ -30,7 +30,7 @@ module Decidim
30
30
  def name
31
31
  return I18n.t(public_name_key) if component.blank?
32
32
 
33
- "#{I18n.t(public_name_key)} (#{translated_attribute(component&.name)})"
33
+ "#{I18n.t(public_name_key)} (#{decidim_escape_translated(component&.name)})"
34
34
  end
35
35
  end
36
36
  end
@@ -20,7 +20,7 @@ module Decidim
20
20
  #
21
21
  # Returns nothing.
22
22
  def call
23
- return broadcast(:invalid) if category.nil? || category.subcategories.any?
23
+ return broadcast(:invalid) if category.nil? || category.subcategories.any? || !category.unused?
24
24
 
25
25
  destroy_category
26
26
  broadcast(:ok)
@@ -34,7 +34,8 @@ module Decidim
34
34
  helper Decidim::ComponentPathHelper
35
35
  helper Decidim::SanitizeHelper
36
36
  helper Decidim::BreadcrumbHelper
37
- helper Decidim::Templates::Admin::ApplicationHelper if Decidim.module_installed?(:templates)
37
+
38
+ helper Decidim::Templates::Admin::ApplicationHelper if Decidim.module_installed?(:templates) && defined?(Decidim::Templates::Admin::ApplicationHelper)
38
39
 
39
40
  default_form_builder Decidim::Admin::FormBuilder
40
41
 
@@ -9,7 +9,7 @@ module Decidim
9
9
 
10
10
  layout "decidim/admin/settings"
11
11
 
12
- add_breadcrumb_item_from_menu :admin_settings_menu
12
+ add_breadcrumb_item_from_menu :admin_areas_menu
13
13
 
14
14
  helper_method :area_types
15
15
 
@@ -5,10 +5,14 @@ module Decidim
5
5
  class AuthorizationWorkflowsController < Decidim::Admin::ApplicationController
6
6
  layout "decidim/admin/users"
7
7
 
8
+ add_breadcrumb_item_from_menu :admin_user_menu
9
+
8
10
  def index
9
11
  enforce_permission_to :index, :authorization_workflow
10
12
 
11
- @workflows = Decidim::Verifications.admin_workflows
13
+ @workflows = Decidim::Verifications.admin_workflows.select do |manifest|
14
+ current_organization.available_authorizations.include?(manifest.name.to_s)
15
+ end
12
16
 
13
17
  # Decidim::Verifications::Authorizations Query
14
18
  @authorizations = Decidim::Verifications::Authorizations.new(
@@ -5,13 +5,21 @@ module Decidim
5
5
  class ConflictsController < Decidim::Admin::ApplicationController
6
6
  layout "decidim/admin/users"
7
7
 
8
+ helper_method :context_breadcrumb_items
9
+
10
+ add_breadcrumb_item_from_menu :impersonate_menu
11
+
8
12
  def index
13
+ enforce_permission_to :index, :impersonatable_user
14
+
9
15
  @conflicts = Decidim::Verifications::Conflict.joins(:current_user).where(
10
16
  decidim_users: { decidim_organization_id: current_organization.id }
11
17
  )
12
18
  end
13
19
 
14
20
  def edit
21
+ enforce_permission_to :index, :impersonatable_user
22
+
15
23
  conflict = Decidim::Verifications::Conflict.find(params[:id])
16
24
 
17
25
  @form = form(TransferUserForm).from_params(
@@ -22,6 +30,8 @@ module Decidim
22
30
  end
23
31
 
24
32
  def update
33
+ enforce_permission_to :index, :impersonatable_user
34
+
25
35
  conflict = Decidim::Verifications::Conflict.find(params[:id])
26
36
 
27
37
  @form = form(TransferUserForm).from_params(
@@ -43,6 +53,19 @@ module Decidim
43
53
  end
44
54
  end
45
55
  end
56
+
57
+ private
58
+
59
+ def context_breadcrumb_items
60
+ @context_breadcrumb_items ||= [impersonations_breadcrumb_item]
61
+ end
62
+
63
+ def impersonations_breadcrumb_item
64
+ {
65
+ label: I18n.t("menu.impersonations", scope: "decidim.admin"),
66
+ url: decidim_admin.impersonatable_users_path
67
+ }
68
+ end
46
69
  end
47
70
  end
48
71
  end
@@ -12,6 +12,8 @@ module Decidim
12
12
 
13
13
  helper_method :new_managed_user
14
14
 
15
+ add_breadcrumb_item_from_menu :admin_user_menu
16
+
15
17
  def index
16
18
  enforce_permission_to :index, :impersonatable_user
17
19
 
@@ -26,7 +28,7 @@ module Decidim
26
28
  private
27
29
 
28
30
  def collection
29
- @collection ||= current_organization.users.where(admin: false, roles: []).order(created_at: :desc)
31
+ @collection ||= current_organization.users.not_deleted.not_blocked.where(admin: false, roles: []).order(created_at: :desc)
30
32
  end
31
33
 
32
34
  def new_managed_user
@@ -82,6 +82,7 @@ module Decidim
82
82
  return nil unless handler.unique_id
83
83
 
84
84
  existing_authorization = Authorization.find_by(
85
+ user: User.where(organization: current_organization),
85
86
  name: handler_name,
86
87
  unique_id: handler.unique_id
87
88
  )
@@ -9,6 +9,8 @@ module Decidim
9
9
  layout "decidim/admin/users"
10
10
 
11
11
  def index
12
+ enforce_permission_to :index, :impersonatable_user
13
+
12
14
  @impersonation_logs = Decidim::ImpersonationLog.where(user:).order(started_at: :desc).page(params[:page]).per(15)
13
15
  end
14
16
 
@@ -7,6 +7,8 @@ module Decidim
7
7
 
8
8
  layout "decidim/admin/global_moderations"
9
9
 
10
+ before_action :set_moderation_breadcrumb_item
11
+
10
12
  def index
11
13
  enforce_permission_to :read, :moderate_users
12
14
 
@@ -46,6 +48,14 @@ module Decidim
46
48
  base_query_finder.unblocked
47
49
  end
48
50
  end
51
+
52
+ def set_moderation_breadcrumb_item
53
+ controller_breadcrumb_items << {
54
+ label: I18n.t("menu.reported_users", scope: "decidim.admin"),
55
+ url: decidim_admin.moderated_users_path,
56
+ active: true
57
+ }
58
+ end
49
59
  end
50
60
  end
51
61
  end
@@ -8,6 +8,8 @@ module Decidim
8
8
 
9
9
  helper_method :moderations, :allowed_to?, :query, :permission_resource
10
10
 
11
+ before_action :set_moderation_breadcrumb_item
12
+
11
13
  def index
12
14
  enforce_permission_to :read, permission_resource
13
15
  end
@@ -103,6 +105,14 @@ module Decidim
103
105
  def permission_resource
104
106
  :moderation
105
107
  end
108
+
109
+ def set_moderation_breadcrumb_item
110
+ controller_breadcrumb_items << {
111
+ label: I18n.t("menu.content", scope: "decidim.admin"),
112
+ url: decidim_admin.moderations_path,
113
+ active: true
114
+ }
115
+ end
106
116
  end
107
117
  end
108
118
  end
@@ -12,6 +12,8 @@ module Decidim
12
12
  helper_method :user
13
13
  helper Decidim::Messaging::ConversationHelper
14
14
 
15
+ add_breadcrumb_item_from_menu :admin_user_menu
16
+
15
17
  def index
16
18
  enforce_permission_to :read, :officialization
17
19
  @users = filtered_collection
@@ -46,13 +46,16 @@ module Decidim
46
46
  respond_to do |format|
47
47
  format.json do
48
48
  if (term = params[:term].to_s).present?
49
- query = relation.order(name: :asc)
50
49
  query = if term.start_with?("@")
51
- query.where("nickname ILIKE ?", "#{term.delete("@")}%")
50
+ nickname = term.delete("@")
51
+ relation.where("nickname ILIKE ?", "#{nickname}%")
52
+ .order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("similarity(nickname, '#{nickname}') DESC")))
52
53
  else
53
- query.where("name ILIKE ?", "%#{term}%").or(
54
- query.where("email ILIKE ?", "%#{term}%")
54
+ relation.where("name ILIKE ?", "%#{term}%").or(
55
+ relation.where("email ILIKE ?", "%#{term}%")
55
56
  )
57
+ .order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("GREATEST(similarity(name, '#{term}'), similarity(email, '#{term}')) DESC")))
58
+ .order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("(similarity(name, '#{term}') + similarity(email, '#{term}')) / 2 DESC")))
56
59
  end
57
60
  render json: query.all.collect { |u| { value: u.id, label: "#{u.name} (@#{u.nickname})" } }
58
61
  else
@@ -9,7 +9,7 @@ module Decidim
9
9
 
10
10
  layout "decidim/admin/settings"
11
11
 
12
- add_breadcrumb_item_from_menu :admin_settings_menu
12
+ add_breadcrumb_item_from_menu :admin_scopes_menu
13
13
 
14
14
  helper_method :scope_types
15
15
 
@@ -5,6 +5,8 @@ module Decidim
5
5
  class StaticPageTopicsController < Decidim::Admin::ApplicationController
6
6
  include Decidim::Admin::Concerns::HasTabbedMenu
7
7
 
8
+ before_action :set_static_page_topics_breadcrumb_item
9
+
8
10
  helper_method :topic, :topics
9
11
 
10
12
  def index
@@ -68,6 +70,14 @@ module Decidim
68
70
 
69
71
  private
70
72
 
73
+ def set_static_page_topics_breadcrumb_item
74
+ controller_breadcrumb_items << {
75
+ label: I18n.t("menu.static_page_topics", scope: "decidim.admin"),
76
+ url: decidim_admin.static_page_topics_path,
77
+ active: true
78
+ }
79
+ end
80
+
71
81
  def tab_menu_name = :admin_static_pages_menu
72
82
 
73
83
  def topic
@@ -12,6 +12,8 @@ module Decidim
12
12
 
13
13
  layout "decidim/admin/users"
14
14
 
15
+ add_breadcrumb_item_from_menu :admin_user_menu
16
+
15
17
  def index
16
18
  enforce_permission_to :index, :user_group
17
19
 
@@ -7,6 +7,8 @@ module Decidim
7
7
  class UsersController < Decidim::Admin::ApplicationController
8
8
  include Decidim::Admin::Officializations::Filterable
9
9
 
10
+ add_breadcrumb_item_from_menu :admin_user_menu
11
+
10
12
  def index
11
13
  enforce_permission_to :read, :admin_user
12
14
  @users = filtered_collection
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Decidim
4
4
  class ResourceHiddenEvent < Decidim::Events::SimpleEvent
5
+ include Decidim::ApplicationHelper
6
+
5
7
  i18n_attributes :resource_path, :report_reasons, :resource_type, :resource_content
6
8
 
7
9
  def resource_path
@@ -23,7 +25,9 @@ module Decidim
23
25
  end
24
26
 
25
27
  def resource_content
26
- translated_attribute(@resource[@resource.reported_attributes.first]).truncate(100, separator: " ")
28
+ text = translated_attribute(@resource[@resource.reported_attributes.first])
29
+
30
+ decidim_sanitize(html_truncate(text, length: 100), strip_tags: true)
27
31
  end
28
32
 
29
33
  def resource_text
@@ -5,7 +5,7 @@ module Decidim
5
5
  # This module includes helpers to show admin terms of service
6
6
  module AdminTermsHelper
7
7
  def admin_terms_of_service_body
8
- current_organization.admin_terms_of_service_body.symbolize_keys[I18n.locale].html_safe
8
+ decidim_sanitize_admin(translated_attribute(current_organization.admin_terms_of_service_body)).html_safe
9
9
  end
10
10
 
11
11
  def announcement_body
@@ -53,7 +53,7 @@ module Decidim
53
53
  # Produces the html for the dropdown submenu from the options tree.
54
54
  # Returns a ActiveSupport::SafeBuffer.
55
55
  def dropdown_submenu(options)
56
- content_tag(:ul, class: "vertical menu") do
56
+ content_tag(:ul, class: "vertical menu", "aria-hidden": true) do
57
57
  options.map do |key, value|
58
58
  if value.nil?
59
59
  content_tag(:li, key)
@@ -0,0 +1,2 @@
1
+ // Application specific styles: https://docs.decidim.org/en/customize/styles/
2
+ @import "stylesheets/decidim/admin/decidim_application";
File without changes
@@ -12,8 +12,21 @@ window.Decidim.managedUsersForm = managedUsersForm
12
12
  window.Decidim.config = new Configuration()
13
13
  window.Decidim.InputCharacterCounter = InputCharacterCounter;
14
14
 
15
+ // REDESIGN_PENDING: deprecated
16
+ window.initFoundation = (element) => {
17
+ $(element).foundation();
18
+ };
19
+
15
20
  $(() => {
16
- $(document).foundation();
21
+ window.initFoundation(document);
22
+
23
+ $(document).on("show.zf.dropdownMenu", function(event, $element) {
24
+ $element.attr("aria-hidden", "false");
25
+ });
26
+
27
+ $(document).on("hide.zf.dropdownMenu", function(event, $element) {
28
+ $element.children(".is-dropdown-submenu").attr("aria-hidden", "true");
29
+ });
17
30
 
18
31
  toggleNav();
19
32
 
@@ -7,7 +7,9 @@ export default function initLanguageChangeSelect(elements) {
7
7
  let targetTabPaneSelector = select.value;
8
8
  let tabsContent = select.parentElement.parentElement.nextElementSibling;
9
9
 
10
+ tabsContent.querySelector(".is-active").ariaHidden = "true";
10
11
  tabsContent.querySelector(".is-active").classList.remove("is-active");
12
+ tabsContent.querySelector(targetTabPaneSelector).ariaHidden = "false";
11
13
  tabsContent.querySelector(targetTabPaneSelector).classList.add("is-active");
12
14
  })
13
15
  });
@@ -159,7 +159,8 @@ class DynamicFieldsComponent {
159
159
  $newField.appendTo($container);
160
160
  }
161
161
 
162
- $newField.foundation();
162
+ // REDESIGN_PENDING: deprecated
163
+ window.initFoundation($newField);
163
164
 
164
165
  if (this.onAddField) {
165
166
  this.onAddField($newField);
@@ -10,7 +10,7 @@ import AutoComplete from "src/decidim/autocomplete";
10
10
  */
11
11
  const apiRequest = (query) => {
12
12
  return new Promise((resolve) => {
13
- fetch("/api", {
13
+ fetch(window.Decidim.config.get("api_path"), {
14
14
  method: "post",
15
15
  headers: {
16
16
  "Content-Type": "application/json"
@@ -16,7 +16,7 @@
16
16
  }
17
17
 
18
18
  .dropdown {
19
- @apply relative p-0 bg-transparent border-0;
19
+ @apply relative p-0 border-0;
20
20
  }
21
21
 
22
22
  .button,
@@ -32,6 +32,16 @@ li.opens-left > .is-dropdown-submenu {
32
32
  display: none;
33
33
  }
34
34
 
35
+ .dropdown.menu ul {
36
+ &[aria-hidden="true"] {
37
+ display: none;
38
+ }
39
+
40
+ &[aria-hidden="false"] {
41
+ display: block;
42
+ }
43
+ }
44
+
35
45
  .dropdown.menu .nested.is-dropdown-submenu {
36
46
  margin-right: 0;
37
47
  margin-left: 0;
@@ -24,16 +24,16 @@
24
24
  @apply font-semibold;
25
25
  }
26
26
 
27
+ & .component-counter {
28
+ @apply ml-auto inline-flex items-center justify-center w-5 h-5 text-xs font-semibold rounded-full bg-background-4 border-secondary;
29
+ }
30
+
27
31
  ul {
28
32
  @apply ml-10;
29
33
 
30
34
  li {
31
35
  a {
32
36
  @apply px-2 py-1;
33
-
34
- .component-counter {
35
- @apply ml-auto inline-flex items-center justify-center w-5 h-5 text-xs font-semibold rounded-full bg-background-4 border-secondary;
36
- }
37
37
  }
38
38
 
39
39
  &.is-active a {
@@ -55,6 +55,12 @@
55
55
  @apply hidden;
56
56
  }
57
57
 
58
+ .form-defaults {
59
+ .language-change:not(.reset-defaults) {
60
+ @apply pt-1;
61
+ }
62
+ }
63
+
58
64
  .form {
59
65
  .language-change {
60
66
  @apply h-8 mb-4;
@@ -0,0 +1,5 @@
1
+ // This is a file that can be overridden by the application in order to override styles
2
+ // Notice that this file is included at the very end of the stylesheets packs to have
3
+ // more priority
4
+ //
5
+ // By default this is empty.
@@ -1,9 +1,9 @@
1
1
  <%= cell("decidim/announcement", announcement_body, callout_class: current_user.admin_terms_accepted? ? "success" : "warning" ) %>
2
2
 
3
3
  <div class="item_show__header">
4
- <h2 class="item_show__header-title">
4
+ <h1 class="item_show__header-title">
5
5
  <%= t("title", scope: "decidim.admin.admin_terms_of_service") %>
6
- </h2>
6
+ </h1>
7
7
  </div>
8
8
 
9
9
  <article class="card">
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
3
+ <h1 class="item_show__header-title">
4
4
  <%= t ".title" %>
5
- </h2>
5
+ </h1>
6
6
  </div>
7
7
  <div class="item__edit-form">
8
8
  <%= decidim_form_for(@form, html: { class: "form-defaults form edit_area_type" }) do |f| %>
@@ -1,12 +1,12 @@
1
1
  <% add_decidim_page_title(t("decidim.admin.titles.area_types")) %>
2
2
  <div class="card" id="area-types">
3
3
  <div class="item_show__header">
4
- <h2 class="item_show__header-title">
4
+ <h1 class="item_show__header-title">
5
5
  <%= t "decidim.admin.titles.area_types" %>
6
6
  <% if allowed_to? :create, :area_type %>
7
7
  <%= link_to t("actions.add", scope: "decidim.admin"), [:new, :area_type], class: "button button__sm button__secondary new" %>
8
8
  <% end %>
9
- </h2>
9
+ </h1>
10
10
  </div>
11
11
  <div class="table-scroll">
12
12
  <table class="table-list">
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
3
+ <h1 class="item_show__header-title">
4
4
  <%= t ".title" %>
5
- </h2>
5
+ </h1>
6
6
  </div>
7
7
  <div class="item__edit-form">
8
8
  <%= decidim_form_for(@form, html: { class: "form-defaults form new_area_type" }) do |f| %>
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
3
+ <h1 class="item_show__header-title">
4
4
  <%= t ".title" %>
5
- </h2>
5
+ </h1>
6
6
  </div>
7
7
  <div class="item__edit-form">
8
8
  <%= decidim_form_for(@form, html: { class: "form-defaults form edit_area_" }) do |f| %>
@@ -1,12 +1,12 @@
1
1
  <% add_decidim_page_title(t("areas", scope: "decidim.admin.titles")) %>
2
2
  <div class="card" id="areas">
3
3
  <div class="item_show__header">
4
- <h2 class="item_show__header-title">
4
+ <h1 class="item_show__header-title">
5
5
  <%= t "decidim.admin.titles.areas" %>
6
6
  <% if allowed_to? :create, :area %>
7
7
  <%= link_to t("actions.add", scope: "decidim.admin"), new_area_path, class: "button button__sm button__secondary new" %>
8
8
  <% end %>
9
- </h2>
9
+ </h1>
10
10
  </div>
11
11
  <% if @areas.any? %>
12
12
  <div class="table-scroll">
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
3
+ <h1 class="item_show__header-title">
4
4
  <%= t ".title" %>
5
- </h2>
5
+ </h1>
6
6
  </div>
7
7
  <div class="item__edit-form">
8
8
  <%= decidim_form_for(@form, url: areas_path, html: { class: "form-defaults form new_area_" }) do |f| %>
@@ -1,9 +1,9 @@
1
1
  <% add_decidim_page_title(t("attachment_collections.edit.title", scope: "decidim.admin")) %>
2
2
 
3
3
  <div class="item_show__header">
4
- <h2 class="item_show__header-title">
4
+ <h1 class="item_show__header-title">
5
5
  <%= t("attachment_collections.edit.title", scope: "decidim.admin") %>
6
- </h2>
6
+ </h1>
7
7
  </div>
8
8
 
9
9
  <div class="item__edit item__edit-1col">
@@ -1,12 +1,12 @@
1
1
  <% add_decidim_page_title(t("attachment_collections.index.attachment_collections_title", scope: "decidim.admin")) %>
2
2
  <div class="card" id="attachment_collections">
3
3
  <div class="item_show__header">
4
- <h2 class="item_show__header-title">
4
+ <h1 class="item_show__header-title">
5
5
  <%= t("attachment_collections.index.attachment_collections_title", scope: "decidim.admin") %>
6
6
  <% if allowed_to? :create, :attachment_collection %>
7
7
  <%= link_to t("actions.attachment_collection.new", scope: "decidim.admin"), url_for(action: :new), class: "button button__sm button__secondary new" %>
8
8
  <% end %>
9
- </h2>
9
+ </h1>
10
10
  </div>
11
11
  <% if collection_for.attachment_collections.any? %>
12
12
  <div class="table-scroll">
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title(t("attachment_collections.new.title", scope: "decidim.admin")) %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
3
+ <h1 class="item_show__header-title">
4
4
  <%= t("attachment_collections.new.title", scope: "decidim.admin") %>
5
- </h2>
5
+ </h1>
6
6
  </div>
7
7
 
8
8
  <div class="item__edit item__edit-1col">
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
3
+ <h1 class="item_show__header-title">
4
4
  <%= t(".title") %>
5
- </h2>
5
+ </h1>
6
6
  </div>
7
7
 
8
8
  <div class="item__edit item__edit-1col">
@@ -1,12 +1,12 @@
1
1
  <% add_decidim_page_title(t(".attachments_title")) %>
2
2
  <div class="card" id="attachments">
3
3
  <div class="item_show__header">
4
- <h2 class="item_show__header-title">
4
+ <h1 class="item_show__header-title">
5
5
  <%= t(".attachments_title") %>
6
6
  <% if allowed_to? :create, :attachment %>
7
7
  <%= link_to t("actions.attachment.new", scope: "decidim.admin"), url_for(action: :new), class: "button button__sm button__secondary new" %>
8
8
  <% end %>
9
- </h2>
9
+ </h1>
10
10
  </div>
11
11
  <%= cell("decidim/admin/attachments_privacy_warning", attached_to.attachments) %>
12
12
  <% if attached_to.attachments.any? %>
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
3
+ <h1 class="item_show__header-title">
4
4
  <%= t(".title") %>
5
- </h2>
5
+ </h1>
6
6
  </div>
7
7
 
8
8
  <div class="item__edit item__edit-1col">