decidim-admin 0.27.5 → 0.27.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/admin/destroy_category.rb +1 -1
  3. data/app/controllers/decidim/admin/application_controller.rb +1 -0
  4. data/app/controllers/decidim/admin/authorization_workflows_controller.rb +3 -1
  5. data/app/controllers/decidim/admin/conflicts_controller.rb +6 -0
  6. data/app/controllers/decidim/admin/impersonatable_users_controller.rb +1 -1
  7. data/app/controllers/decidim/admin/impersonations_controller.rb +1 -0
  8. data/app/controllers/decidim/admin/managed_users/impersonation_logs_controller.rb +2 -0
  9. data/app/controllers/decidim/admin/organization_controller.rb +7 -4
  10. data/app/events/decidim/component_published_event.rb +11 -0
  11. data/app/events/decidim/resource_hidden_event.rb +5 -1
  12. data/app/helpers/decidim/admin/admin_terms_helper.rb +1 -1
  13. data/app/helpers/decidim/admin/newsletters_helper.rb +1 -1
  14. data/app/packs/images/decidim/admin/.keep +0 -0
  15. data/app/views/decidim/admin/categories/index.html.erb +7 -1
  16. data/app/views/decidim/admin/resource_permissions/edit.html.erb +2 -2
  17. data/app/views/layouts/decidim/admin/_header.html.erb +3 -0
  18. data/app/views/layouts/decidim/admin/_js_configuration.html.erb +1 -0
  19. data/config/locales/ar.yml +1 -7
  20. data/config/locales/bg.yml +986 -3
  21. data/config/locales/cs.yml +2 -2
  22. data/config/locales/de.yml +10 -10
  23. data/config/locales/el.yml +0 -8
  24. data/config/locales/es-MX.yml +2 -2
  25. data/config/locales/es-PY.yml +2 -2
  26. data/config/locales/es.yml +3 -3
  27. data/config/locales/eu.yml +2 -2
  28. data/config/locales/fi.yml +2 -2
  29. data/config/locales/fr-CA.yml +1 -1
  30. data/config/locales/ga-IE.yml +0 -4
  31. data/config/locales/gl.yml +1 -7
  32. data/config/locales/he-IL.yml +53 -0
  33. data/config/locales/hu.yml +24 -11
  34. data/config/locales/id-ID.yml +3 -0
  35. data/config/locales/is-IS.yml +3 -0
  36. data/config/locales/it.yml +0 -8
  37. data/config/locales/ja.yml +2 -2
  38. data/config/locales/ko.yml +720 -0
  39. data/config/locales/lb.yml +1 -9
  40. data/config/locales/lt.yml +0 -8
  41. data/config/locales/lv.yml +6 -0
  42. data/config/locales/nl.yml +0 -8
  43. data/config/locales/no.yml +4 -8
  44. data/config/locales/pl.yml +12 -3
  45. data/config/locales/pt-BR.yml +19 -9
  46. data/config/locales/pt.yml +1 -9
  47. data/config/locales/ro-RO.yml +0 -8
  48. data/config/locales/ru.yml +3 -0
  49. data/config/locales/sk.yml +3 -0
  50. data/config/locales/sl.yml +3 -0
  51. data/config/locales/sq-AL.yml +479 -0
  52. data/config/locales/sr-CS.yml +3 -0
  53. data/config/locales/sv.yml +0 -8
  54. data/config/locales/th-TH.yml +100 -0
  55. data/config/locales/tr-TR.yml +3 -0
  56. data/config/locales/uk.yml +3 -0
  57. data/config/locales/zh-CN.yml +3 -0
  58. data/config/locales/zh-TW.yml +0 -8
  59. data/decidim-admin.gemspec +36 -0
  60. data/lib/decidim/admin/test/commands/destroy_category_examples.rb +9 -0
  61. data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +15 -14
  62. data/lib/decidim/admin/test/manage_attachments_examples.rb +3 -3
  63. data/lib/decidim/admin/test/manage_categories_examples.rb +12 -9
  64. data/lib/decidim/admin/test/manage_moderations_examples.rb +0 -9
  65. data/lib/decidim/admin/version.rb +1 -1
  66. metadata +14 -13
  67. data/app/mailers/decidim/admin/application_mailer.rb +0 -12
  68. data/config/environment.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff93ac8455dc2e0c83ea885cffd0167c733c99ef4aa4ecf87c804865274a2fb1
4
- data.tar.gz: effea866bfcf0e7eeb60917547ae95fb4f880f4e7c6afd877b18a66f28c5a9d8
3
+ metadata.gz: 89af8ec67ceb6341a006d36411a053aeb1ddfe47cf8b87dfa01fa06d61c34305
4
+ data.tar.gz: 3c780a0d891e04f13f982a08ef8681506337333c863f9f4fdbac5a88097cff49
5
5
  SHA512:
6
- metadata.gz: e907b4a9858aaa67f5815458c995f85546643d29c79ea9b92ee17bac1d5f621da646c7c23a887cba48114907dee74f5712abe80f207b7ec96e50a6c9f09d7334
7
- data.tar.gz: 8aab3aa06c560cc2f7b958f188a2f89e7809f66e9e648517b3c54b6df70c84aae10e52305d6e22c9e8f7966b38512a0bedfc7520c4093126cb0e049b4f455597
6
+ metadata.gz: 36629e02f1ddaa454e8e5c0ee531a3067782c4f90c21d00b981ff4a81a27c633a09c88b98a6ac89d4e69837b3f59a7d76a44c1c5295f74ce11870be5162d57f3
7
+ data.tar.gz: dd3651f270e9db52fb99a06d2a288cab0fb330ed1a860e722f5f3070e264f7f48a077d5a2d37fb15e8b7daefa5199e62e5e424e54ebf5299d41f23746f6abd9c
@@ -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)
@@ -30,6 +30,7 @@ module Decidim
30
30
  helper Decidim::LanguageChooserHelper
31
31
  helper Decidim::ComponentPathHelper
32
32
  helper Decidim::SanitizeHelper
33
+ helper Decidim::Templates::Admin::ApplicationHelper if Decidim.module_installed?(:templates) && defined?(Decidim::Templates::Admin::ApplicationHelper)
33
34
 
34
35
  default_form_builder Decidim::Admin::FormBuilder
35
36
 
@@ -8,7 +8,9 @@ module Decidim
8
8
  def index
9
9
  enforce_permission_to :index, :authorization_workflow
10
10
 
11
- @workflows = Decidim::Verifications.admin_workflows
11
+ @workflows = Decidim::Verifications.admin_workflows.select do |manifest|
12
+ current_organization.available_authorizations.include?(manifest.name.to_s)
13
+ end
12
14
 
13
15
  # Decidim::Verifications::Authorizations Query
14
16
  @authorizations = Decidim::Verifications::Authorizations.new(
@@ -6,12 +6,16 @@ module Decidim
6
6
  layout "decidim/admin/users"
7
7
 
8
8
  def index
9
+ enforce_permission_to :index, :impersonatable_user
10
+
9
11
  @conflicts = Decidim::Verifications::Conflict.joins(:current_user).where(
10
12
  decidim_users: { decidim_organization_id: current_organization.id }
11
13
  )
12
14
  end
13
15
 
14
16
  def edit
17
+ enforce_permission_to :index, :impersonatable_user
18
+
15
19
  conflict = Decidim::Verifications::Conflict.find(params[:id])
16
20
 
17
21
  @form = form(TransferUserForm).from_params(
@@ -22,6 +26,8 @@ module Decidim
22
26
  end
23
27
 
24
28
  def update
29
+ enforce_permission_to :index, :impersonatable_user
30
+
25
31
  conflict = Decidim::Verifications::Conflict.find(params[:id])
26
32
 
27
33
  @form = form(TransferUserForm).from_params(
@@ -24,7 +24,7 @@ module Decidim
24
24
  private
25
25
 
26
26
  def collection
27
- @collection ||= current_organization.users.where(admin: false, roles: [])
27
+ @collection ||= current_organization.users.not_deleted.not_blocked.where(admin: false, roles: [])
28
28
  end
29
29
 
30
30
  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: user).order(started_at: :desc).page(params[:page]).per(15)
13
15
  end
14
16
 
@@ -44,13 +44,16 @@ module Decidim
44
44
  respond_to do |format|
45
45
  format.json do
46
46
  if (term = params[:term].to_s).present?
47
- query = relation.order(name: :asc)
48
47
  query = if term.start_with?("@")
49
- query.where("nickname ILIKE ?", "#{term.delete("@")}%")
48
+ nickname = term.delete("@")
49
+ relation.where("nickname ILIKE ?", "#{nickname}%")
50
+ .order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("similarity(nickname, '#{nickname}') DESC")))
50
51
  else
51
- query.where("name ILIKE ?", "%#{term}%").or(
52
- query.where("email ILIKE ?", "%#{term}%")
52
+ relation.where("name ILIKE ?", "%#{term}%").or(
53
+ relation.where("email ILIKE ?", "%#{term}%")
53
54
  )
55
+ .order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("GREATEST(similarity(name, '#{term}'), similarity(email, '#{term}')) DESC")))
56
+ .order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("(similarity(name, '#{term}') + similarity(email, '#{term}')) / 2 DESC")))
54
57
  end
55
58
  render json: query.all.collect { |u| { value: u.id, label: "#{u.name} (@#{u.nickname})" } }
56
59
  else
@@ -2,5 +2,16 @@
2
2
 
3
3
  module Decidim
4
4
  class ComponentPublishedEvent < Decidim::Events::SimpleEvent
5
+ # Public: The Hash of options to pass to the I18.t method.
6
+ def i18n_options
7
+ default_i18n_options.merge(event_interpolations)
8
+ end
9
+
10
+ def resource_title
11
+ return unless resource
12
+
13
+ title = decidim_sanitize_translated(resource.name)
14
+ Decidim::ContentProcessor.render_without_format(title, links: false).html_safe
15
+ end
5
16
  end
6
17
  end
@@ -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 Use
6
6
  module AdminTermsHelper
7
7
  def admin_terms_of_use_body
8
- current_organization.admin_terms_of_use_body.symbolize_keys[I18n.locale].html_safe
8
+ decidim_sanitize_admin(translated_attribute(current_organization.admin_terms_of_use_body)).html_safe
9
9
  end
10
10
 
11
11
  def announcement_body
@@ -74,7 +74,7 @@ module Decidim
74
74
  else
75
75
  Decidim.find_participatory_space_manifest(type["manifest_name"].to_sym)
76
76
  .participatory_spaces.call(current_organization).where(id: type["ids"]).each do |space|
77
- html += "<strong>#{translated_attribute space.title}</strong>"
77
+ html += "<strong>#{decidim_escape_translated space.title}</strong>"
78
78
  end
79
79
  end
80
80
  html += "<br/>"
File without changes
@@ -52,7 +52,13 @@
52
52
  <% end %>
53
53
 
54
54
  <% if allowed_to? :destroy, :category, category: subcategory %>
55
- <%= icon_link_to "circle-x", category_path(current_participatory_space, subcategory), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
55
+ <% if subcategory.unused? %>
56
+ <%= icon_link_to "circle-x", category_path(current_participatory_space, subcategory), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
57
+ <% else %>
58
+ <span class="action-icon" title="<%= t("categories.index.category_used", scope: "decidim.admin") %>" data-tooltip="true" data-disable-hover="false">
59
+ <%= icon "delete-bin-line", class: "action-icon action-icon--disabled", role: "img", "aria-hidden": true %>
60
+ </span>
61
+ <% end %>
56
62
  <% end %>
57
63
  </td>
58
64
  </tr>
@@ -6,9 +6,9 @@
6
6
  <% if resource %>
7
7
  -
8
8
  <% if resource.is_a?(Decidim::Resourceable) %>
9
- <%= link_to(resource_title(resource), resource_locator(resource).path) %>
9
+ <%= link_to(decidim_escape_translated(resource.title).html_safe, resource_locator(resource).path) %>
10
10
  <% else %>
11
- <%= strip_tags resource_title(resource) %>
11
+ <%= decidim_escape_translated(resource.title).html_safe %>
12
12
  <% end %>
13
13
  <% end %>
14
14
  </h3>
@@ -1,5 +1,8 @@
1
1
  <meta name="viewport" content="width=device-width, initial-scale=1">
2
2
  <%= csrf_meta_tags %>
3
+ <%= legacy_favicon %>
4
+ <%= favicon %>
5
+ <%= apple_favicon %>
3
6
  <%= stylesheet_pack_tag "decidim_admin", media: "all" %>
4
7
  <%= javascript_pack_tag "decidim_admin", defer: false %>
5
8
  <%= organization_colors %>
@@ -1,5 +1,6 @@
1
1
  <%
2
2
  js_configs = {
3
+ api_path: decidim_api.root_path(locale: nil),
3
4
  icons_path: Decidim.cors_enabled ? "" : asset_pack_path("media/images/icons.svg"),
4
5
  messages: {
5
6
  "selfxssWarning": {
@@ -319,8 +319,6 @@ ar:
319
319
  view_more_logs: عرض المزيد من السجلات
320
320
  welcome: أهلا بك على اللوح الإداري.
321
321
  domain_whitelist:
322
- form:
323
- domain_too_short: نطاق الدومين قصير جداً
324
322
  update:
325
323
  error: فشل تحديث القائمة النطاقات المسموحة
326
324
  success: تم تحديث النطاقات المسموحة بنجاح
@@ -719,11 +717,6 @@ ar:
719
717
  organization_external_domain_whitelist:
720
718
  edit:
721
719
  update: تحديث
722
- external_domain:
723
- down: أسفل
724
- external_domain: نطاق خارجي
725
- remove: إزالة
726
- up: أعلى
727
720
  form:
728
721
  add: إضافة إلى القائمة البيضاء
729
722
  organization_homepage_content_blocks:
@@ -854,6 +847,7 @@ ar:
854
847
  areas: المناطق
855
848
  authorization_workflows: طرق التحقق
856
849
  dashboard: لوحة القيادة
850
+ edit_organization_appearance: تعديل مظهر الصفحة الرئيسية
857
851
  impersonatable_users: المشاركون في الإدارة
858
852
  impersonations: إدارة المشاركين
859
853
  pages: الصفحات