decidim-survey_results 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE-AGPLv3.txt +661 -0
- data/README.md +30 -0
- data/Rakefile +9 -0
- data/app/controllers/decidim/survey_results/admin/application_controller.rb +15 -0
- data/app/controllers/decidim/survey_results/application_controller.rb +13 -0
- data/app/controllers/decidim/survey_results/survey_results_controller.rb +32 -0
- data/app/helpers/decidim/survey_results/application_helper.rb +10 -0
- data/app/helpers/decidim/survey_results/survey_results_helper.rb +30 -0
- data/app/models/decidim/survey_results/application_record.rb +10 -0
- data/app/models/decidim/survey_results/files_question_results.rb +60 -0
- data/app/models/decidim/survey_results/full_questionnaire.rb +54 -0
- data/app/models/decidim/survey_results/matrix_question_results.rb +61 -0
- data/app/models/decidim/survey_results/options_question_results.rb +35 -0
- data/app/models/decidim/survey_results/results.rb +68 -0
- data/app/models/decidim/survey_results/separator_question_results.rb +16 -0
- data/app/models/decidim/survey_results/sorting_question_results.rb +71 -0
- data/app/models/decidim/survey_results/text_question_results.rb +61 -0
- data/app/overrides/decidim/forms/questionnaires/questionnaire_show.rb +9 -0
- data/app/packs/entrypoints/decidim_survey_results.js +6 -0
- data/app/packs/entrypoints/decidim_survey_results.scss +1 -0
- data/app/packs/images/decidim/survey_results/condition_question.png +0 -0
- data/app/packs/images/decidim/survey_results/icon.svg +1 -0
- data/app/packs/src/decidim/survey_results/application.js +2 -0
- data/app/packs/src/decidim/survey_results/chart_helper.js +24 -0
- data/app/packs/src/decidim/survey_results/charts.js +108 -0
- data/app/packs/stylesheets/decidim/survey_results/survey_results.scss +127 -0
- data/app/views/decidim/survey_results/survey_results/_answered_table.html.erb +21 -0
- data/app/views/decidim/survey_results/survey_results/_files_question_results.html.erb +9 -0
- data/app/views/decidim/survey_results/survey_results/_matrix_question_results.html.erb +26 -0
- data/app/views/decidim/survey_results/survey_results/_options_question_results.html.erb +24 -0
- data/app/views/decidim/survey_results/survey_results/_participants_icon.html.erb +15 -0
- data/app/views/decidim/survey_results/survey_results/_questions.html.erb +25 -0
- data/app/views/decidim/survey_results/survey_results/_separator_question_results.html.erb +1 -0
- data/app/views/decidim/survey_results/survey_results/_sorting_question_results.html.erb +26 -0
- data/app/views/decidim/survey_results/survey_results/_text_question_results.html.erb +9 -0
- data/app/views/decidim/survey_results/survey_results/_title_and_description.html.erb +3 -0
- data/app/views/decidim/survey_results/survey_results/show.html.erb +17 -0
- data/app/views/layouts/decidim/_head.html.erb +36 -0
- data/config/assets.rb +9 -0
- data/config/i18n-tasks.yml +144 -0
- data/config/locales/ca.yml +37 -0
- data/config/locales/en.yml +37 -0
- data/config/locales/es.yml +37 -0
- data/lib/decidim/survey_results/admin_engine.rb +26 -0
- data/lib/decidim/survey_results/engine.rb +32 -0
- data/lib/decidim/survey_results/extend_components.rb +6 -0
- data/lib/decidim/survey_results/test/factories.rb +13 -0
- data/lib/decidim/survey_results/version.rb +13 -0
- data/lib/decidim/survey_results.rb +11 -0
- data/lib/decidim-survey_results.rb +3 -0
- metadata +179 -0
@@ -0,0 +1,108 @@
|
|
1
|
+
import { normalizeLabels } from "./chart_helper";
|
2
|
+
|
3
|
+
$(()=> {
|
4
|
+
Array.from(document.getElementsByClassName('short_answer-chart')).concat(
|
5
|
+
Array.from(document.getElementsByClassName('long_answer-chart')).concat(
|
6
|
+
Array.from(document.getElementsByClassName('files-chart'))
|
7
|
+
)
|
8
|
+
).forEach(canvas => {
|
9
|
+
let chart = canvas.getContext('2d');
|
10
|
+
let dataset = JSON.parse(chart.canvas.dataset.dataset);
|
11
|
+
renderPieChart(chart, dataset);
|
12
|
+
});
|
13
|
+
|
14
|
+
Array.from(document.getElementsByClassName('single_option-chart')).forEach(canvas => {
|
15
|
+
let chart = canvas.getContext('2d');
|
16
|
+
let datasets = JSON.parse(chart.canvas.dataset.datasets);
|
17
|
+
simpleBarsChart(chart, datasets[0]);
|
18
|
+
});
|
19
|
+
|
20
|
+
Array.from(document.getElementsByClassName('multiple_option-chart')).forEach(canvas => {
|
21
|
+
let chart = canvas.getContext('2d');
|
22
|
+
let datasets = JSON.parse(chart.canvas.dataset.datasets);
|
23
|
+
simpleBarsChart(chart, datasets[0]);
|
24
|
+
});
|
25
|
+
|
26
|
+
Array.from(document.getElementsByClassName('matrix_multiple-chart')).forEach(canvas => {
|
27
|
+
let chart = canvas.getContext('2d');
|
28
|
+
let datasets = JSON.parse(chart.canvas.dataset.datasets);
|
29
|
+
renderMatrixChart(chart, datasets);
|
30
|
+
});
|
31
|
+
|
32
|
+
Array.from(document.getElementsByClassName('matrix_single-chart')).forEach(canvas => {
|
33
|
+
let chart = canvas.getContext('2d');
|
34
|
+
let datasets = JSON.parse(chart.canvas.dataset.datasets);
|
35
|
+
renderMatrixChart(chart, datasets);
|
36
|
+
});
|
37
|
+
|
38
|
+
Array.from(document.getElementsByClassName('sorting-chart')).forEach(canvas => {
|
39
|
+
let chart = canvas.getContext('2d');
|
40
|
+
let datasets = JSON.parse(chart.canvas.dataset.datasets);
|
41
|
+
renderLinesChart(chart, datasets);
|
42
|
+
});
|
43
|
+
});
|
44
|
+
|
45
|
+
function renderMatrixChart(ctx, datasets) {
|
46
|
+
new Chart(ctx, {
|
47
|
+
type: 'bar',
|
48
|
+
data: {
|
49
|
+
labels: normalizeLabels(JSON.parse(ctx.canvas.dataset.labels)),
|
50
|
+
datasets: datasets
|
51
|
+
},
|
52
|
+
options: {
|
53
|
+
scales: {
|
54
|
+
y: {
|
55
|
+
beginAtZero: true,
|
56
|
+
ticks: {
|
57
|
+
stepSize: 1
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
});
|
63
|
+
}
|
64
|
+
|
65
|
+
function simpleBarsChart(ctx, dataset) {
|
66
|
+
new Chart(ctx, {
|
67
|
+
type: 'bar',
|
68
|
+
data: {
|
69
|
+
labels: normalizeLabels(JSON.parse(ctx.canvas.dataset.labels)),
|
70
|
+
datasets: [{
|
71
|
+
label: dataset['label'],
|
72
|
+
data: dataset['data'],
|
73
|
+
borderWidth: 1,
|
74
|
+
minBarLength: 1,
|
75
|
+
}]
|
76
|
+
},
|
77
|
+
options: {
|
78
|
+
scales: {
|
79
|
+
y: {
|
80
|
+
beginAtZero: true,
|
81
|
+
ticks: {
|
82
|
+
stepSize: 1
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
});
|
88
|
+
}
|
89
|
+
|
90
|
+
function renderPieChart(ctx, dataset) {
|
91
|
+
new Chart(ctx, {
|
92
|
+
type: 'doughnut',
|
93
|
+
data: {
|
94
|
+
labels: normalizeLabels(JSON.parse(ctx.canvas.dataset.labels)),
|
95
|
+
datasets: [dataset]
|
96
|
+
}
|
97
|
+
});
|
98
|
+
}
|
99
|
+
|
100
|
+
function renderLinesChart(ctx, datasets) {
|
101
|
+
new Chart(ctx, {
|
102
|
+
type: 'line',
|
103
|
+
data: {
|
104
|
+
labels: normalizeLabels(JSON.parse(ctx.canvas.dataset.labels)),
|
105
|
+
datasets: datasets
|
106
|
+
}
|
107
|
+
});
|
108
|
+
}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
/* css for decidim_survey_results */
|
2
|
+
.survey-results-wrapper {
|
3
|
+
.alert-survey {
|
4
|
+
background-color: lighten(#9595c7, 20%);
|
5
|
+
width: 100%;
|
6
|
+
height: 45px;
|
7
|
+
display: flex;
|
8
|
+
align-items: center;
|
9
|
+
padding-left: 32px;
|
10
|
+
border-left: 4px solid #9595c7;
|
11
|
+
margin-bottom: 28px;
|
12
|
+
}
|
13
|
+
|
14
|
+
.section-heading {
|
15
|
+
margin: 0;
|
16
|
+
padding: 24px 0 20px 0;
|
17
|
+
font-size: 20px;
|
18
|
+
font-weight: bold;
|
19
|
+
|
20
|
+
&::before {
|
21
|
+
margin-right: 30px;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
.section-participants {
|
26
|
+
display: flex;
|
27
|
+
align-items: baseline;
|
28
|
+
gap: 12px;
|
29
|
+
margin-bottom: 30px;
|
30
|
+
|
31
|
+
p {
|
32
|
+
font-size: 14px;
|
33
|
+
}
|
34
|
+
|
35
|
+
#users-icon {
|
36
|
+
fill: var(--primary);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
.question-box {
|
41
|
+
background-color: #fff;
|
42
|
+
padding: 50px;
|
43
|
+
border: 1px solid #e9e9e9;
|
44
|
+
margin-bottom: 100px;
|
45
|
+
|
46
|
+
.question-number {
|
47
|
+
margin-bottom: 5px;
|
48
|
+
font-size: 14px;
|
49
|
+
text-transform: uppercase;
|
50
|
+
display: flex;
|
51
|
+
align-items: baseline;
|
52
|
+
|
53
|
+
img {
|
54
|
+
object-fit: contain;
|
55
|
+
margin-right: 8px;
|
56
|
+
}
|
57
|
+
|
58
|
+
span {
|
59
|
+
font-weight: bold;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
.question-title {
|
64
|
+
font-size: 20px;
|
65
|
+
}
|
66
|
+
|
67
|
+
.big-title {
|
68
|
+
text-transform: uppercase;
|
69
|
+
font-weight: bold;
|
70
|
+
}
|
71
|
+
|
72
|
+
.description {
|
73
|
+
font-size: 14px;
|
74
|
+
}
|
75
|
+
|
76
|
+
.big-title {
|
77
|
+
margin-bottom: 8px;
|
78
|
+
}
|
79
|
+
|
80
|
+
table {
|
81
|
+
margin-bottom: 70px;
|
82
|
+
|
83
|
+
thead,
|
84
|
+
tr,
|
85
|
+
tbody {
|
86
|
+
background: #fff;
|
87
|
+
border: none;
|
88
|
+
border-bottom: 1px solid #f2f2f2;
|
89
|
+
}
|
90
|
+
|
91
|
+
th {
|
92
|
+
font-weight: normal;
|
93
|
+
font-size: 14px;
|
94
|
+
|
95
|
+
&:not(:first-child) {
|
96
|
+
text-align: center;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
td:not(:first-child) {
|
101
|
+
text-align: center;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
&.pie-chart-wrapper {
|
106
|
+
.answers-results {
|
107
|
+
display: flex;
|
108
|
+
flex-direction: row-reverse;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
.answers-chart {
|
114
|
+
display: flex;
|
115
|
+
justify-content: center;
|
116
|
+
margin-bottom: 18px;
|
117
|
+
}
|
118
|
+
|
119
|
+
canvas {
|
120
|
+
width: 200px;
|
121
|
+
}
|
122
|
+
|
123
|
+
.pie-chart {
|
124
|
+
width: 300px !important;
|
125
|
+
height: 300px !important;
|
126
|
+
}
|
127
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<table>
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th></th>
|
5
|
+
<th><%= t(".table.percentage") %></th>
|
6
|
+
<th><%= t(".table.quantity") %></th>
|
7
|
+
</tr>
|
8
|
+
</thead>
|
9
|
+
<tbody>
|
10
|
+
<tr>
|
11
|
+
<td><%= t(".table.answered") %></td>
|
12
|
+
<td><%= results.answered_percentage %>%</td>
|
13
|
+
<td><%= results.answered_count %></td>
|
14
|
+
</tr>
|
15
|
+
<tr>
|
16
|
+
<td><%= t(".table.not_answered") %></td>
|
17
|
+
<td><%= results.not_answered_percentage %>%</td>
|
18
|
+
<td><%= results.not_answered_count %></td>
|
19
|
+
</tr>
|
20
|
+
</tbody>
|
21
|
+
</table>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<div class="answers-chart">
|
2
|
+
<canvas
|
3
|
+
class="<%= results.question_type %>-chart"
|
4
|
+
data-labels="<%= results.x_labels %>"
|
5
|
+
data-datasets="<%= results.datasets.to_json %>"
|
6
|
+
></canvas>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<table>
|
10
|
+
<thead>
|
11
|
+
<th>Valor</th>
|
12
|
+
<% results.datasets.each do |ds| %>
|
13
|
+
<th><%= ds[:label] %></th>
|
14
|
+
<% end -%>
|
15
|
+
</thead>
|
16
|
+
<tbody>
|
17
|
+
<% results.x_labels.each_with_index do |label, idx| %>
|
18
|
+
<tr>
|
19
|
+
<td><%= label %></td>
|
20
|
+
<% results.datasets.each do |ds| %>
|
21
|
+
<td><%= ds[:data][idx] %></td>
|
22
|
+
<% end -%>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
</tbody>
|
26
|
+
</table>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="answers-chart">
|
2
|
+
<canvas
|
3
|
+
class="<%= results.question_type %>-chart"
|
4
|
+
data-labels="<%= results.x_labels %>"
|
5
|
+
data-datasets="<%= results.datasets.to_json %>"
|
6
|
+
></canvas>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<table>
|
10
|
+
<thead>
|
11
|
+
<th>Valor</th>
|
12
|
+
<th>Porcentaje</th>
|
13
|
+
<th>Cantidad</th>
|
14
|
+
</thead>
|
15
|
+
<tbody>
|
16
|
+
<% results.x_labels.zip(results.datasets.first[:data]).each do |label, count| %>
|
17
|
+
<tr>
|
18
|
+
<td><%= label %></td>
|
19
|
+
<td><%= results.answers_percentage(count) %>%</td>
|
20
|
+
<td><%= count %></td>
|
21
|
+
</tr>
|
22
|
+
<% end %>
|
23
|
+
</tbody>
|
24
|
+
</table>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<svg width="20px" height="15px" viewBox="0 0 20 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
2
|
+
<title>users@2x</title>
|
3
|
+
<g id="surveys" stroke="none" stroke-width="1" fill-rule="evenodd">
|
4
|
+
<g id="SURVEYS" transform="translate(-280.000000, -543.000000)" fill-rule="nonzero">
|
5
|
+
<g id="Group" transform="translate(280.000000, 542.000000)">
|
6
|
+
<g id="users-icon" transform="translate(0.000000, 1.000000)">
|
7
|
+
<path d="M20,14.0348525 C20,13.7131367 19.9600202,13.3914209 19.9200404,13.0697051 C19.6002022,11.3404826 18.0409906,10.0134048 16.3218598,9.93297587 C15.722163,9.89276139 15.1224663,10.0536193 14.6027291,10.3351206 C12.4438207,6.95710456 7.68622632,6.91689008 5.48733816,10.3351206 C5.40737859,10.2949062 5.3673988,10.2546917 5.28743924,10.2546917 C4.80768182,10.0536193 4.28794462,9.89276139 3.76820742,9.93297587 C1.60929904,10.0134048 -0.149811482,11.9839142 0.0101076564,14.155496 C0.0101076564,14.2761394 0.0500874411,14.5576408 0.0900672258,14.6380697 C0.170026795,14.8391421 0.329945934,15 0.569824642,15 L19.4003032,15 C19.6401819,15 19.8001011,14.8391421 19.8800606,14.6380697 C19.9600202,14.5174263 20,14.1957105 20,14.0348525 Z M17.4812736,11.7024129 C18.2408895,12.1849866 18.6007075,12.8686327 18.6806671,13.7533512 L15.6422035,13.7533512 C15.6022237,13.3914209 15.6022237,13.0697051 15.5222641,12.7077748 C15.4423045,12.30563 15.3223652,11.9436997 15.2424056,11.541555 C16.0020215,11.1394102 16.7616374,11.2198391 17.4812736,11.7024129 Z M7.00656998,10.5764075 C8.08602416,9.32975871 9.72519534,8.84718499 11.2444272,9.36997319 C12.6437196,9.85254692 13.5232749,10.8981233 14.0430121,12.2654155 C14.2029312,12.7479893 14.2828908,13.2707775 14.3228706,13.7533512 L5.72721687,13.7533512 C5.80717644,12.5469169 6.20697428,11.461126 7.00656998,10.5764075 Z M2.52883409,11.7024129 C3.24847022,11.2198391 4.00808613,11.0991957 4.80768182,11.541555 C4.76770203,11.6219839 4.76770203,11.7024129 4.72772225,11.7828418 C4.48784354,12.4262735 4.40788397,13.0697051 4.36790419,13.7131367 L1.36942034,13.7131367 C1.40940012,12.8686327 1.80919797,12.1849866 2.52883409,11.7024129 Z" id="Shape"></path>
|
8
|
+
<path d="M9.92509426,6.63538874 C11.7641644,6.63538874 13.2434164,5.14745308 13.2434164,3.33780161 C13.2434164,1.48793566 11.7641644,0 9.92509426,0 C8.12600395,0 6.64675191,1.48793566 6.64675191,3.33780161 C6.64675191,5.14745308 8.12600395,6.63538874 9.92509426,6.63538874 Z M9.92509426,1.36729223 C11.0045484,1.36729223 11.8841037,2.25201072 11.8841037,3.33780161 C11.8841037,4.42359249 11.0045484,5.30831099 9.88511447,5.30831099 C8.80566029,5.30831099 7.96608481,4.42359249 7.96608481,3.33780161 C7.96608481,2.25201072 8.84564007,1.36729223 9.92509426,1.36729223 Z" id="Shape"></path>
|
9
|
+
<path d="M3.68824785,8.60589812 C5.08754031,8.60589812 6.24695407,7.47989276 6.24695407,6.07238606 C6.24695407,4.66487936 5.1275201,3.53887399 3.72822763,3.53887399 C2.28895538,3.53887399 1.16952141,4.66487936 1.16952141,6.11260054 C1.16952141,7.43967828 2.32893517,8.60589812 3.68824785,8.60589812 Z M3.72822763,4.82573727 C4.36790419,4.82573727 4.88764139,5.38873995 4.88764139,6.03217158 C4.88764139,6.67560322 4.36790419,7.2386059 3.68824785,7.2386059 C3.00859151,7.2386059 2.48885431,6.71581769 2.48885431,6.03217158 C2.52883409,5.34852547 3.04857129,4.82573727 3.72822763,4.82573727 Z" id="Shape"></path>
|
10
|
+
<path d="M16.1219609,8.60589812 C17.5212533,8.60589812 18.6806671,7.47989276 18.6806671,6.07238606 C18.6806671,4.66487936 17.5612331,3.53887399 16.1619407,3.53887399 C14.7626482,3.53887399 13.6432142,4.66487936 13.6032345,6.07238606 C13.6032345,7.43967828 14.7626482,8.60589812 16.1219609,8.60589812 Z M16.1619407,4.82573727 C16.8016172,4.82573727 17.3613342,5.38873995 17.3613342,6.03217158 C17.3613342,6.67560322 16.841597,7.2386059 16.1619407,7.2386059 C15.4822843,7.2386059 14.9625471,6.67560322 14.9625471,6.03217158 C14.9625471,5.38873995 15.4822843,4.82573727 16.1619407,4.82573727 Z" id="Shape"></path>
|
11
|
+
</g>
|
12
|
+
</g>
|
13
|
+
</g>
|
14
|
+
</g>
|
15
|
+
</svg>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<% idx = 1 %>
|
2
|
+
|
3
|
+
<% full_questionnaire.pages.each do |page| %>
|
4
|
+
<div class="question-box">
|
5
|
+
<% page.each do |question| %>
|
6
|
+
<% unless title_and_description_question?(question) %>
|
7
|
+
<div class="question-number">
|
8
|
+
<% if conditioned_question?(question) %>
|
9
|
+
<%= image_pack_tag "media/images/condition_question.png" %>
|
10
|
+
<span><%= t(".conditioned_question", number: idx) %></span>
|
11
|
+
<% else %>
|
12
|
+
<span><%= t(".question", number: idx) %></span>
|
13
|
+
<% end %>
|
14
|
+
<% idx += 1 %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<div class="question-title <%= 'big-title' if title_and_description_question?(question) %>">
|
19
|
+
<span><%= translated_attribute question.body %><span>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<%= render_question_results(full_questionnaire, question) %>
|
23
|
+
<% end %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div class="separator"></div>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<div class="answers-chart">
|
2
|
+
<canvas
|
3
|
+
class="<%= results.question_type %>-chart"
|
4
|
+
data-labels="<%= results.x_labels %>"
|
5
|
+
data-datasets="<%= results.datasets.to_json %>"
|
6
|
+
></canvas>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<table>
|
10
|
+
<thead>
|
11
|
+
<th>Valor</th>
|
12
|
+
<% results.x_labels.each do |label| %>
|
13
|
+
<th><%= label %></th>
|
14
|
+
<% end %>
|
15
|
+
</thead>
|
16
|
+
<tbody>
|
17
|
+
<% results.datasets.each do |dataset| %>
|
18
|
+
<tr>
|
19
|
+
<td><%= dataset[:label] %></td>
|
20
|
+
<% dataset[:data].each do |value| %>
|
21
|
+
<td><%= value %></td>
|
22
|
+
<% end %>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
</tbody>
|
26
|
+
</table>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div class="survey-results-wrapper">
|
2
|
+
<div class="row columns">
|
3
|
+
<div class="alert-survey">
|
4
|
+
<span><%= t(".alert") %></span>
|
5
|
+
</div>
|
6
|
+
<h2 class="section-heading"><%= translated_attribute @full_questionnaire.title %></h2>
|
7
|
+
<div class="section-participants">
|
8
|
+
<%= render partial: "participants_icon" %>
|
9
|
+
|
10
|
+
<span>
|
11
|
+
<b><%= t(".num_participants", count: @full_questionnaire.total_participants) %></b>
|
12
|
+
<%= t(".num_participants_description", count: @full_questionnaire.total_participants) %>
|
13
|
+
</span>
|
14
|
+
</div>
|
15
|
+
<%= render partial: "questions", locals: { full_questionnaire: @full_questionnaire } %>
|
16
|
+
</div>
|
17
|
+
</div>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%= csrf_meta_tags %>
|
2
|
+
|
3
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
4
|
+
<% available_locales.each do |locale| %>
|
5
|
+
<link rel="alternate" href="<%= url_for(request.parameters.merge(locale: locale)) %>" hreflang="<%= locale %>">
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<meta name="twitter:card" content="summary_large_image">
|
9
|
+
<meta name="twitter:site" content="@<%= decidim_meta_twitter_handler %>">
|
10
|
+
<meta name="twitter:title" content="<%= decidim_page_title %>">
|
11
|
+
<meta name="twitter:description" content="<%= decidim_meta_description %>">
|
12
|
+
<meta name="twitter:image" content="<%= decidim_meta_image_url %>">
|
13
|
+
|
14
|
+
<meta property="og:url" content="<%= decidim_meta_url %>">
|
15
|
+
<meta property="og:type" content="article">
|
16
|
+
<meta property="og:title" content="<%= decidim_page_title %>">
|
17
|
+
<meta property="og:description" content="<%= decidim_meta_description %>">
|
18
|
+
<meta property="og:image" content="<%= decidim_meta_image_url %>">
|
19
|
+
|
20
|
+
<% if current_organization.colors["theme"] %>
|
21
|
+
<meta name="theme-color" content="<%= current_organization.colors["theme"] %>">
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<%= favicon %>
|
25
|
+
<%= stylesheet_pack_tag "decidim_core", media: "all" %>
|
26
|
+
<%= invisible_captcha_styles %>
|
27
|
+
<%= organization_colors %>
|
28
|
+
<%= javascript_pack_tag "decidim_core", defer: false %>
|
29
|
+
|
30
|
+
<%= javascript_pack_tag "decidim_survey_results", defer: false %>
|
31
|
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
32
|
+
|
33
|
+
<%= render partial: "layouts/decidim/head_extra" %>
|
34
|
+
<%== current_organization.header_snippets if Decidim.enable_html_header_snippets %>
|
35
|
+
<%= snippets.display(:head) %>
|
36
|
+
<%= content_for :header_snippets %>
|
data/config/assets.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
base_path = File.expand_path("..", __dir__)
|
4
|
+
|
5
|
+
Decidim::Webpacker.register_path("#{base_path}/app/packs")
|
6
|
+
Decidim::Webpacker.register_entrypoints(
|
7
|
+
decidim_survey_results: "#{base_path}/app/packs/entrypoints/decidim_survey_results.js"
|
8
|
+
)
|
9
|
+
Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/survey_results/survey_results")
|
@@ -0,0 +1,144 @@
|
|
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 `File.find` 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, 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 `File.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
|
+
## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json *.map)
|
76
|
+
exclude:
|
77
|
+
- app/packs/
|
78
|
+
- bin/
|
79
|
+
- spec/
|
80
|
+
|
81
|
+
## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
|
82
|
+
## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
|
83
|
+
# only: ["*.rb", "*.html.slim"]
|
84
|
+
|
85
|
+
## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`.
|
86
|
+
# strict: true
|
87
|
+
|
88
|
+
## Multiple scanners can be used. Their results are merged.
|
89
|
+
## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
|
90
|
+
## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example
|
91
|
+
|
92
|
+
## Translation Services
|
93
|
+
# translation:
|
94
|
+
# # Google Translate
|
95
|
+
# # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
|
96
|
+
# google_translate_api_key: "AbC-dEf5"
|
97
|
+
# # DeepL Pro Translate
|
98
|
+
# # Get an API key and subscription at https://www.deepl.com/pro to use DeepL Pro
|
99
|
+
# deepl_api_key: "48E92789-57A3-466A-9959-1A1A1A1A1A1A"
|
100
|
+
# # deepl_host: "https://api.deepl.com"
|
101
|
+
# # deepl_version: "v2"
|
102
|
+
|
103
|
+
## Do not consider these keys missing:
|
104
|
+
# ignore_missing:
|
105
|
+
# - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
|
106
|
+
# - '{devise,simple_form}.*'
|
107
|
+
|
108
|
+
## Consider these keys used:
|
109
|
+
ignore_unused:
|
110
|
+
# - 'activerecord.attributes.*'
|
111
|
+
# - '{devise,kaminari,will_paginate}.*'
|
112
|
+
# - 'simple_form.{yes,no}'
|
113
|
+
# - 'simple_form.{placeholders,hints,labels}.*'
|
114
|
+
# - 'simple_form.{error_notification,required}.:'
|
115
|
+
- decidim.components.surveys.settings.global.enable_results
|
116
|
+
- survey_results.questionnaire_show.see_results
|
117
|
+
|
118
|
+
## Exclude these keys from the `i18n-tasks eq-base' report:
|
119
|
+
# ignore_eq_base:
|
120
|
+
# all:
|
121
|
+
# - common.ok
|
122
|
+
# fr,es:
|
123
|
+
# - common.brand
|
124
|
+
|
125
|
+
## Exclude these keys from the `i18n-tasks check-consistent-interpolations` report:
|
126
|
+
# ignore_inconsistent_interpolations:
|
127
|
+
# - 'activerecord.attributes.*'
|
128
|
+
|
129
|
+
## Ignore these keys completely:
|
130
|
+
# ignore:
|
131
|
+
# - kaminari.*
|
132
|
+
|
133
|
+
## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
|
134
|
+
## e.g. in case of a relative key defined in a helper method.
|
135
|
+
## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
|
136
|
+
#
|
137
|
+
# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
138
|
+
# only: %w(*.html.haml *.html.slim),
|
139
|
+
# patterns: [['= title\b', '.page_title']] %>
|
140
|
+
#
|
141
|
+
# The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
|
142
|
+
#
|
143
|
+
# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
144
|
+
# patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
ca:
|
3
|
+
decidim:
|
4
|
+
components:
|
5
|
+
surveys:
|
6
|
+
settings:
|
7
|
+
global:
|
8
|
+
enable_results: Publica els resultats a l'acabar l'enquesta
|
9
|
+
survey_results:
|
10
|
+
survey_results:
|
11
|
+
answered_table:
|
12
|
+
table:
|
13
|
+
answered: Han respost
|
14
|
+
not_answered: No han respost
|
15
|
+
percentage: Percentatge
|
16
|
+
quantity: Quantitat
|
17
|
+
questions:
|
18
|
+
conditioned_question: Pregunta %{number} (PREGUNTA CONDICIONADA)
|
19
|
+
question: Pregunta %{number}
|
20
|
+
show:
|
21
|
+
alert: Estàs veient els resultats de l'enquesta.
|
22
|
+
num_participants:
|
23
|
+
one: 1 participant
|
24
|
+
other: "%{count} participants"
|
25
|
+
zero: Cap participant
|
26
|
+
num_participants_description:
|
27
|
+
one: ha respost l'enquesta
|
28
|
+
other: han respost l'enquesta
|
29
|
+
zero: ha respost l'enquesta
|
30
|
+
survey_results:
|
31
|
+
question_results:
|
32
|
+
answered: Han respost
|
33
|
+
not_answered: No han respost
|
34
|
+
number_of_votes: Nombre de vots
|
35
|
+
position: Posició %{position}
|
36
|
+
questionnaire_show:
|
37
|
+
see_results: Consulta els resultats
|