decidim-initiatives 0.28.5 → 0.29.0.rc1
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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/cells/decidim/initiatives/initiative_g_cell.rb +6 -4
- data/app/cells/decidim/initiatives_votes/vote_cell.rb +1 -3
- data/app/commands/decidim/initiatives/admin/create_initiative_type.rb +9 -58
- data/app/commands/decidim/initiatives/admin/create_initiative_type_scope.rb +5 -43
- data/app/commands/decidim/initiatives/admin/update_initiative.rb +25 -42
- data/app/commands/decidim/initiatives/admin/update_initiative_answer.rb +3 -4
- data/app/commands/decidim/initiatives/admin/update_initiative_type.rb +11 -61
- data/app/commands/decidim/initiatives/admin/update_initiative_type_scope.rb +2 -33
- data/app/commands/decidim/initiatives/admin/update_initiatives_settings.rb +2 -35
- data/app/commands/decidim/initiatives/approve_membership_request.rb +1 -1
- data/app/commands/decidim/initiatives/create_initiative.rb +6 -7
- data/app/commands/decidim/initiatives/revoke_membership_request.rb +1 -1
- data/app/commands/decidim/initiatives/spawn_committee_request.rb +4 -5
- data/app/commands/decidim/initiatives/update_initiative.rb +3 -3
- data/app/commands/decidim/initiatives/validate_sms_code.rb +3 -3
- data/app/controllers/concerns/decidim/initiatives/needs_initiative.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/answers_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +7 -6
- data/app/controllers/decidim/initiatives/admin/initiatives_settings_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/initiatives_type_scopes_controller.rb +2 -2
- data/app/controllers/decidim/initiatives/admin/initiatives_types_controller.rb +2 -2
- data/app/controllers/decidim/initiatives/application_controller.rb +5 -2
- data/app/controllers/decidim/initiatives/committee_requests_controller.rb +1 -2
- data/app/controllers/decidim/initiatives/create_initiative_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/initiatives_controller.rb +2 -2
- data/app/events/decidim/initiatives/approve_membership_request_event.rb +9 -29
- data/app/events/decidim/initiatives/create_initiative_event.rb +17 -36
- data/app/events/decidim/initiatives/revoke_membership_request_event.rb +10 -33
- data/app/events/decidim/initiatives/spawn_committee_request_event.rb +10 -33
- data/app/forms/decidim/initiatives/admin/initiative_answer_form.rb +1 -1
- data/app/forms/decidim/initiatives/admin/initiative_form.rb +3 -3
- data/app/forms/decidim/initiatives/admin/initiative_type_form.rb +2 -2
- data/app/forms/decidim/initiatives/initiative_form.rb +11 -1
- data/app/forms/decidim/initiatives/vote_form.rb +2 -2
- data/app/helpers/decidim/initiatives/initiative_helper.rb +0 -74
- data/app/helpers/decidim/initiatives/initiatives_helper.rb +0 -7
- data/app/models/decidim/initiative.rb +1 -1
- data/app/packs/entrypoints/decidim_initiatives_admin.js +0 -2
- data/app/packs/src/decidim/initiatives/admin/invite_users.js +1 -1
- data/app/permissions/decidim/initiatives/admin/permissions.rb +2 -2
- data/app/permissions/decidim/initiatives/permissions.rb +0 -14
- data/app/serializers/decidim/initiatives/initiative_serializer.rb +1 -1
- data/app/views/decidim/initiatives/admin/answers/_info_initiative.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/committee_requests/index.html.erb +1 -2
- data/app/views/decidim/initiatives/admin/exports/_dropdown.html.erb +6 -6
- data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +65 -59
- data/app/views/decidim/initiatives/admin/initiatives_type_scopes/_form.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives_types/_initiative_type_scopes.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives_types/index.html.erb +1 -1
- data/app/views/decidim/initiatives/committee_requests/new.html.erb +3 -4
- data/app/views/decidim/initiatives/initiative_signatures/fill_personal_data.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_interactions.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_new_initiative_button.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_vote_button.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/print.html.erb +2 -2
- data/app/views/decidim/initiatives/initiatives/show.html.erb +2 -3
- data/app/views/layouts/decidim/_initiative_header.html.erb +6 -6
- data/app/views/layouts/decidim/initiative.html.erb +2 -2
- data/app/views/layouts/decidim/initiative_head.html.erb +1 -1
- data/config/initializers/wicked_pdf.rb +6 -4
- data/config/locales/ar.yml +0 -7
- data/config/locales/bg.yml +1 -3
- data/config/locales/ca.yml +7 -14
- data/config/locales/cs.yml +5 -13
- data/config/locales/de.yml +7 -14
- data/config/locales/el.yml +0 -4
- data/config/locales/en.yml +6 -13
- data/config/locales/es-MX.yml +7 -14
- data/config/locales/es-PY.yml +7 -14
- data/config/locales/es.yml +6 -13
- data/config/locales/eu.yml +51 -58
- data/config/locales/fi-plain.yml +6 -13
- data/config/locales/fi.yml +21 -28
- data/config/locales/fr-CA.yml +3 -5
- data/config/locales/fr.yml +2 -4
- data/config/locales/ga-IE.yml +0 -1
- data/config/locales/gl.yml +0 -4
- data/config/locales/he-IL.yml +0 -6
- data/config/locales/hu.yml +1 -4
- data/config/locales/id-ID.yml +0 -4
- data/config/locales/is-IS.yml +0 -8
- data/config/locales/it.yml +1 -3
- data/config/locales/ja.yml +8 -15
- data/config/locales/lb.yml +1 -1
- data/config/locales/lt.yml +0 -3
- data/config/locales/lv.yml +0 -4
- data/config/locales/nl.yml +0 -4
- data/config/locales/no.yml +0 -2
- data/config/locales/pl.yml +5 -2
- data/config/locales/pt-BR.yml +1 -17
- data/config/locales/pt.yml +0 -2
- data/config/locales/ro-RO.yml +0 -12
- data/config/locales/ru.yml +0 -9
- data/config/locales/sk.yml +0 -4
- data/config/locales/sv.yml +69 -194
- data/config/locales/tr-TR.yml +1 -3
- data/config/locales/uk.yml +0 -9
- data/config/locales/zh-CN.yml +0 -3
- data/config/locales/zh-TW.yml +0 -3
- data/decidim-initiatives.gemspec +3 -2
- data/lib/decidim/api/initiative_api_type.rb +2 -2
- data/lib/decidim/initiatives/engine.rb +1 -0
- data/lib/decidim/initiatives/menu.rb +12 -1
- data/lib/decidim/initiatives/seeds.rb +89 -64
- data/lib/decidim/initiatives/version.rb +1 -1
- data/lib/decidim/initiatives.rb +0 -12
- data/lib/tasks/decidim_initiatives.rake +3 -3
- data/lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake +9 -11
- metadata +33 -25
- data/app/forms/decidim/initiatives/previous_form.rb +0 -24
- data/app/packs/entrypoints/decidim_initiatives_admin.scss +0 -1
- data/app/packs/stylesheets/decidim/initiatives/admin/initiatives.scss +0 -13
- data/app/queries/decidim/initiatives/similar_initiatives.rb +0 -54
- data/config/locales/bn-BD.yml +0 -1
- data/config/locales/bs-BA.yml +0 -1
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Initiatives
|
5
|
-
# Class uses to retrieve similar initiatives types.
|
6
|
-
class SimilarInitiatives < Decidim::Query
|
7
|
-
include Decidim::TranslationsHelper
|
8
|
-
include CurrentLocale
|
9
|
-
|
10
|
-
# Syntactic sugar to initialize the class and return the queried objects.
|
11
|
-
#
|
12
|
-
# organization - Decidim::Organization
|
13
|
-
# form - Decidim::Initiatives::PreviousForm
|
14
|
-
def self.for(organization, form)
|
15
|
-
new(organization, form).query
|
16
|
-
end
|
17
|
-
|
18
|
-
# Initializes the class.
|
19
|
-
#
|
20
|
-
# organization - Decidim::Organization
|
21
|
-
# form - Decidim::Initiatives::PreviousForm
|
22
|
-
def initialize(organization, form)
|
23
|
-
@organization = organization
|
24
|
-
@form = form
|
25
|
-
end
|
26
|
-
|
27
|
-
# Retrieves similar initiatives
|
28
|
-
def query
|
29
|
-
Initiative
|
30
|
-
.published
|
31
|
-
.where(organization: @organization)
|
32
|
-
.where(
|
33
|
-
Arel.sql("GREATEST(#{title_similarity}, #{description_similarity}) >= ?").to_s,
|
34
|
-
translated_attribute(form.title),
|
35
|
-
translated_attribute(form.description),
|
36
|
-
Decidim::Initiatives.similarity_threshold
|
37
|
-
)
|
38
|
-
.limit(Decidim::Initiatives.similarity_limit)
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
attr_reader :form
|
44
|
-
|
45
|
-
def title_similarity
|
46
|
-
"similarity(title->>'#{current_locale}', ?)"
|
47
|
-
end
|
48
|
-
|
49
|
-
def description_similarity
|
50
|
-
"similarity(description->>'#{current_locale}', ?)"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
data/config/locales/bn-BD.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
bn:
|
data/config/locales/bs-BA.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
bs:
|