decidim-decidim_awesome 0.11.2 → 0.11.4

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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +54 -2
  4. data/app/cells/concerns/decidim/decidim_awesome/proposal_l_cell_override.rb +5 -3
  5. data/app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb +0 -4
  6. data/app/cells/decidim/decidim_awesome/voting/proposal_metadata_cell.rb +18 -3
  7. data/app/commands/concerns/decidim/decidim_awesome/proposals/create_proposal_override.rb +2 -2
  8. data/app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb +1 -1
  9. data/app/commands/concerns/decidim/decidim_awesome/system/register_organization_override.rb +29 -0
  10. data/app/commands/concerns/decidim/decidim_awesome/system/update_organization_override.rb +35 -0
  11. data/app/commands/concerns/decidim/decidim_awesome/update_account_override.rb +30 -0
  12. data/app/commands/decidim/decidim_awesome/admin/create_scoped_style.rb +3 -2
  13. data/app/commands/decidim/decidim_awesome/admin/destroy_scoped_style.rb +6 -4
  14. data/app/controllers/concerns/decidim/decidim_awesome/check_login_authorizations.rb +60 -0
  15. data/app/controllers/concerns/decidim/decidim_awesome/needs_awesome_config.rb +0 -2
  16. data/app/controllers/concerns/decidim/decidim_awesome/proposals/memoize_extra_fields.rb +23 -0
  17. data/app/controllers/concerns/decidim/decidim_awesome/use_user_time_zone.rb +32 -0
  18. data/app/controllers/decidim/decidim_awesome/admin/admin_authorizations_controller.rb +122 -0
  19. data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +1 -1
  20. data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +7 -1
  21. data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +5 -1
  22. data/app/controllers/decidim/decidim_awesome/admin/scoped_styles_controller.rb +12 -4
  23. data/app/controllers/decidim/decidim_awesome/required_authorizations_controller.rb +58 -0
  24. data/app/forms/concerns/decidim/decidim_awesome/account_form_override.rb +25 -0
  25. data/app/forms/concerns/decidim/decidim_awesome/system/organization_form_override.rb +34 -0
  26. data/app/forms/decidim/decidim_awesome/admin/config_form.rb +41 -8
  27. data/app/helpers/decidim/decidim_awesome/map_helper.rb +28 -26
  28. data/app/overrides/decidim/account/show/add_timezone_select.html.erb.deface +3 -0
  29. data/app/overrides/decidim/admin/officializations/index/add_modal.html.erb.deface +3 -0
  30. data/app/overrides/decidim/admin/officializations/index/add_td.html.erb.deface +5 -0
  31. data/app/overrides/decidim/admin/officializations/index/add_th.html.erb.deface +5 -0
  32. data/app/overrides/decidim/system/organizations/_advanced_settings/add_awesome_config.html.erb.deface +9 -0
  33. data/app/overrides/layouts/decidim/_head/add_awesome_tags.html.erb.deface +1 -1
  34. data/app/overrides/layouts/decidim/admin/_header/add_awesome_custom_styles.html.erb.deface +3 -0
  35. data/app/overrides/layouts/decidim/admin/_header/add_awesome_tags.html.erb.deface +1 -0
  36. data/app/packs/src/decidim/decidim_awesome/admin/proposal_sortings.js +0 -5
  37. data/app/packs/src/decidim/decidim_awesome/admin/verification_selects.js +21 -0
  38. data/app/packs/src/decidim/decidim_awesome/admin/verifications.js +43 -0
  39. data/app/packs/src/decidim/decidim_awesome/awesome_admin.js +1 -0
  40. data/app/packs/src/decidim/decidim_awesome/awesome_admin_global.js +1 -0
  41. data/app/packs/src/decidim/decidim_awesome/awesome_map/awesome_map.js +1 -1
  42. data/app/packs/stylesheets/decidim/decidim_awesome/admin/verifications.scss +99 -0
  43. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +1 -0
  44. data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +42 -11
  45. data/app/permissions/decidim/decidim_awesome/permissions.rb +7 -0
  46. data/app/presenters/decidim/decidim_awesome/admin_log/component_presenter_override.rb +3 -5
  47. data/app/presenters/decidim/decidim_awesome/admin_log/user_presenter_override.rb +46 -0
  48. data/app/views/decidim/decidim_awesome/account/_timezone_select.html.erb +3 -0
  49. data/app/views/decidim/decidim_awesome/admin/admin_authorizations/authorization.html.erb +20 -0
  50. data/app/views/decidim/decidim_awesome/admin/admin_authorizations/callout.html.erb +3 -0
  51. data/app/views/decidim/decidim_awesome/admin/admin_authorizations/conflict.html.erb +5 -0
  52. data/app/views/decidim/decidim_awesome/admin/admin_authorizations/edit.html.erb +41 -0
  53. data/app/views/decidim/decidim_awesome/admin/config/_form_scoped_admin_styles.html.erb +1 -0
  54. data/app/views/decidim/decidim_awesome/admin/config/_form_scoped_styles.html.erb +48 -0
  55. data/app/views/decidim/decidim_awesome/admin/config/_form_surveys.html.erb +8 -0
  56. data/app/views/decidim/decidim_awesome/admin/config/_form_verifications.html.erb +15 -0
  57. data/app/views/decidim/decidim_awesome/admin/constraints/no_permissions.html.erb +6 -0
  58. data/app/views/decidim/decidim_awesome/admin/officializations/_participants_td.html.erb +25 -0
  59. data/app/views/decidim/decidim_awesome/admin/officializations/_participants_th.html.erb +1 -0
  60. data/app/views/decidim/decidim_awesome/admin/officializations/_verification_modal.html.erb +9 -0
  61. data/app/views/decidim/decidim_awesome/required_authorizations/index.html.erb +66 -0
  62. data/app/views/decidim/decidim_awesome/system/organizations/_admin_allowed_authorizations.html.erb +5 -0
  63. data/app/views/layouts/decidim/decidim_awesome/_custom_styles.html.erb +1 -1
  64. data/app/views/layouts/decidim/decidim_awesome/admin/_custom_styles.html.erb +3 -0
  65. data/app/views/layouts/decidim/decidim_awesome/admin/admin_authorizations.html.erb +7 -0
  66. data/config/i18n-tasks.yml +6 -0
  67. data/config/locales/ca.yml +91 -5
  68. data/config/locales/cs.yml +86 -0
  69. data/config/locales/de.yml +131 -0
  70. data/config/locales/en.yml +115 -1
  71. data/config/locales/es.yml +89 -3
  72. data/config/locales/eu.yml +607 -26
  73. data/config/locales/fr.yml +37 -1
  74. data/config/locales/it.yml +0 -1
  75. data/config/locales/ja.yml +86 -0
  76. data/config/locales/nl.yml +0 -1
  77. data/config/locales/pt-BR.yml +0 -1
  78. data/lib/decidim/decidim_awesome/admin_engine.rb +2 -0
  79. data/lib/decidim/decidim_awesome/authorizator.rb +34 -0
  80. data/lib/decidim/decidim_awesome/awesome.rb +55 -1
  81. data/lib/decidim/decidim_awesome/awesome_helpers.rb +48 -19
  82. data/lib/decidim/decidim_awesome/checksums.yml +9 -0
  83. data/lib/decidim/decidim_awesome/engine.rb +20 -4
  84. data/lib/decidim/decidim_awesome/menu.rb +45 -9
  85. data/lib/decidim/decidim_awesome/request_memoizer.rb +16 -0
  86. data/lib/decidim/decidim_awesome/test/factories.rb +0 -4
  87. data/lib/decidim/decidim_awesome/test/initializer.rb +4 -0
  88. data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +1 -1
  89. data/lib/decidim/decidim_awesome/test/shared_examples/custom_styles_examples.rb +156 -0
  90. data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +26 -10
  91. data/lib/decidim/decidim_awesome/version.rb +1 -1
  92. data/package.json +6 -5
  93. metadata +42 -4
  94. data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +0 -30
@@ -10,8 +10,10 @@ module Decidim
10
10
  helper ConfigConstraintsHelpers
11
11
 
12
12
  layout false
13
+ helper_method :constraint_key
14
+
13
15
  before_action do
14
- render plain: "no permissions for #{constraint_key}" unless allowed_to? :edit_config, constraint_key
16
+ render :no_permissions unless allowed_to? :edit_config, constraint_key
15
17
  end
16
18
 
17
19
  def show
@@ -128,6 +130,8 @@ module Decidim
128
130
  case key
129
131
  when /^scoped_style_/
130
132
  :scoped_styles
133
+ when /^scoped_admin_style_/
134
+ :scoped_admin_styles
131
135
  when /^scoped_admin_/
132
136
  :scoped_admins
133
137
  when /^proposal_custom_field_/
@@ -6,7 +6,7 @@ module Decidim
6
6
  # Global configuration controller
7
7
  class ScopedStylesController < DecidimAwesome::Admin::ConfigController
8
8
  def create
9
- CreateScopedStyle.call(current_organization) do
9
+ CreateScopedStyle.call(current_organization, config_var) do
10
10
  on(:ok) do |key|
11
11
  flash[:notice] = I18n.t("config.create_scoped_style.success", key:, scope: "decidim.decidim_awesome.admin")
12
12
  end
@@ -16,11 +16,11 @@ module Decidim
16
16
  end
17
17
  end
18
18
 
19
- redirect_to decidim_admin_decidim_awesome.config_path(:styles)
19
+ redirect_to decidim_admin_decidim_awesome.config_path(config_var)
20
20
  end
21
21
 
22
22
  def destroy
23
- DestroyScopedStyle.call(params[:key], current_organization) do
23
+ DestroyScopedStyle.call(params[:key], current_organization, config_var) do
24
24
  on(:ok) do |key|
25
25
  flash[:notice] = I18n.t("config.destroy_scoped_style.success", key:, scope: "decidim.decidim_awesome.admin")
26
26
  end
@@ -30,7 +30,15 @@ module Decidim
30
30
  end
31
31
  end
32
32
 
33
- redirect_to decidim_admin_decidim_awesome.config_path(:styles)
33
+ redirect_to decidim_admin_decidim_awesome.config_path(config_var)
34
+ end
35
+
36
+ private
37
+
38
+ def config_var
39
+ return :scoped_admin_styles if params[:admin_panel] == "true"
40
+
41
+ :scoped_styles
34
42
  end
35
43
  end
36
44
  end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ # This controller handles image uploads for the Tiptap editor
6
+ class RequiredAuthorizationsController < DecidimAwesome::ApplicationController
7
+ layout "layouts/decidim/authorizations"
8
+ helper_method :granted_authorizations, :pending_authorizations, :missing_authorizations, :redirect_url
9
+
10
+ before_action do
11
+ redirect_to redirect_url unless user_signed_in?
12
+ redirect_to redirect_url if user_is_authorized?
13
+ end
14
+
15
+ def redirect_url
16
+ @redirect_url ||= begin
17
+ path = params[:redirect_url] || request.referer
18
+ if path.blank? || path.include?(decidim_decidim_awesome.required_authorizations_path.split("?").first)
19
+ decidim.root_path
20
+ else
21
+ path
22
+ end
23
+ end
24
+ end
25
+
26
+ def index
27
+ enforce_permission_to :read, :required_authorizations, user_is_authorized: user_is_authorized?
28
+ end
29
+
30
+ private
31
+
32
+ def missing_authorizations
33
+ @missing_authorizations ||= required_authorizations.filter do |manifest|
34
+ Decidim::Verifications::Authorizations.new(
35
+ organization: current_organization,
36
+ user: current_user,
37
+ name: required_authorizations.map(&:name)
38
+ ).pluck(:name).exclude?(manifest.name)
39
+ end
40
+ end
41
+
42
+ def pending_authorizations
43
+ @pending_authorizations ||= required_authorizations.filter do |manifest|
44
+ Decidim::Verifications::Authorizations.new(
45
+ organization: current_organization,
46
+ user: current_user,
47
+ name: required_authorizations.map(&:name),
48
+ granted: false
49
+ ).pluck(:name).include?(manifest.name)
50
+ end
51
+ end
52
+
53
+ def granted_authorizations
54
+ @granted_authorizations ||= required_authorizations.filter { |manifest| current_authorizations.pluck(:name).include?(manifest.name) }
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module AccountFormOverride
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ attribute :user_time_zone
10
+ validates :user_time_zone, time_zone: true, if: -> { user_time_zone.present? }
11
+
12
+ def user_time_zone
13
+ return nil if awesome_config[:user_timezone].blank?
14
+
15
+ super.presence || current_user.extended_data["time_zone"].presence || current_organization.time_zone
16
+ end
17
+
18
+ # Used for the user_time_zone setting, which does not have constraints
19
+ def awesome_config
20
+ @awesome_config ||= Decidim::DecidimAwesome::Config.new(current_organization)&.organization_config || {}
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module System
6
+ module OrganizationFormOverride
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ alias_method :decidim_original_map_model, :map_model
11
+
12
+ attribute :awesome_admins_available_authorizations, Array[String]
13
+
14
+ def map_model(model)
15
+ decidim_original_map_model(model)
16
+ map_awesome_configs(model)
17
+ end
18
+
19
+ def clean_awesome_admins_available_authorizations
20
+ return unless awesome_admins_available_authorizations
21
+
22
+ awesome_admins_available_authorizations.select(&:present?)
23
+ end
24
+
25
+ private
26
+
27
+ def map_awesome_configs(organization)
28
+ self.awesome_admins_available_authorizations = Decidim::DecidimAwesome::AwesomeConfig.find_by(var: :admins_available_authorizations, organization:)&.value
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -7,14 +7,20 @@ module Decidim
7
7
  module Admin
8
8
  class ConfigForm < Decidim::Form
9
9
  include ActionView::Helpers::SanitizeHelper
10
+ include TranslatableAttributes
10
11
 
11
12
  attribute :allow_images_in_editors, Boolean
12
13
  attribute :allow_videos_in_editors, Boolean
13
14
  attribute :allow_images_in_proposals, Boolean
14
15
  attribute :auto_save_forms, Boolean
15
16
  attribute :scoped_styles, Hash
17
+ attribute :scoped_admin_styles, Hash
16
18
  attribute :proposal_custom_fields, Hash
17
19
  attribute :proposal_private_custom_fields, Hash
20
+ attribute :user_timezone, Boolean
21
+ attribute :force_authorization_after_login, Array
22
+ attribute :force_authorization_with_any_method, Boolean
23
+ translatable_attribute :force_authorization_help_text, String
18
24
  attribute :scoped_admins, Hash
19
25
  attribute :menu, [MenuForm]
20
26
  attribute :intergram_for_admins, Boolean
@@ -31,10 +37,10 @@ module Decidim
31
37
  attribute :validate_body_start_with_caps, Boolean, default: true
32
38
  attribute :additional_proposal_sortings, Array, default: Decidim::DecidimAwesome.possible_additional_proposal_sortings
33
39
 
34
- # collect all keys anything not specified in the params (UpdateConfig command ignores it)
40
+ # collect all keys specified in the params (UpdateConfig command ignores everything else)
35
41
  attr_accessor :valid_keys
36
42
 
37
- validate :css_syntax, if: ->(form) { form.scoped_styles.present? }
43
+ validate :css_syntax
38
44
  validate :json_syntax
39
45
 
40
46
  validates :validate_title_min_length, presence: true, numericality: { greater_than_or_equal_to: 1, less_than_or_equal_to: 100 }
@@ -43,16 +49,29 @@ module Decidim
43
49
  validates :validate_body_min_length, presence: true, numericality: { greater_than_or_equal_to: 0 }
44
50
  validates :validate_body_max_caps_percent, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 100 }
45
51
  validates :validate_body_max_marks_together, presence: true, numericality: { greater_than_or_equal_to: 1 }
46
-
52
+ validate :force_authorization_after_login_is_valid
47
53
  # TODO: validate non general admins are here
48
54
 
49
55
  def self.from_params(params, additional_params = {})
50
56
  instance = super(params, additional_params)
51
- instance.valid_keys = params.keys.map(&:to_sym) || []
57
+ instance.force_authorization_after_login = instance.force_authorization_after_login.compact_blank if instance.force_authorization_after_login.present?
58
+ instance.valid_keys = extract_valid_keys_from_params(params)
52
59
  instance.sanitize_labels!
53
60
  instance
54
61
  end
55
62
 
63
+ def self.extract_valid_keys_from_params(params)
64
+ keys = []
65
+ params.each do |key, _value|
66
+ keys << if key.to_s.starts_with?("force_authorization_help_text_")
67
+ :force_authorization_help_text if keys.exclude?(:force_authorization_help_text)
68
+ else
69
+ key.to_sym
70
+ end
71
+ end
72
+ keys
73
+ end
74
+
56
75
  def additional_proposal_sorting_labels
57
76
  Decidim::DecidimAwesome.possible_additional_proposal_sortings.index_by do |sorting|
58
77
  I18n.t(sorting, scope: "decidim.proposals.proposals.orders")
@@ -60,12 +79,15 @@ module Decidim
60
79
  end
61
80
 
62
81
  def css_syntax
63
- scoped_styles.each do |key, code|
64
- next unless code
82
+ styles = {}
83
+ styles.merge!(scoped_styles: scoped_styles.values) if scoped_styles.present?
84
+ styles.merge!(scoped_admin_styles: scoped_admin_styles.values) if scoped_admin_styles.present?
85
+ styles.each do |key, values|
86
+ next if values.blank?
65
87
 
66
- SassC::Engine.new(code).render
88
+ values.each { |code| SassC::Engine.new(code).render }
67
89
  rescue SassC::SyntaxError => e
68
- errors.add(:scoped_styles, I18n.t("config.form.errors.incorrect_css", key:, scope: "decidim.decidim_awesome.admin"))
90
+ errors.add(key, I18n.t("config.form.errors.incorrect_css", key:, scope: "decidim.decidim_awesome.admin"))
69
91
  errors.add(key.to_sym, e.message)
70
92
  end
71
93
  end
@@ -112,6 +134,17 @@ module Decidim
112
134
  code
113
135
  end
114
136
  end
137
+
138
+ private
139
+
140
+ def force_authorization_after_login_is_valid
141
+ return if force_authorization_after_login.blank?
142
+
143
+ invalid = force_authorization_after_login - (current_organization.available_authorizations & Decidim.authorization_workflows.map(&:name))
144
+ return if invalid.empty?
145
+
146
+ errors.add(:force_authorization_after_login, :invalid)
147
+ end
115
148
  end
116
149
  end
117
150
  end
@@ -20,32 +20,34 @@ module Decidim
20
20
  end
21
21
 
22
22
  html_options = {
23
- "class" => "awesome-map",
24
- "id" => "awesome-map",
25
- "data-components" => components.map do |component|
26
- {
27
- id: component.id,
28
- type: component.manifest.name,
29
- name: translated_attribute(component.name),
30
- url: Decidim::EngineRouter.main_proxy(component).root_path,
31
- amendments: component.manifest.name == :proposals ? Decidim::Proposals::Proposal.where(component:).only_emendations.count : 0
32
- }
33
- end.to_json,
34
- "data-hide-controls" => settings_source.try(:hide_controls),
35
- "data-collapsed" => global_settings.collapse,
36
- "data-truncate" => global_settings.truncate || 255,
37
- "data-map-center" => global_settings.map_center,
38
- "data-map-zoom" => global_settings.map_zoom || 8,
39
- "data-menu-merge-components" => global_settings.menu_merge_components,
40
- "data-menu-amendments" => global_settings.menu_amendments,
41
- "data-menu-meetings" => global_settings.menu_meetings,
42
- "data-menu-categories" => global_settings.menu_categories,
43
- "data-menu-hashtags" => global_settings.menu_hashtags,
44
- "data-show-not-answered" => step_settings&.show_not_answered,
45
- "data-show-accepted" => step_settings&.show_accepted,
46
- "data-show-withdrawn" => step_settings&.show_withdrawn,
47
- "data-show-evaluating" => step_settings&.show_evaluating,
48
- "data-show-rejected" => step_settings&.show_rejected
23
+ class: "awesome-map",
24
+ id: "awesome-map",
25
+ data: {
26
+ "components" => components.map do |component|
27
+ {
28
+ id: component.id,
29
+ type: component.manifest.name,
30
+ name: translated_attribute(component.name),
31
+ url: Decidim::EngineRouter.main_proxy(component).root_path,
32
+ amendments: component.manifest.name == :proposals ? Decidim::Proposals::Proposal.where(component:).only_emendations.count : 0
33
+ }
34
+ end.to_json,
35
+ "hide-controls" => settings_source.try(:hide_controls),
36
+ "collapsed" => global_settings.collapse,
37
+ "truncate" => global_settings.truncate || 255,
38
+ "map-center" => global_settings.map_center,
39
+ "map-zoom" => global_settings.map_zoom || 8,
40
+ "menu-merge-components" => global_settings.menu_merge_components,
41
+ "menu-amendments" => global_settings.menu_amendments,
42
+ "menu-meetings" => global_settings.menu_meetings,
43
+ "menu-categories" => global_settings.menu_categories,
44
+ "menu-hashtags" => global_settings.menu_hashtags,
45
+ "show-not-answered" => step_settings&.show_not_answered,
46
+ "show-accepted" => step_settings&.show_accepted,
47
+ "show-withdrawn" => step_settings&.show_withdrawn,
48
+ "show-evaluating" => step_settings&.show_evaluating,
49
+ "show-rejected" => step_settings&.show_rejected
50
+ }
49
51
  }
50
52
 
51
53
  content_tag(:div, html_options) do
@@ -0,0 +1,3 @@
1
+ <!-- insert_after 'erb[loud]:contains("@account.organization.available_locales")' -->
2
+
3
+ <%= render partial: "decidim/decidim_awesome/account/timezone_select", locals: { f: f } %>
@@ -0,0 +1,3 @@
1
+ <!-- insert_after "erb[loud]:contains('show_email_modal')" -->
2
+
3
+ <%= render "decidim/decidim_awesome/admin/officializations/verification_modal" %>
@@ -0,0 +1,5 @@
1
+ <!-- insert_before "td.table-list__actions" -->
2
+
3
+ <% if awesome_config[:admins_available_authorizations] %>
4
+ <%= render "decidim/decidim_awesome/admin/officializations/participants_td", user: %>
5
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <!-- insert_before "th:last" -->
2
+
3
+ <% if awesome_config[:admins_available_authorizations] %>
4
+ <%= render "decidim/decidim_awesome/admin/officializations/participants_th" %>
5
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <!-- insert_top '#advanced-settings-panel' -->
2
+
3
+ <% if Decidim::DecidimAwesome.enabled?(:admins_available_authorizations) %>
4
+ <div class="awesome_available_authorizations border-2 rounded border-background p-4 form__wrapper mt-8 first:mt-0 last:pb-4">
5
+ <h3 class="h4"><%= t "decidim.decidim_awesome.system.organizations.awesome_tweaks" %></h3>
6
+
7
+ <%= render partial: "decidim/decidim_awesome/system/organizations/admin_allowed_authorizations", locals: { f: f } %>
8
+ </div>
9
+ <% end %>
@@ -1,7 +1,7 @@
1
1
  <!-- insert_after "erb[loud]:contains('append_stylesheet_pack_tag')" -->
2
2
 
3
3
  <% append_stylesheet_pack_tag "decidim_decidim_awesome", media: "all" %>
4
- <%= render(partial: "layouts/decidim/decidim_awesome/custom_styles") if awesome_custom_styles.present? %>
4
+ <%= render(partial: "layouts/decidim/decidim_awesome/custom_styles") if awesome_scoped_styles.present? %>
5
5
 
6
6
  <% append_javascript_pack_tag "decidim_decidim_awesome", defer: false %>
7
7
  <% append_javascript_pack_tag("decidim_decidim_awesome_custom_fields") if Decidim::DecidimAwesome.enabled?(:proposal_custom_fields) %>
@@ -0,0 +1,3 @@
1
+ <!-- insert_after "erb[loud]:contains('snippets.display(:head)')" -->
2
+
3
+ <%= render(partial: "layouts/decidim/decidim_awesome/admin/custom_styles") if awesome_scoped_admin_styles.present? %>
@@ -3,6 +3,7 @@
3
3
  <%= render partial: "layouts/decidim/decidim_awesome/awesome_config" %>
4
4
  <% append_stylesheet_pack_tag("decidim_admin_decidim_awesome_global") %>
5
5
  <% append_javascript_pack_tag("decidim_admin_decidim_awesome_global") %>
6
+
6
7
  <% append_javascript_pack_tag("decidim_decidim_awesome_custom_fields") if Decidim::DecidimAwesome.enabled?(:proposal_custom_fields) %>
7
8
  <% if awesome_config[:intergram_for_admins] %>
8
9
  <%= render partial: "layouts/decidim/decidim_awesome/intergram_widget", locals: { settings: organization_awesome_config[:intergram_for_admins_settings] } %>
@@ -15,11 +15,6 @@ document.addEventListener("DOMContentLoaded", () => {
15
15
  render: {
16
16
  option: function (data, escape) {
17
17
  return `<div>${escape(data.text)}</div>`;
18
- },
19
- item: function (data, escape) {
20
- return Boolean(data.is_admin) || data.isAdmin === "true"
21
- ? `<div class="is-admin">${escape(data.text)}</div>`
22
- : `<div>${escape(data.text)}</div>`;
23
18
  }
24
19
  }
25
20
  });
@@ -0,0 +1,21 @@
1
+ /* eslint-disable no-new */
2
+
3
+ import TomSelect from "tom-select/dist/cjs/tom-select.popular";
4
+
5
+ document.addEventListener("DOMContentLoaded", () => {
6
+ const selectContainer = document.getElementById("config_force_authorization_after_login");
7
+
8
+ if (!selectContainer) {
9
+ return;
10
+ }
11
+
12
+ new TomSelect(selectContainer, {
13
+ plugins: ["remove_button", "dropdown_input"],
14
+ create: false,
15
+ render: {
16
+ option: function (data, escape) {
17
+ return `<div>${escape(data.text)}</div>`;
18
+ }
19
+ }
20
+ });
21
+ });
@@ -0,0 +1,43 @@
1
+ document.addEventListener("DOMContentLoaded", () => {
2
+ const dialog = document.getElementById("awesome-verification-modal");
3
+ if (!dialog) {
4
+ return;
5
+ }
6
+ const container = dialog.querySelector("[data-dialog-container]");
7
+
8
+ dialog.addEventListener("open.dialog", async (el) => {
9
+ const modal = window.Decidim.currentDialogs[el.target.id];
10
+ const button = modal.openingTrigger;
11
+ const url = button.dataset.verificationUrl;
12
+ container.innerHTML = '<br><br><span class="loading-spinner"></span>';
13
+ // console.log("open.dialog", el, "container", container, "button", button, "url", url);
14
+ fetch(url).then((res) => res.text()).then((html) => {
15
+ container.innerHTML = html;
16
+ });
17
+ });
18
+
19
+
20
+ document.body.addEventListener("ajax:complete", (responseText) => {
21
+ const response = JSON.parse(responseText.detail[0].response)
22
+ const button = document.querySelector(`[data-verification-handler="${response.handler}"][data-verification-user-id="${response.userId}"]`);
23
+ // console.log("ajax:complete", responseText, "response", response, "button", button);
24
+ container.innerHTML = response.message;
25
+
26
+ if (response.granted) {
27
+ button.classList.add("granted");
28
+ } else {
29
+ button.classList.remove("granted");
30
+ const forceVerificationCheck = container.querySelector("#force_verification_check");
31
+ const forceVerification = container.querySelector("#force_verification");
32
+
33
+ if (forceVerificationCheck) {
34
+ forceVerificationCheck.addEventListener("change", function() {
35
+ forceVerification.disabled = !forceVerification.disabled;
36
+ if (forceVerificationCheck.checked) {
37
+ forceVerification.focus()
38
+ }
39
+ });
40
+ }
41
+ }
42
+ });
43
+ });
@@ -9,5 +9,6 @@ import "src/decidim/decidim_awesome/admin/form_exit_warn"
9
9
 
10
10
  import "src/decidim/decidim_awesome/proposals/custom_fields"
11
11
  import "src/decidim/decidim_awesome/admin/custom_fields_builder"
12
+ import "src/decidim/decidim_awesome/admin/verification_selects"
12
13
 
13
14
  window.DecidimAwesome = window.DecidimAwesome || {};
@@ -1 +1,2 @@
1
1
  import "src/decidim/decidim_awesome/admin/tabs_change"
2
+ import "src/decidim/decidim_awesome/admin/verifications"
@@ -1,6 +1,6 @@
1
1
  import * as L from "leaflet";
2
2
  // comes with Decidim
3
- import "src/decidim/vendor/leaflet-tilelayer-here"
3
+ import "leaflet-tilelayer-here"
4
4
  // Comes with Decidim
5
5
  import "leaflet.markercluster";
6
6
  // included in this package.json
@@ -0,0 +1,99 @@
1
+ .table-list .awesome_participants {
2
+ &-th:not(:first-child) {
3
+ @apply text-left pl-3;
4
+ }
5
+
6
+ &-td:not(:first-child) {
7
+ @apply text-left;
8
+
9
+ a {
10
+ @apply text-sm font-normal block;
11
+
12
+ &:hover {
13
+ @apply text-secondary underline;
14
+ }
15
+ }
16
+
17
+ > * {
18
+ @apply text-gray;
19
+
20
+ &.managed {
21
+ @apply text-gray-2;
22
+ }
23
+
24
+ .checked {
25
+ @apply hidden;
26
+ }
27
+
28
+ .undeterminated {
29
+ @apply hidden;
30
+ }
31
+
32
+ .unchecked {
33
+ @apply text-alert;
34
+ }
35
+
36
+ &.granted {
37
+ .checked {
38
+ @apply text-success inline;
39
+ }
40
+
41
+ .undeterminated {
42
+ @apply hidden;
43
+ }
44
+
45
+ .unchecked {
46
+ @apply hidden;
47
+ }
48
+ }
49
+
50
+ &.pending {
51
+ .checked {
52
+ @apply hidden;
53
+ }
54
+
55
+ .undeterminated {
56
+ @apply text-warning inline;
57
+ }
58
+
59
+ .unchecked {
60
+ @apply hidden;
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ .awesome_participants-modal {
68
+ h4 {
69
+ @apply text-xl block my-8;
70
+ }
71
+
72
+ .verification {
73
+ @apply flex items-center justify-between gap-4 border-[3px] border-background rounded px-4 py-4 mt-4;
74
+
75
+ &__container {
76
+ @apply space-y-8;
77
+
78
+ &-title {
79
+ @apply uppercase font-semibold text-gray-2 mb-8 mt-16 first:mt-0;
80
+ }
81
+ }
82
+
83
+ &__icon {
84
+ @apply flex-none w-8 h-8 text-gray fill-current;
85
+
86
+ &.is-granted {
87
+ @apply text-success;
88
+ }
89
+ }
90
+
91
+ &__text {
92
+ @apply grow space-y-2.5;
93
+
94
+ span {
95
+ @apply inline-block text-sm text-gray-2;
96
+ }
97
+ }
98
+ }
99
+ }
@@ -1,6 +1,7 @@
1
1
  @import "stylesheets/decidim/decidim_awesome/shared/spinner";
2
2
  @import "stylesheets/decidim/decidim_awesome/admin/intergram_fixes";
3
3
  @import "stylesheets/decidim/decidim_awesome/forms/custom_fields";
4
+ @import "stylesheets/decidim/decidim_awesome/admin/verifications";
4
5
 
5
6
  .component__show {
6
7
  &_private_data {