decidim-forms 0.30.1 → 0.30.3
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/packs/src/decidim/forms/forms.js +25 -4
- data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +1 -11
- data/app/views/decidim/forms/admin/questionnaires/_questions_form.html.erb +31 -2
- data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +3 -10
- data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +1 -11
- data/app/views/decidim/forms/questionnaires/_answer.html.erb +1 -1
- data/app/views/decidim/forms/questionnaires/answers/_long_answer.html.erb +1 -1
- data/app/views/decidim/forms/questionnaires/answers/_short_answer.html.erb +1 -1
- data/config/locales/ar.yml +0 -2
- data/config/locales/bg.yml +0 -7
- data/config/locales/ca-IT.yml +1 -7
- data/config/locales/ca.yml +1 -7
- data/config/locales/cs.yml +1 -7
- data/config/locales/de.yml +0 -7
- data/config/locales/el.yml +0 -7
- data/config/locales/en.yml +1 -7
- data/config/locales/es-MX.yml +1 -7
- data/config/locales/es-PY.yml +1 -7
- data/config/locales/es.yml +1 -7
- data/config/locales/eu.yml +2 -8
- data/config/locales/fi-plain.yml +1 -7
- data/config/locales/fi.yml +1 -7
- data/config/locales/fr-CA.yml +1 -7
- data/config/locales/fr.yml +1 -7
- data/config/locales/ga-IE.yml +0 -4
- data/config/locales/gl.yml +0 -4
- data/config/locales/hu.yml +0 -4
- data/config/locales/id-ID.yml +0 -2
- data/config/locales/it.yml +0 -5
- data/config/locales/ja.yml +1 -7
- data/config/locales/lb.yml +0 -5
- data/config/locales/lt.yml +0 -7
- data/config/locales/lv.yml +0 -4
- data/config/locales/nl.yml +0 -7
- data/config/locales/no.yml +0 -7
- data/config/locales/pl.yml +0 -7
- data/config/locales/pt-BR.yml +0 -7
- data/config/locales/pt.yml +0 -5
- data/config/locales/ro-RO.yml +0 -7
- data/config/locales/ru.yml +0 -2
- data/config/locales/sk.yml +0 -2
- data/config/locales/sv.yml +3 -9
- data/config/locales/tr-TR.yml +0 -5
- data/config/locales/val-ES.yml +0 -2
- data/config/locales/zh-CN.yml +0 -5
- data/config/locales/zh-TW.yml +0 -7
- data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +3 -2
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +122 -25
- data/lib/decidim/forms/version.rb +1 -1
- metadata +8 -8
data/config/locales/tr-TR.yml
CHANGED
|
@@ -18,7 +18,6 @@ tr:
|
|
|
18
18
|
tos: Kullanım Şartları
|
|
19
19
|
questionnaires:
|
|
20
20
|
actions:
|
|
21
|
-
back: Sorulara geri dön
|
|
22
21
|
show: Yanıtları göster
|
|
23
22
|
answer_option:
|
|
24
23
|
answer_option: Cevap seçeneği
|
|
@@ -71,17 +70,13 @@ tr:
|
|
|
71
70
|
any: herhangi
|
|
72
71
|
collapse: Daralt
|
|
73
72
|
description: Açıklama
|
|
74
|
-
down: Aşağı
|
|
75
73
|
expand: Genişlet
|
|
76
74
|
question: Soru
|
|
77
75
|
remove: Kaldır
|
|
78
76
|
statement: Beyan
|
|
79
|
-
up: yukarı
|
|
80
77
|
separator:
|
|
81
|
-
down: Aşağı
|
|
82
78
|
remove: Kaldır
|
|
83
79
|
separator: Ayraç
|
|
84
|
-
up: Yukarı
|
|
85
80
|
update:
|
|
86
81
|
invalid: Formu kaydederken bir sorun oluştu.
|
|
87
82
|
success: Başarıyla kaydedildi.
|
data/config/locales/val-ES.yml
CHANGED
|
@@ -7,11 +7,9 @@ val:
|
|
|
7
7
|
title_and_description:
|
|
8
8
|
collapse: Redueix
|
|
9
9
|
description: Descripció
|
|
10
|
-
down: Baixar
|
|
11
10
|
expand: Expandeix
|
|
12
11
|
remove: Elimina
|
|
13
12
|
title: Títol
|
|
14
13
|
title_and_description: Títol i descripció
|
|
15
|
-
up: Pujar
|
|
16
14
|
question_types:
|
|
17
15
|
title_and_description: Títol i descripció
|
data/config/locales/zh-CN.yml
CHANGED
|
@@ -18,7 +18,6 @@ zh-CN:
|
|
|
18
18
|
tos: 服务条款
|
|
19
19
|
questionnaires:
|
|
20
20
|
actions:
|
|
21
|
-
back: 返回问题
|
|
22
21
|
show: 显示回复
|
|
23
22
|
answer_option:
|
|
24
23
|
answer_option: 答案选项
|
|
@@ -70,17 +69,13 @@ zh-CN:
|
|
|
70
69
|
any: 任何
|
|
71
70
|
collapse: 收起
|
|
72
71
|
description: 描述
|
|
73
|
-
down: 向下
|
|
74
72
|
expand: 扩展
|
|
75
73
|
question: 问
|
|
76
74
|
remove: 删除
|
|
77
75
|
statement: 声明
|
|
78
|
-
up: 上移
|
|
79
76
|
separator:
|
|
80
|
-
down: 向下
|
|
81
77
|
remove: 删除
|
|
82
78
|
separator: 分隔符
|
|
83
|
-
up: 上移
|
|
84
79
|
update:
|
|
85
80
|
invalid: 保存表单时出错。
|
|
86
81
|
success: 表单保存成功。
|
data/config/locales/zh-TW.yml
CHANGED
|
@@ -19,7 +19,6 @@ zh-TW:
|
|
|
19
19
|
tos: 服務條款
|
|
20
20
|
questionnaires:
|
|
21
21
|
actions:
|
|
22
|
-
back: 返回問題
|
|
23
22
|
show: 顯示回應
|
|
24
23
|
answer_option:
|
|
25
24
|
answer_option: 答案選項:
|
|
@@ -72,26 +71,20 @@ zh-TW:
|
|
|
72
71
|
any: 任何
|
|
73
72
|
collapse: 收回
|
|
74
73
|
description: 說明
|
|
75
|
-
down: 向下
|
|
76
74
|
expand: 展開
|
|
77
75
|
question: 問題
|
|
78
76
|
remove: 移除
|
|
79
77
|
statement: 聲明
|
|
80
|
-
up: 往上
|
|
81
78
|
separator:
|
|
82
|
-
down: 向下
|
|
83
79
|
remove: 移除
|
|
84
80
|
separator: 分隔線
|
|
85
|
-
up: 往上
|
|
86
81
|
title_and_description:
|
|
87
82
|
collapse: 收回
|
|
88
83
|
description: 說明
|
|
89
|
-
down: 向下
|
|
90
84
|
expand: 展開
|
|
91
85
|
remove: 移除
|
|
92
86
|
title: 標題
|
|
93
87
|
title_and_description: 標題和描述
|
|
94
|
-
up: 往上
|
|
95
88
|
update:
|
|
96
89
|
invalid: 儲存表單時發生問題。
|
|
97
90
|
success: 表單已成功儲存。
|
|
@@ -283,8 +283,9 @@ shared_examples_for "has questionnaire" do
|
|
|
283
283
|
accept_confirm { click_on "Submit" }
|
|
284
284
|
end
|
|
285
285
|
|
|
286
|
-
it "
|
|
287
|
-
expect(page).to
|
|
286
|
+
it "submits the form and shows errors" do
|
|
287
|
+
expect(page).to have_css ".alert.flash"
|
|
288
|
+
expect(page).to have_admin_callout(callout_failure)
|
|
288
289
|
different_error = I18n.t("decidim.forms.questionnaires.answer.max_choices_alert")
|
|
289
290
|
expect(different_error).to eq("There are too many choices selected")
|
|
290
291
|
expect(page).to have_no_content(different_error)
|
|
@@ -317,6 +317,10 @@ shared_examples_for "update questions" do
|
|
|
317
317
|
create(:questionnaire_question, questionnaire:, body: second_body, position: 1)
|
|
318
318
|
end
|
|
319
319
|
|
|
320
|
+
let!(:question3) do
|
|
321
|
+
create(:questionnaire_question, questionnaire:, body: third_body, position: 2)
|
|
322
|
+
end
|
|
323
|
+
|
|
320
324
|
let(:first_body) do
|
|
321
325
|
{ en: "First", ca: "Primera", es: "Primera" }
|
|
322
326
|
end
|
|
@@ -325,6 +329,10 @@ shared_examples_for "update questions" do
|
|
|
325
329
|
{ en: "Second", ca: "Segona", es: "Segunda" }
|
|
326
330
|
end
|
|
327
331
|
|
|
332
|
+
let(:third_body) do
|
|
333
|
+
{ en: "Third", ca: "Tercera", es: "Tercera" }
|
|
334
|
+
end
|
|
335
|
+
|
|
328
336
|
before do
|
|
329
337
|
click_on "Save"
|
|
330
338
|
visit_manage_questions_and_expand_all
|
|
@@ -344,26 +352,6 @@ shared_examples_for "update questions" do
|
|
|
344
352
|
end
|
|
345
353
|
end
|
|
346
354
|
|
|
347
|
-
context "when moving a question up" do
|
|
348
|
-
before do
|
|
349
|
-
within ".questionnaire-question:last-of-type" do
|
|
350
|
-
click_on "Up"
|
|
351
|
-
end
|
|
352
|
-
end
|
|
353
|
-
|
|
354
|
-
it_behaves_like "switching questions order"
|
|
355
|
-
end
|
|
356
|
-
|
|
357
|
-
context "when moving a question down" do
|
|
358
|
-
before do
|
|
359
|
-
within ".questionnaire-question:first-of-type" do
|
|
360
|
-
click_on "Down"
|
|
361
|
-
end
|
|
362
|
-
end
|
|
363
|
-
|
|
364
|
-
it_behaves_like "switching questions order"
|
|
365
|
-
end
|
|
366
|
-
|
|
367
355
|
describe "collapsible questions" do
|
|
368
356
|
context "when clicking on Expand all button" do
|
|
369
357
|
it "expands all questions" do
|
|
@@ -459,16 +447,37 @@ shared_examples_for "update questions" do
|
|
|
459
447
|
click_on "Add question"
|
|
460
448
|
expand_all_questions
|
|
461
449
|
|
|
462
|
-
|
|
463
|
-
expect(
|
|
464
|
-
|
|
450
|
+
question_cards = page.all(".questionnaire-question")
|
|
451
|
+
expect(question_cards.size).to eq(4)
|
|
452
|
+
|
|
453
|
+
within question_cards[1] do
|
|
454
|
+
expect(find("input[name*='[body_en]']").value).to eq("Second")
|
|
455
|
+
end
|
|
456
|
+
within question_cards[2] do
|
|
457
|
+
expect(find("input[name*='[body_en]']").value).to eq("Third")
|
|
458
|
+
end
|
|
465
459
|
|
|
466
460
|
within ".questionnaire-question:first-of-type" do
|
|
467
461
|
click_on "Remove"
|
|
468
462
|
end
|
|
469
463
|
|
|
470
|
-
|
|
471
|
-
expect(
|
|
464
|
+
remaining_cards = page.all(".questionnaire-question")
|
|
465
|
+
expect(remaining_cards.size).to eq(3)
|
|
466
|
+
|
|
467
|
+
# Check that the first question is now what was previously the second
|
|
468
|
+
within remaining_cards.first do
|
|
469
|
+
expect(find("input[name*='[body_en]']").value).to eq("Second")
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
# Check that the second question is now what was previously the third
|
|
473
|
+
within remaining_cards[1] do
|
|
474
|
+
expect(find("input[name*='[body_en]']").value).to eq("Third")
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
# The last question should be the new empty question
|
|
478
|
+
within remaining_cards.last do
|
|
479
|
+
expect(find("input[name*='[body_en]']").value).to eq("")
|
|
480
|
+
end
|
|
472
481
|
end
|
|
473
482
|
|
|
474
483
|
it "does not duplicate editors when adding new questions" do
|
|
@@ -512,6 +521,94 @@ shared_examples_for "update questions" do
|
|
|
512
521
|
end
|
|
513
522
|
end
|
|
514
523
|
|
|
524
|
+
context "when reordering questions with drag and drop", :js do
|
|
525
|
+
before do
|
|
526
|
+
expand_all_questions
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
it "allows moving questions using drag and drop" do
|
|
530
|
+
question_cards = all(".questionnaire-question")
|
|
531
|
+
|
|
532
|
+
# Verify initial order by checking the body field values
|
|
533
|
+
within question_cards[0] do
|
|
534
|
+
expect(find("input[name*='[body_en]']").value).to eq("First")
|
|
535
|
+
end
|
|
536
|
+
within question_cards[1] do
|
|
537
|
+
expect(find("input[name*='[body_en]']").value).to eq("Second")
|
|
538
|
+
end
|
|
539
|
+
within question_cards[2] do
|
|
540
|
+
expect(find("input[name*='[body_en]']").value).to eq("Third")
|
|
541
|
+
end
|
|
542
|
+
|
|
543
|
+
# JavaScript to simulate drag and drop.
|
|
544
|
+
page.execute_script(<<~JS)
|
|
545
|
+
var questions = document.querySelectorAll('.questionnaire-question');
|
|
546
|
+
var container = questions[0].parentNode;
|
|
547
|
+
var second = questions[1];
|
|
548
|
+
var first = questions[0];
|
|
549
|
+
|
|
550
|
+
// Move second question before first
|
|
551
|
+
container.insertBefore(second, first);
|
|
552
|
+
|
|
553
|
+
// Update position values
|
|
554
|
+
var updatedQuestions = container.querySelectorAll('.questionnaire-question');
|
|
555
|
+
updatedQuestions.forEach(function(question, index) {
|
|
556
|
+
var positionInput = question.querySelector('input[name$="[position]"]');
|
|
557
|
+
if (positionInput) positionInput.value = index;
|
|
558
|
+
});
|
|
559
|
+
JS
|
|
560
|
+
|
|
561
|
+
sleep 0.5
|
|
562
|
+
|
|
563
|
+
question_cards = all(".questionnaire-question")
|
|
564
|
+
within question_cards[0] do
|
|
565
|
+
expect(find("input[name*='[body_en]']").value).to eq("Second")
|
|
566
|
+
end
|
|
567
|
+
within question_cards[1] do
|
|
568
|
+
expect(find("input[name*='[body_en]']").value).to eq("First")
|
|
569
|
+
end
|
|
570
|
+
within question_cards[2] do
|
|
571
|
+
expect(find("input[name*='[body_en]']").value).to eq("Third")
|
|
572
|
+
end
|
|
573
|
+
end
|
|
574
|
+
|
|
575
|
+
it "persists drag and drop changes when saving" do
|
|
576
|
+
# Move second question to last position
|
|
577
|
+
page.execute_script(<<~JS)
|
|
578
|
+
var questions = document.querySelectorAll('.questionnaire-question');
|
|
579
|
+
var container = questions[0].parentNode;
|
|
580
|
+
var second = questions[1];
|
|
581
|
+
|
|
582
|
+
container.appendChild(second);
|
|
583
|
+
|
|
584
|
+
// Update the positions of questions
|
|
585
|
+
var updatedQuestions = container.querySelectorAll('.questionnaire-question');
|
|
586
|
+
updatedQuestions.forEach(function(question, index) {
|
|
587
|
+
var positionInput = question.querySelector('input[name$="[position]"]');
|
|
588
|
+
if (positionInput) positionInput.value = index;
|
|
589
|
+
});
|
|
590
|
+
JS
|
|
591
|
+
|
|
592
|
+
sleep 0.5
|
|
593
|
+
|
|
594
|
+
click_on "Save"
|
|
595
|
+
expect(page).to have_admin_callout("successfully")
|
|
596
|
+
|
|
597
|
+
visit_manage_questions_and_expand_all
|
|
598
|
+
|
|
599
|
+
question_cards = all(".questionnaire-question")
|
|
600
|
+
within question_cards[0] do
|
|
601
|
+
expect(find("input[name*='[body_en]']").value).to eq("First")
|
|
602
|
+
end
|
|
603
|
+
within question_cards[1] do
|
|
604
|
+
expect(find("input[name*='[body_en]']").value).to eq("Third")
|
|
605
|
+
end
|
|
606
|
+
within question_cards[2] do
|
|
607
|
+
expect(find("input[name*='[body_en]']").value).to eq("Second")
|
|
608
|
+
end
|
|
609
|
+
end
|
|
610
|
+
end
|
|
611
|
+
|
|
515
612
|
private
|
|
516
613
|
|
|
517
614
|
def look_like_first_question
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: decidim-forms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.30.
|
|
4
|
+
version: 0.30.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josep Jaume Rey Peroy
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2025-
|
|
14
|
+
date: 2025-10-28 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: decidim-core
|
|
@@ -19,42 +19,42 @@ dependencies:
|
|
|
19
19
|
requirements:
|
|
20
20
|
- - '='
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.30.
|
|
22
|
+
version: 0.30.3
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
27
|
- - '='
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.30.
|
|
29
|
+
version: 0.30.3
|
|
30
30
|
- !ruby/object:Gem::Dependency
|
|
31
31
|
name: decidim-admin
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
|
33
33
|
requirements:
|
|
34
34
|
- - '='
|
|
35
35
|
- !ruby/object:Gem::Version
|
|
36
|
-
version: 0.30.
|
|
36
|
+
version: 0.30.3
|
|
37
37
|
type: :development
|
|
38
38
|
prerelease: false
|
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
40
40
|
requirements:
|
|
41
41
|
- - '='
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: 0.30.
|
|
43
|
+
version: 0.30.3
|
|
44
44
|
- !ruby/object:Gem::Dependency
|
|
45
45
|
name: decidim-dev
|
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
|
47
47
|
requirements:
|
|
48
48
|
- - '='
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: 0.30.
|
|
50
|
+
version: 0.30.3
|
|
51
51
|
type: :development
|
|
52
52
|
prerelease: false
|
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements:
|
|
55
55
|
- - '='
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
|
-
version: 0.30.
|
|
57
|
+
version: 0.30.3
|
|
58
58
|
description: A forms gem for decidim.
|
|
59
59
|
email:
|
|
60
60
|
- josepjaume@gmail.com
|