decidim-stratified_sortitions 0.0.1 → 0.1.0
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/app/commands/decidim/stratified_sortitions/admin/create_stratified_sortition.rb +4 -9
- data/app/commands/decidim/stratified_sortitions/admin/update_stratified_sortition.rb +4 -9
- data/app/controllers/concerns/decidim/stratified_sortitions/strata_charts_data.rb +2 -1
- data/app/helpers/decidim/stratified_sortitions/application_helper.rb +6 -1
- data/app/jobs/decidim/stratified_sortitions/admin/import_sample_job.rb +1 -1
- data/app/jobs/decidim/stratified_sortitions/admin/sortition_results_export_job.rb +3 -1
- data/app/packs/src/decidim/stratified_sortitions/stratum_fields.js +0 -6
- data/app/packs/stylesheets/decidim/stratified_sortitions/admin/stratified_sortitions.scss +9 -2
- data/app/serializers/decidim/stratified_sortitions/sortition_result_serializer.rb +7 -1
- data/app/services/decidim/stratified_sortitions/charts_pdf_generator.rb +9 -13
- data/app/services/decidim/stratified_sortitions/fair_sortition_service.rb +1 -1
- data/app/services/decidim/stratified_sortitions/leximin/panel_generator.rb +1 -1
- data/app/services/decidim/stratified_sortitions/sortition_results_exporter.rb +13 -1
- data/app/views/decidim/stratified_sortitions/admin/stratified_sortitions/_form.html.erb +3 -3
- data/app/views/decidim/stratified_sortitions/admin/stratified_sortitions/_stratum.html.erb +2 -1
- data/app/views/decidim/stratified_sortitions/admin/stratified_sortitions/_substratum.html.erb +1 -0
- data/app/views/decidim/stratified_sortitions/admin/stratified_sortitions/execute.html.erb +18 -18
- data/app/views/decidim/stratified_sortitions/admin/stratified_sortitions/upload_sample.html.erb +12 -14
- data/config/assets.rb +2 -2
- data/config/i18n-tasks.yml +196 -0
- data/config/locales/ca.yml +169 -216
- data/config/locales/en.yml +171 -217
- data/config/locales/es.yml +170 -216
- data/config/locales/oc.yml +312 -0
- data/db/migrate/20251104120000_create_stratified_sortitions_strata_and_substrata.decidim_stratified_sortitions.rb +1 -1
- data/lib/decidim/stratified_sortitions/engine.rb +6 -3
- data/lib/decidim/stratified_sortitions/version.rb +2 -2
- metadata +9 -10
- data/app/views/decidim/admin/components/index.html.erb +0 -54
- data/app/views/layouts/decidim/admin/_sidebar_menu.html.erb +0 -45
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c45294d39478edb55e83c79c034a1fbcb831d4aca563a1e7befaddfb29c33057
|
|
4
|
+
data.tar.gz: d4ab0a8614ad78fcd2a5a44078b070b018f8741569043f10c04ba0817485d6fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2444dbf9797a0d3467d9029bf51dd86b8e47f2f52953d6e1e10db649e33dde9aa04aa23a441a4c877a9bfd310463fcb341f318c5019ded0d699936e4025682b4
|
|
7
|
+
data.tar.gz: 9d5b1b64c203b66edb40cb3f7064522bd02f138e1829400935ab89a6b81ebcd3e76ccff7c6cd1c7e2a002e138d38f3fb9fd6016a604c4549b02e23ce4ff3884c
|
|
@@ -35,16 +35,11 @@ module Decidim
|
|
|
35
35
|
attr_reader :form, :stratified_sortition
|
|
36
36
|
|
|
37
37
|
def create_stratified_sortition!
|
|
38
|
-
parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
|
|
39
|
-
parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
|
|
40
|
-
parsed_selection_criteria = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.selection_criteria, current_organization: form.current_organization).rewrite
|
|
41
|
-
parsed_selected_profiles_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.selected_profiles_description,
|
|
42
|
-
current_organization: form.current_organization).rewrite
|
|
43
38
|
params = {
|
|
44
|
-
title:
|
|
45
|
-
description:
|
|
46
|
-
selection_criteria:
|
|
47
|
-
selected_profiles_description:
|
|
39
|
+
title: form.title,
|
|
40
|
+
description: form.description,
|
|
41
|
+
selection_criteria: form.selection_criteria,
|
|
42
|
+
selected_profiles_description: form.selected_profiles_description,
|
|
48
43
|
component: form.current_component,
|
|
49
44
|
num_candidates: form.num_candidates,
|
|
50
45
|
}
|
|
@@ -47,16 +47,11 @@ module Decidim
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def attributes
|
|
50
|
-
parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
|
|
51
|
-
parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
|
|
52
|
-
parsed_selection_criteria = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.selection_criteria, current_organization: form.current_organization).rewrite
|
|
53
|
-
parsed_selected_profiles_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.selected_profiles_description,
|
|
54
|
-
current_organization: form.current_organization).rewrite
|
|
55
50
|
{
|
|
56
|
-
title:
|
|
57
|
-
description:
|
|
58
|
-
selection_criteria:
|
|
59
|
-
selected_profiles_description:
|
|
51
|
+
title: form.title,
|
|
52
|
+
description: form.description,
|
|
53
|
+
selection_criteria: form.selection_criteria,
|
|
54
|
+
selected_profiles_description: form.selected_profiles_description,
|
|
60
55
|
component: form.current_component,
|
|
61
56
|
num_candidates: form.num_candidates,
|
|
62
57
|
}
|
|
@@ -70,7 +70,8 @@ module Decidim
|
|
|
70
70
|
|
|
71
71
|
def build_stratum_chart(stratum, by_stratum, by_stratum_and_substratum)
|
|
72
72
|
substrata = stratum.substrata.order(:position)
|
|
73
|
-
|
|
73
|
+
participant_strata = by_stratum[stratum.id] || []
|
|
74
|
+
total = participant_strata.map(&:decidim_stratified_sortitions_sample_participant_id).uniq.count
|
|
74
75
|
chart_data = substrata.map do |substratum|
|
|
75
76
|
build_substratum_chart_row(stratum, substratum, by_stratum_and_substratum, total)
|
|
76
77
|
end
|
|
@@ -69,7 +69,12 @@ module Decidim
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def filter_sections_stratified_sortitions
|
|
72
|
-
sections = [{
|
|
72
|
+
sections = [{
|
|
73
|
+
method: :with_any_state,
|
|
74
|
+
collection: filter_state_values,
|
|
75
|
+
label: t("state", scope: "decidim.stratified_sortitions.stratified_sortitions.filters"),
|
|
76
|
+
id: "state",
|
|
77
|
+
}]
|
|
73
78
|
sections.reject { |item| item[:collection].blank? }
|
|
74
79
|
end
|
|
75
80
|
|
|
@@ -7,6 +7,7 @@ module Decidim
|
|
|
7
7
|
# to the requesting user as a zipped email attachment.
|
|
8
8
|
# Follows the same pattern as Decidim::ExportJob in decidim-core.
|
|
9
9
|
class SortitionResultsExportJob < ApplicationJob
|
|
10
|
+
include Decidim::PrivateDownloadHelper
|
|
10
11
|
queue_as :stratified_sortitions
|
|
11
12
|
|
|
12
13
|
def perform(user, stratified_sortition, format)
|
|
@@ -19,8 +20,9 @@ module Decidim
|
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
export_name = "sortition_results_#{stratified_sortition.id}"
|
|
23
|
+
private_export = attach_archive(export_data, export_name, user, "sortition_results")
|
|
22
24
|
|
|
23
|
-
Decidim::ExportMailer.export(user,
|
|
25
|
+
Decidim::ExportMailer.export(user, private_export).deliver_now
|
|
24
26
|
end
|
|
25
27
|
end
|
|
26
28
|
end
|
|
@@ -3,7 +3,6 @@ import AutoLabelByPositionComponent from "src/decidim/admin/auto_label_by_positi
|
|
|
3
3
|
import createLiveTextUpdateComponent from "src/decidim/forms/admin/live_text_update.component"
|
|
4
4
|
import createSortList from "src/decidim/admin/sort_list.component"
|
|
5
5
|
import { initializeSubstrataWrapper } from "src/decidim/stratified_sortitions/substratum_fields"
|
|
6
|
-
import { createAccordion } from "src/decidim/a11y"
|
|
7
6
|
|
|
8
7
|
$(() => {
|
|
9
8
|
const wrapperSelector = ".stratified-sortition-strata";
|
|
@@ -147,11 +146,6 @@ $(() => {
|
|
|
147
146
|
createSortableList();
|
|
148
147
|
runComponents();
|
|
149
148
|
|
|
150
|
-
const newAccordion = $newField[0].querySelector('[data-component="accordion"]');
|
|
151
|
-
if (newAccordion) {
|
|
152
|
-
try { createAccordion(newAccordion); } catch (_e) {}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
149
|
if (document && typeof document.dispatchEvent === "function") {
|
|
156
150
|
try {
|
|
157
151
|
document.dispatchEvent(new CustomEvent("ajax:loaded", { detail: $newField[0] }));
|
|
@@ -50,14 +50,21 @@
|
|
|
50
50
|
.substratum-fields {
|
|
51
51
|
display: flex;
|
|
52
52
|
gap: 1rem;
|
|
53
|
-
align-items:
|
|
53
|
+
align-items: flex-start;
|
|
54
54
|
justify-content: space-between;
|
|
55
|
-
|
|
55
|
+
margin-bottom: 1rem;
|
|
56
|
+
|
|
56
57
|
.translated-field {
|
|
57
58
|
width: 100%;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
.stratified-sortition-substrata-list {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
gap: 1rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
|
|
62
69
|
.example-file-census-container {
|
|
63
70
|
padding:1em;
|
|
@@ -102,7 +102,13 @@ module Decidim
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
def substratum_name_for(participant_stratum)
|
|
105
|
-
participant_stratum&.decidim_stratified_sortitions_substratum
|
|
105
|
+
substratum = participant_stratum&.decidim_stratified_sortitions_substratum
|
|
106
|
+
return "-" unless substratum
|
|
107
|
+
|
|
108
|
+
name = substratum.name
|
|
109
|
+
return "-" unless name
|
|
110
|
+
|
|
111
|
+
name.values.compact.first || "-"
|
|
106
112
|
end
|
|
107
113
|
|
|
108
114
|
def add_fairness_metrics(data, participant)
|
|
@@ -31,15 +31,15 @@ module Decidim
|
|
|
31
31
|
|
|
32
32
|
def template_assigns
|
|
33
33
|
{
|
|
34
|
-
title: t("pdf_title", name: translated_name(@stratified_sortition.title)),
|
|
35
|
-
subtitle: t("pdf_subtitle"),
|
|
36
|
-
belongs_to: t("pdf_belongs_to", space_name: participatory_space_name),
|
|
37
|
-
algorithm: t("pdf_algorithm", algorithm: algorithm_info),
|
|
38
|
-
executed_at: t("pdf_executed_at", date: execution_date),
|
|
39
|
-
no_data_text: t("pdf_no_data"),
|
|
40
|
-
col_target: t("target"),
|
|
41
|
-
col_candidates: t("candidates"),
|
|
42
|
-
col_results: t("results"),
|
|
34
|
+
title: I18n.t("decidim.stratified_sortitions.admin.stratified_sortitions.execute.pdf_title", name: translated_name(@stratified_sortition.title)),
|
|
35
|
+
subtitle: I18n.t("decidim.stratified_sortitions.admin.stratified_sortitions.execute.pdf_subtitle"),
|
|
36
|
+
belongs_to: I18n.t("decidim.stratified_sortitions.admin.stratified_sortitions.execute.pdf_belongs_to", space_name: participatory_space_name),
|
|
37
|
+
algorithm: I18n.t("decidim.stratified_sortitions.admin.stratified_sortitions.execute.pdf_algorithm", algorithm: algorithm_info),
|
|
38
|
+
executed_at: I18n.t("decidim.stratified_sortitions.admin.stratified_sortitions.execute.pdf_executed_at", date: execution_date),
|
|
39
|
+
no_data_text: I18n.t("decidim.stratified_sortitions.admin.stratified_sortitions.execute.pdf_no_data"),
|
|
40
|
+
col_target: I18n.t("decidim.stratified_sortitions.admin.stratified_sortitions.execute.target"),
|
|
41
|
+
col_candidates: I18n.t("decidim.stratified_sortitions.admin.stratified_sortitions.execute.candidates"),
|
|
42
|
+
col_results: I18n.t("decidim.stratified_sortitions.admin.stratified_sortitions.execute.results"),
|
|
43
43
|
strata_chart_data: build_strata_chart_data,
|
|
44
44
|
}
|
|
45
45
|
end
|
|
@@ -84,10 +84,6 @@ module Decidim
|
|
|
84
84
|
portfolio.selected_at.to_s
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
def t(key, **opts)
|
|
88
|
-
I18n.t(key, scope: "decidim.stratified_sortitions.admin.stratified_sortitions.execute", **opts)
|
|
89
|
-
end
|
|
90
|
-
|
|
91
87
|
def controller
|
|
92
88
|
@controller ||= ChartsPdfControllerHelper.new
|
|
93
89
|
end
|
|
@@ -162,7 +162,7 @@ module Decidim
|
|
|
162
162
|
# @param expected_ids [Array<Integer>] expected selected participant IDs
|
|
163
163
|
# @param verification_seed [String] the seed used in the original draw
|
|
164
164
|
# @return [Boolean] true if verification passes
|
|
165
|
-
def verify(expected_ids, verification_seed:)
|
|
165
|
+
def verify(expected_ids, verification_seed:) # rubocop:disable Naming/PredicateMethod
|
|
166
166
|
portfolio = existing_portfolio
|
|
167
167
|
return false unless portfolio&.sampled?
|
|
168
168
|
|
|
@@ -100,7 +100,7 @@ module Decidim
|
|
|
100
100
|
cat_sum = sum_vars(cat_vars)
|
|
101
101
|
|
|
102
102
|
# min <= sum <= max
|
|
103
|
-
model.enforce(cat_sum >= quota[:min]) if
|
|
103
|
+
model.enforce(cat_sum >= quota[:min]) if quota[:min].positive?
|
|
104
104
|
model.enforce(cat_sum <= quota[:max]) if quota[:max] < @cb.panel_size
|
|
105
105
|
end
|
|
106
106
|
|
|
@@ -140,12 +140,24 @@ module Decidim
|
|
|
140
140
|
]
|
|
141
141
|
@strata.each do |stratum|
|
|
142
142
|
ps = participant.sample_participant_strata.find { |s| s.decidim_stratified_sortitions_stratum_id == stratum.id }
|
|
143
|
-
substratum_name = ps
|
|
143
|
+
substratum_name = substratum_name_for(ps)
|
|
144
144
|
row << (substratum_name || "-")
|
|
145
145
|
end
|
|
146
146
|
row
|
|
147
147
|
end
|
|
148
148
|
|
|
149
|
+
def substratum_name_for(participant_stratum)
|
|
150
|
+
return unless participant_stratum
|
|
151
|
+
|
|
152
|
+
substratum = participant_stratum.decidim_stratified_sortitions_substratum
|
|
153
|
+
return unless substratum
|
|
154
|
+
|
|
155
|
+
name = substratum.name
|
|
156
|
+
return unless name
|
|
157
|
+
|
|
158
|
+
name.values.compact.first
|
|
159
|
+
end
|
|
160
|
+
|
|
149
161
|
def style_header_row(worksheet, row_index, _col_count)
|
|
150
162
|
worksheet.change_row_fill(row_index, "c0c0c0")
|
|
151
163
|
worksheet.change_row_bold(row_index, true)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="form__wrapper">
|
|
2
|
-
<div class="card" data-
|
|
2
|
+
<div class="card" data-controller="accordion" id="accordion-data">
|
|
3
3
|
<div class="card-divider">
|
|
4
4
|
<button class="card-divider-button" data-open="true" data-controls="panel-data" type="button">
|
|
5
5
|
<%= icon "arrow-right-s-line" %>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</div>
|
|
11
11
|
<div id="panel-data" class="card-section">
|
|
12
12
|
<div class="row columns">
|
|
13
|
-
<%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %>
|
|
13
|
+
<%= form.translated :text_field, :title, autofocus: true, aria: { label: :title }, data: { controller: "character-counter" } %>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<div class="row column mt-4">
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
</div>
|
|
32
32
|
</div>
|
|
33
33
|
|
|
34
|
-
<div class="card" data-
|
|
34
|
+
<div class="card" data-controller="accordion" id="accordion-strata">
|
|
35
35
|
<div class="card-divider">
|
|
36
36
|
<button class="card-divider-button" data-open="true" data-controls="panel-strata" type="button">
|
|
37
37
|
<svg viewBox="0 0 24 24" id="ri-arrow-right-s-line">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% stratum = form.object %>
|
|
2
2
|
|
|
3
|
-
<div class="card stratified-sortition-stratum" data-
|
|
3
|
+
<div class="card stratified-sortition-stratum" data-controller="accordion" id="accordion-<%= id %>-field">
|
|
4
4
|
<div class="card-divider stratum-divider">
|
|
5
5
|
<h2 class="card-title flex items-center">
|
|
6
6
|
<span>
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
tabs_id: id,
|
|
52
52
|
label: t(".name"),
|
|
53
53
|
maxlength: 100,
|
|
54
|
+
data: { controller: "character-counter" },
|
|
54
55
|
readonly: @stratified_sortition&.sample_participants&.any?) %>
|
|
55
56
|
</div>
|
|
56
57
|
<div>
|
|
@@ -25,24 +25,24 @@
|
|
|
25
25
|
<%= t('.execute_stratified_sortition') %>
|
|
26
26
|
</button>
|
|
27
27
|
<% if stratified_sortition.panel_portfolio&.sampled? %>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<ul class="
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
28
|
+
<div class="relative">
|
|
29
|
+
<button type="button" class="exports button button__sm button__secondary" data-controller="dropdown" data-target="export-dropdown">
|
|
30
|
+
<%= t(".export") %>
|
|
31
|
+
<%= icon "arrow-down-s-line", class: "!fill-white" %>
|
|
32
|
+
</button>
|
|
33
|
+
<ul id="export-dropdown" class="dropdown dropdown__bottom" aria-hidden="true">
|
|
34
|
+
<li class="dropdown__item exports--format--csv">
|
|
35
|
+
<%= link_to t(".export_csv"), export_results_stratified_sortition_path(stratified_sortition, format: "csv"), method: :post, class: "dropdown__button" %>
|
|
36
|
+
</li>
|
|
37
|
+
<li class="dropdown__item exports--format--excel">
|
|
38
|
+
<%= link_to t(".export_excel"), export_results_stratified_sortition_path(stratified_sortition, format: "excel"), method: :post, class: "dropdown__button" %>
|
|
39
|
+
</li>
|
|
40
|
+
<li class="dropdown__item exports--format--json">
|
|
41
|
+
<%= link_to t(".export_json"), export_results_stratified_sortition_path(stratified_sortition, format: "json"), method: :post, class: "dropdown__button" %>
|
|
42
|
+
</li>
|
|
43
|
+
<li class="dropdown__item exports--format--pdf">
|
|
44
|
+
<%= link_to t(".export_charts_pdf"), export_charts_pdf_stratified_sortition_path(stratified_sortition), method: :post, class: "dropdown__button" %>
|
|
45
|
+
</li>
|
|
46
46
|
</ul>
|
|
47
47
|
</div>
|
|
48
48
|
<% end %>
|
data/app/views/decidim/stratified_sortitions/admin/stratified_sortitions/upload_sample.html.erb
CHANGED
|
@@ -34,21 +34,19 @@
|
|
|
34
34
|
</tr>
|
|
35
35
|
<% end %>
|
|
36
36
|
</table>
|
|
37
|
-
<div class="mt-12">
|
|
38
|
-
<button type="button" class="button button__sm button__secondary" data-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
<div class="mt-12 relative inline-block">
|
|
38
|
+
<button type="button" class="button button__sm button__secondary" data-controller="dropdown" data-target="sample-template-dropdown">
|
|
39
|
+
<%= t(".download_template") %>
|
|
40
|
+
<%= icon "arrow-down-s-line", class: "!fill-white" %>
|
|
41
41
|
</button>
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
<%= link_to download_template_samples_path(id: @stratified_sortition.id, format: :csv)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<%= link_to download_template_samples_path(id: @stratified_sortition.id, format: :xlsx)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</ul>
|
|
51
|
-
</div>
|
|
42
|
+
<ul id="sample-template-dropdown" class="dropdown dropdown__bottom" aria-hidden="true">
|
|
43
|
+
<li class="dropdown__item">
|
|
44
|
+
<%= link_to t(".download_template_csv"), download_template_samples_path(id: @stratified_sortition.id, format: :csv), class: "dropdown__button" %>
|
|
45
|
+
</li>
|
|
46
|
+
<li class="dropdown__item">
|
|
47
|
+
<%= link_to t(".download_template_xlsx"), download_template_samples_path(id: @stratified_sortition.id, format: :xlsx), class: "dropdown__button" %>
|
|
48
|
+
</li>
|
|
49
|
+
</ul>
|
|
52
50
|
</div>
|
|
53
51
|
</div>
|
|
54
52
|
<div class="row mt-4 <%= 'upload-disabled-wrapper' if @stratified_sortition.executed? %>">
|
data/config/assets.rb
CHANGED
|
@@ -12,13 +12,13 @@ base_path = File.expand_path("..", __dir__)
|
|
|
12
12
|
# in your JavaScript entrypoints (or other JavaScript files within Decidim)
|
|
13
13
|
# using `import "src/decidim/foo"` after you have registered the additional path
|
|
14
14
|
# as follows.
|
|
15
|
-
Decidim::
|
|
15
|
+
Decidim::Shakapacker.register_path("#{base_path}/app/packs")
|
|
16
16
|
|
|
17
17
|
# Register the entrypoints for your module. These entrypoints can be included
|
|
18
18
|
# within your application using `javascript_pack_tag` and if you include any
|
|
19
19
|
# SCSS files within the entrypoints, they become available for inclusion using
|
|
20
20
|
# `stylesheet_pack_tag`.
|
|
21
|
-
Decidim::
|
|
21
|
+
Decidim::Shakapacker.register_entrypoints(
|
|
22
22
|
decidim_stratified_sortitions: "#{base_path}/app/packs/entrypoints/decidim_stratified_sortitions.js",
|
|
23
23
|
decidim_stratified_sortitions_admin: "#{base_path}/app/packs/entrypoints/decidim_stratified_sortitions_admin.js",
|
|
24
24
|
)
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
|
|
2
|
+
|
|
3
|
+
# The "main" locale.
|
|
4
|
+
base_locale: en
|
|
5
|
+
## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
|
|
6
|
+
# locales: [es, fr]
|
|
7
|
+
## Reporting locale, default: en. Available: en, ru.
|
|
8
|
+
# internal_locale: en
|
|
9
|
+
|
|
10
|
+
# Read and write translations.
|
|
11
|
+
data:
|
|
12
|
+
## Translations are read from the file system. Supported format: YAML, JSON.
|
|
13
|
+
## Provide a custom adapter:
|
|
14
|
+
# adapter: I18n::Tasks::Data::FileSystem
|
|
15
|
+
|
|
16
|
+
# Locale files or `Dir.glob` patterns where translations are read from:
|
|
17
|
+
read:
|
|
18
|
+
## Default:
|
|
19
|
+
# - config/locales/%{locale}.yml
|
|
20
|
+
## More files:
|
|
21
|
+
# - config/locales/**/*.%{locale}.yml
|
|
22
|
+
|
|
23
|
+
# Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
|
|
24
|
+
# `i18n-tasks normalize -p` will force move the keys according to these rules
|
|
25
|
+
write:
|
|
26
|
+
## For example, write devise and simple form keys to their respective files:
|
|
27
|
+
# - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
|
|
28
|
+
## Catch-all default:
|
|
29
|
+
# - config/locales/%{locale}.yml
|
|
30
|
+
|
|
31
|
+
# External locale data (e.g. gems).
|
|
32
|
+
# This data is not considered unused and is never written to.
|
|
33
|
+
external:
|
|
34
|
+
## Example (replace %#= with %=):
|
|
35
|
+
# - "<%#= %x[bundle info vagrant --path].chomp %>/templates/locales/%{locale}.yml"
|
|
36
|
+
|
|
37
|
+
## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, isolating_router, or a custom class.
|
|
38
|
+
# router: conservative_router
|
|
39
|
+
|
|
40
|
+
yaml:
|
|
41
|
+
write:
|
|
42
|
+
# do not wrap lines at 80 characters
|
|
43
|
+
line_width: -1
|
|
44
|
+
|
|
45
|
+
## Pretty-print JSON:
|
|
46
|
+
# json:
|
|
47
|
+
# write:
|
|
48
|
+
# indent: ' '
|
|
49
|
+
# space: ' '
|
|
50
|
+
# object_nl: "\n"
|
|
51
|
+
# array_nl: "\n"
|
|
52
|
+
|
|
53
|
+
# Find translate calls
|
|
54
|
+
search:
|
|
55
|
+
## Paths or `Find.find` patterns to search in:
|
|
56
|
+
# paths:
|
|
57
|
+
# - app/
|
|
58
|
+
|
|
59
|
+
## Root directories for relative keys resolution.
|
|
60
|
+
# relative_roots:
|
|
61
|
+
# - app/controllers
|
|
62
|
+
# - app/helpers
|
|
63
|
+
# - app/mailers
|
|
64
|
+
# - app/presenters
|
|
65
|
+
# - app/views
|
|
66
|
+
|
|
67
|
+
## Directories where method names which should not be part of a relative key resolution.
|
|
68
|
+
# By default, if a relative translation is used inside a method, the name of the method will be considered part of the resolved key.
|
|
69
|
+
# Directories listed here will not consider the name of the method part of the resolved key
|
|
70
|
+
#
|
|
71
|
+
# relative_exclude_method_name_paths:
|
|
72
|
+
# -
|
|
73
|
+
|
|
74
|
+
## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
|
|
75
|
+
## *.jpg *.jpeg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less
|
|
76
|
+
## *.yml *.json *.zip *.tar.gz *.swf *.flv *.mp3 *.wav *.flac *.webm *.mp4 *.ogg *.opus *.webp *.map *.xlsx
|
|
77
|
+
exclude:
|
|
78
|
+
- app/assets/images
|
|
79
|
+
- app/assets/fonts
|
|
80
|
+
- app/assets/videos
|
|
81
|
+
- app/assets/builds
|
|
82
|
+
|
|
83
|
+
## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
|
|
84
|
+
## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
|
|
85
|
+
# only: ["*.rb", "*.html.slim"]
|
|
86
|
+
|
|
87
|
+
## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`.
|
|
88
|
+
# strict: true
|
|
89
|
+
|
|
90
|
+
## Allows adding ast_matchers for finding translations using the AST-scanners
|
|
91
|
+
## The available matchers are:
|
|
92
|
+
## - RailsModelMatcher
|
|
93
|
+
## Matches ActiveRecord translations like
|
|
94
|
+
## User.human_attribute_name(:email) and User.model_name.human
|
|
95
|
+
## - DefaultI18nSubjectMatcher
|
|
96
|
+
## Matches ActionMailer's default_i18n_subject method
|
|
97
|
+
##
|
|
98
|
+
## To implement your own, please see `I18n::Tasks::Scanners::AstMatchers::BaseMatcher`.
|
|
99
|
+
# ast_matchers:
|
|
100
|
+
# - 'I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher'
|
|
101
|
+
# - 'I18n::Tasks::Scanners::AstMatchers::DefaultI18nSubjectMatcher'
|
|
102
|
+
|
|
103
|
+
## Multiple scanners can be used. Their results are merged.
|
|
104
|
+
## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
|
|
105
|
+
## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example
|
|
106
|
+
|
|
107
|
+
## Translation Services
|
|
108
|
+
# translation:
|
|
109
|
+
# # Google Translate
|
|
110
|
+
# # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
|
|
111
|
+
# google_translate_api_key: "AbC-dEf5"
|
|
112
|
+
# # DeepL Pro Translate
|
|
113
|
+
# # Get an API key and subscription at https://www.deepl.com/pro to use DeepL Pro
|
|
114
|
+
# deepl_api_key: "48E92789-57A3-466A-9959-1A1A1A1A1A1A"
|
|
115
|
+
# # deepl_host: "https://api.deepl.com"
|
|
116
|
+
# # deepl_version: "v2"
|
|
117
|
+
# # deepl_glossary_ids:
|
|
118
|
+
# # - f28106eb-0e06-489e-82c6-8215d6f95089
|
|
119
|
+
# # - 2c6415be-1852-4f54-9e1b-d800463496b4
|
|
120
|
+
# # add additional options to the DeepL.translate call: https://www.deepl.com/docs-api/translate-text/translate-text/
|
|
121
|
+
# deepl_options:
|
|
122
|
+
# formality: prefer_less
|
|
123
|
+
# # OpenAI
|
|
124
|
+
# openai_api_key: "sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
|
125
|
+
# # openai_model: "gpt-4o-mini" # see https://platform.openai.com/docs/models
|
|
126
|
+
# # may contain `%{from}` and `%{to}`, which will be replaced by source and target locale codes, respectively (using `Kernel.format`)
|
|
127
|
+
# # openai_system_prompt: >-
|
|
128
|
+
# # You are a professional translator that translates content from the %{from} locale
|
|
129
|
+
# # to the %{to} locale in an i18n locale array.
|
|
130
|
+
# #
|
|
131
|
+
# # The array has a structured format and contains multiple strings. Your task is to translate
|
|
132
|
+
# # each of these strings and create a new array with the translated strings.
|
|
133
|
+
# #
|
|
134
|
+
# # HTML markups (enclosed in < and > characters) must not be changed under any circumstance.
|
|
135
|
+
# # Variables (starting with %%{ and ending with }) must not be changed under any circumstance.
|
|
136
|
+
# #
|
|
137
|
+
# # Keep in mind the context of all the strings for a more accurate translation.
|
|
138
|
+
|
|
139
|
+
## Do not consider these keys missing:
|
|
140
|
+
ignore_missing:
|
|
141
|
+
- 'decidim.admin.actions.view_deleted_components'
|
|
142
|
+
- 'decidim.admin.components.index.add'
|
|
143
|
+
- 'decidim.admin.components.title'
|
|
144
|
+
- 'decidim.admin.exports.notice'
|
|
145
|
+
- 'decidim.admin.titles.menu'
|
|
146
|
+
- 'decidim.admin.tooltips.deleted_component_info'
|
|
147
|
+
- 'decidim.components.pagination.page_title'
|
|
148
|
+
# - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
|
|
149
|
+
# - '{devise,simple_form}.*'
|
|
150
|
+
|
|
151
|
+
## Consider these keys used:
|
|
152
|
+
ignore_unused:
|
|
153
|
+
- 'activemodel.attributes.sample_upload.*'
|
|
154
|
+
- 'activemodel.attributes.stratified_sortition.*'
|
|
155
|
+
- 'activemodel.errors.messages.cannot_{add,change,delete}_*'
|
|
156
|
+
- 'decidim.components.stratified_sortitions.name'
|
|
157
|
+
- 'decidim.components.stratified_sortitions.settings.global.publish_sortitions'
|
|
158
|
+
- 'decidim.components.stratified_sortitions.settings.step.announcement'
|
|
159
|
+
- 'decidim.stratified_sortitions.admin_log.stratified_sortition.*'
|
|
160
|
+
- 'decidim.stratified_sortitions.admin.stratified_sortitions.upload_sample.*'
|
|
161
|
+
- 'decidim.stratified_sortitions.stratified_sortitions.filters.{executing,failed}'
|
|
162
|
+
- 'decidim.stratified_sortitions.stratified_sortitions.orders.*'
|
|
163
|
+
- 'decidim.stratified_sortitions.stratified_sortitions.show.statuses.*'
|
|
164
|
+
# - 'activerecord.attributes.*'
|
|
165
|
+
# - '{devise,kaminari,will_paginate}.*'
|
|
166
|
+
# - 'simple_form.{yes,no}'
|
|
167
|
+
# - 'simple_form.{placeholders,hints,labels}.*'
|
|
168
|
+
# - 'simple_form.{error_notification,required}.:'
|
|
169
|
+
|
|
170
|
+
## Exclude these keys from the `i18n-tasks eq-base' report:
|
|
171
|
+
# ignore_eq_base:
|
|
172
|
+
# all:
|
|
173
|
+
# - common.ok
|
|
174
|
+
# fr,es:
|
|
175
|
+
# - common.brand
|
|
176
|
+
|
|
177
|
+
## Exclude these keys from the `i18n-tasks check-consistent-interpolations` report:
|
|
178
|
+
# ignore_inconsistent_interpolations:
|
|
179
|
+
# - 'activerecord.attributes.*'
|
|
180
|
+
|
|
181
|
+
## Ignore these keys completely:
|
|
182
|
+
# ignore:
|
|
183
|
+
# - kaminari.*
|
|
184
|
+
|
|
185
|
+
## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
|
|
186
|
+
## e.g. in case of a relative key defined in a helper method.
|
|
187
|
+
## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
|
|
188
|
+
#
|
|
189
|
+
# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
|
190
|
+
# only: %w(*.html.haml *.html.slim),
|
|
191
|
+
# patterns: [['= title\b', '.page_title']] %>
|
|
192
|
+
#
|
|
193
|
+
# The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
|
|
194
|
+
#
|
|
195
|
+
# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
|
196
|
+
# patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
|