decidim-surveys 0.10.1 → 0.11.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/config/decidim_surveys_manifest.js +1 -0
  4. data/app/assets/javascripts/decidim/surveys/admin/auto_buttons_by_min_items.component.js.es6 +25 -0
  5. data/app/assets/javascripts/decidim/surveys/admin/auto_select_options_by_total_items.component.js.es6 +23 -0
  6. data/app/assets/javascripts/decidim/surveys/admin/surveys.js.es6 +146 -43
  7. data/app/assets/javascripts/decidim/surveys/autosortable_checkboxes.component.js.es6 +65 -0
  8. data/app/assets/javascripts/decidim/surveys/option_attached_inputs.component.js.es6 +32 -0
  9. data/app/assets/javascripts/decidim/surveys/surveys.js.es6 +20 -0
  10. data/app/assets/stylesheets/decidim/surveys/surveys.scss +20 -3
  11. data/app/commands/decidim/surveys/admin/update_survey.rb +36 -15
  12. data/app/commands/decidim/surveys/answer_survey.rb +12 -1
  13. data/app/commands/decidim/surveys/create_survey.rb +5 -5
  14. data/app/controllers/decidim/surveys/admin/application_controller.rb +2 -2
  15. data/app/controllers/decidim/surveys/admin/surveys_controller.rb +3 -3
  16. data/app/controllers/decidim/surveys/application_controller.rb +2 -2
  17. data/app/controllers/decidim/surveys/surveys_controller.rb +1 -1
  18. data/app/forms/decidim/surveys/admin/survey_answer_option_form.rb +23 -0
  19. data/app/forms/decidim/surveys/admin/survey_form.rb +7 -1
  20. data/app/forms/decidim/surveys/admin/survey_question_form.rb +12 -2
  21. data/app/forms/decidim/surveys/survey_answer_choice_form.rb +15 -0
  22. data/app/forms/decidim/surveys/survey_answer_form.rb +40 -6
  23. data/app/forms/decidim/surveys/survey_form.rb +1 -1
  24. data/app/helpers/decidim/surveys/admin/application_helper.rb +3 -19
  25. data/app/jobs/decidim/surveys/settings_change_job.rb +4 -4
  26. data/app/models/decidim/surveys/abilities/current_user_ability.rb +8 -8
  27. data/app/models/decidim/surveys/abilities/participatory_process_admin_ability.rb +1 -1
  28. data/app/models/decidim/surveys/survey.rb +2 -2
  29. data/app/models/decidim/surveys/survey_answer.rb +9 -1
  30. data/app/models/decidim/surveys/survey_answer_choice.rb +15 -0
  31. data/app/models/decidim/surveys/survey_answer_option.rb +9 -0
  32. data/app/models/decidim/surveys/survey_question.rb +21 -5
  33. data/app/views/decidim/surveys/admin/surveys/_answer_option.html.erb +28 -11
  34. data/app/views/decidim/surveys/admin/surveys/_form.html.erb +18 -14
  35. data/app/views/decidim/surveys/admin/surveys/_question.html.erb +74 -31
  36. data/app/views/decidim/surveys/admin/surveys/edit.html.erb +1 -1
  37. data/app/views/decidim/surveys/surveys/_answer.html.erb +94 -0
  38. data/app/views/decidim/surveys/surveys/show.html.erb +15 -42
  39. data/config/locales/ca.yml +33 -13
  40. data/config/locales/en.yml +33 -13
  41. data/config/locales/es.yml +33 -13
  42. data/config/locales/eu.yml +33 -13
  43. data/config/locales/fi.yml +33 -13
  44. data/config/locales/fr.yml +33 -13
  45. data/config/locales/gl.yml +33 -13
  46. data/config/locales/it.yml +33 -13
  47. data/config/locales/nl.yml +36 -16
  48. data/config/locales/pl.yml +33 -13
  49. data/config/locales/pt-BR.yml +33 -13
  50. data/config/locales/pt.yml +33 -13
  51. data/config/locales/ru.yml +0 -6
  52. data/config/locales/sv.yml +33 -13
  53. data/config/locales/uk.yml +0 -6
  54. data/db/migrate/20180305133837_rename_features_to_components_at_surveys.rb +11 -0
  55. data/db/migrate/20180314225829_add_max_choices_to_survey_questions.rb +7 -0
  56. data/db/migrate/20180321141024_add_description_to_decidim_survey_questions.rb +7 -0
  57. data/db/migrate/20180405014929_add_choices_to_decidim_survey_answers.rb +48 -0
  58. data/db/migrate/20180405015012_create_decidim_survey_answer_options.rb +43 -0
  59. data/db/migrate/20180405015147_create_decidim_survey_answer_choices.rb +61 -0
  60. data/db/migrate/20180405015258_add_free_text_to_survey_answer_options.rb +7 -0
  61. data/db/migrate/20180405015314_add_custom_body_to_survey_answer_choices.rb +7 -0
  62. data/db/migrate/20180406201818_add_position_to_decidim_survey_answer_choices.rb +7 -0
  63. data/lib/decidim/surveys.rb +1 -1
  64. data/lib/decidim/surveys/admin_engine.rb +0 -2
  65. data/lib/decidim/surveys/{feature.rb → component.rb} +38 -26
  66. data/lib/decidim/surveys/engine.rb +5 -1
  67. data/lib/decidim/surveys/test/factories.rb +22 -6
  68. data/lib/decidim/surveys/version.rb +1 -1
  69. metadata +33 -30
  70. data/app/assets/javascripts/decidim/surveys/admin/auto_label_by_position.component.js.es6 +0 -33
  71. data/app/assets/javascripts/decidim/surveys/admin/dynamic_fields.component.js.es6 +0 -95
  72. data/app/forms/decidim/surveys/admin/survey_question_answer_option_form.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0314b7b90ffc530ec12d80cbe5e58ceaae47b7f3929a0f3e04486c3b787f065f
4
- data.tar.gz: 3894dac28ab7bd9f36a83ad0945974fef154298ef75d07045187703343cfeb33
3
+ metadata.gz: ed1d1fb5c5133239e40959fe85f535d60e92f99198f15a8b0afdf886a0f2e6b5
4
+ data.tar.gz: e18494afa4f831cce1a1ff12e99f1d6bc69deb5bb3731f8819fa5e007d1877a3
5
5
  SHA512:
6
- metadata.gz: 191a19a9898c5d0b4c3c2ff3ba7c09a6a9fd19f3ca99b563050af5097e56d3fcefcfbb2f5b3052f621a8d59e4ad0d433efeeb9f7b07a8236295e944e5a1a1b5e
7
- data.tar.gz: 5d16bdbf19cddde73546e89cb93a7979be25329a35d1c8395509c977878c4c0104106729f8f1671a2d31709a6804202e63d644152a0b36344e231199dcaa92e7
6
+ metadata.gz: 93f0f880ae735a0ef20f6ec663f31c31864683ecd84e4402ea5ebfe42b443a7f6a9aabca5cb5709607254d1d39eae8ab7d63fd0922f0a3c2d2c861cd3b6af86e
7
+ data.tar.gz: 640b3973b1d4d0c05a85e7da67d9d297c257dc71a7d2c02324ca852adb35d192e5687cd6b8296d47471fed8db81cc8edc2bf883f5ca38c9917ace67a0e23697c
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Decidim::Surveys
2
2
 
3
- The Surveys module adds one of the main features of Decidim: allows admins to contribute to a participatory process by creating surveys. Users can participate in the surveys answering their questions from the public page.
3
+ The Surveys module adds one of the main components of Decidim: allows admins to contribute to a participatory process by creating surveys. Users can participate in the surveys answering their questions from the public page.
4
4
 
5
5
  ## Usage
6
6
 
7
- Surveys will be available as a Feature for a Participatory Process.
7
+ Surveys will be available as a Component for a Participatory Process.
8
8
 
9
9
  ## Installation
10
10
 
@@ -0,0 +1 @@
1
+ // = link decidim/surveys/surveys.js
@@ -0,0 +1,25 @@
1
+ ((exports) => {
2
+ class AutoButtonsByMinItemsComponent {
3
+ constructor(options = {}) {
4
+ this.listSelector = options.listSelector;
5
+ this.minItems = options.minItems;
6
+ this.hideOnMinItemsOrLessSelector = options.hideOnMinItemsOrLessSelector;
7
+
8
+ this.run();
9
+ }
10
+
11
+ run() {
12
+ const $list = $(this.listSelector);
13
+ const $items = $list.find(this.hideOnMinItemsOrLessSelector);
14
+
15
+ if ($list.length <= this.minItems) {
16
+ $items.hide();
17
+ } else {
18
+ $items.show();
19
+ }
20
+ }
21
+ }
22
+
23
+ exports.DecidimAdmin = exports.DecidimAdmin || {};
24
+ exports.DecidimAdmin.AutoButtonsByMinItemsComponent = AutoButtonsByMinItemsComponent;
25
+ })(window);
@@ -0,0 +1,23 @@
1
+ ((exports) => {
2
+ class AutoSelectOptionsByTotalItemsComponent {
3
+ constructor(options = {}) {
4
+ this.wrapperSelector = options.wrapperSelector;
5
+ this.selectSelector = options.selectSelector;
6
+ this.listSelector = options.listSelector;
7
+ }
8
+
9
+ run() {
10
+ const $list = $(this.listSelector);
11
+ const $selectField = $list.parents(this.wrapperSelector).find(this.selectSelector);
12
+
13
+ $selectField.find("option").slice(1).remove();
14
+
15
+ for (let idx = 2; idx <= $list.length; idx += 1) {
16
+ $(`<option value="${idx}">${idx}</option>`).appendTo($selectField);
17
+ }
18
+ }
19
+ }
20
+
21
+ exports.DecidimAdmin = exports.DecidimAdmin || {};
22
+ exports.DecidimAdmin.AutoSelectOptionsByTotalItemsComponent = AutoSelectOptionsByTotalItemsComponent;
23
+ })(window);
@@ -1,26 +1,52 @@
1
- // = require jquery-tmpl
2
- // = require ./auto_label_by_position.component
3
- // = require ./dynamic_fields.component
1
+ // = require ./auto_buttons_by_min_items.component
2
+ // = require ./auto_select_options_by_total_items.component
4
3
 
5
4
  ((exports) => {
6
- const { AutoLabelByPositionComponent, createDynamicFields, createSortList } = exports.DecidimAdmin;
5
+ const { AutoLabelByPositionComponent, AutoButtonsByPositionComponent, AutoButtonsByMinItemsComponent, AutoSelectOptionsByTotalItemsComponent, createFieldDependentInputs, createDynamicFields, createSortList } = exports.DecidimAdmin;
6
+ const { createQuillEditor } = exports.Decidim;
7
7
 
8
- const wrapperSelector = '.survey-questions';
9
- const fieldSelector = '.survey-question';
10
- const questionTypeSelector = '[name="survey[questions][][question_type]"]';
11
- const answerOptionsWrapperSelector = '.survey-question-answer-options';
8
+ const wrapperSelector = ".survey-questions";
9
+ const fieldSelector = ".survey-question";
10
+ const questionTypeSelector = "select[name$=\\[question_type\\]]";
11
+ const answerOptionFieldSelector = ".survey-question-answer-option";
12
+ const answerOptionsWrapperSelector = ".survey-question-answer-options";
13
+ const answerOptionRemoveFieldButtonSelector = ".remove-answer-option";
14
+ const maxChoicesWrapperSelector = ".survey-question-max-choices";
12
15
 
13
16
  const autoLabelByPosition = new AutoLabelByPositionComponent({
14
- listSelector: '.survey-question:not(.hidden)',
15
- labelSelector: '.card-title span:first',
17
+ listSelector: ".survey-question:not(.hidden)",
18
+ labelSelector: ".card-title span:first",
16
19
  onPositionComputed: (el, idx) => {
17
- $(el).find('input[name="survey[questions][][position]"]').val(idx);
20
+ $(el).find("input[name$=\\[position\\]]").val(idx);
18
21
  }
19
22
  });
20
23
 
24
+ const autoButtonsByPosition = new AutoButtonsByPositionComponent({
25
+ listSelector: ".survey-question:not(.hidden)",
26
+ hideOnFirstSelector: ".move-up-question",
27
+ hideOnLastSelector: ".move-down-question"
28
+ });
29
+
30
+ const createAutoMaxChoicesByNumberOfAnswerOptions = (fieldId) => {
31
+ return new AutoSelectOptionsByTotalItemsComponent({
32
+ wrapperSelector: fieldSelector,
33
+ selectSelector: `${maxChoicesWrapperSelector} select`,
34
+ listSelector: `#${fieldId} ${answerOptionsWrapperSelector} .survey-question-answer-option:not(.hidden)`
35
+ })
36
+ };
37
+
38
+ const createAutoButtonsByMinItemsForAnswerOptions = (fieldId) => {
39
+ return new AutoButtonsByMinItemsComponent({
40
+ wrapperSelector: fieldSelector,
41
+ listSelector: `#${fieldId} ${answerOptionsWrapperSelector} .survey-question-answer-option:not(.hidden)`,
42
+ minItems: 2,
43
+ hideOnMinItemsOrLessSelector: answerOptionRemoveFieldButtonSelector
44
+ })
45
+ };
46
+
21
47
  const createSortableList = () => {
22
- createSortList('.survey-questions-list:not(.published)', {
23
- handle: '.question-divider',
48
+ createSortList(".survey-questions-list:not(.published)", {
49
+ handle: ".question-divider",
24
50
  placeholder: '<div style="border-style: dashed; border-color: #000"></div>',
25
51
  forcePlaceholderSize: true,
26
52
  onSortUpdate: () => { autoLabelByPosition.run() }
@@ -28,58 +54,135 @@
28
54
  };
29
55
 
30
56
  const createDynamicFieldsForAnswerOptions = (fieldId) => {
31
- createDynamicFields({
32
- templateId: `survey-question-answer-option-tmpl`,
33
- tabsPrefix: `survey-question-answer-option`,
57
+ const autoButtons = createAutoButtonsByMinItemsForAnswerOptions(fieldId);
58
+ const autoSelectOptions = createAutoMaxChoicesByNumberOfAnswerOptions(fieldId);
59
+
60
+ return createDynamicFields({
61
+ placeholderId: "survey-question-answer-option-id",
34
62
  wrapperSelector: `#${fieldId} ${answerOptionsWrapperSelector}`,
35
- containerSelector: `.survey-question-answer-options-list`,
36
- fieldSelector: `.survey-question-answer-option`,
37
- addFieldButtonSelector: `.add-answer-option`,
38
- removeFieldButtonSelector: `.remove-answer-option`
63
+ containerSelector: ".survey-question-answer-options-list",
64
+ fieldSelector: answerOptionFieldSelector,
65
+ addFieldButtonSelector: ".add-answer-option",
66
+ removeFieldButtonSelector: answerOptionRemoveFieldButtonSelector,
67
+ onAddField: () => {
68
+ autoButtons.run();
69
+ autoSelectOptions.run();
70
+ },
71
+ onRemoveField: () => {
72
+ autoButtons.run();
73
+ autoSelectOptions.run();
74
+ }
39
75
  });
40
76
  };
41
77
 
42
- const setAnswerOptionsWrapperVisibility = ($target) => {
43
- const $answerOptionsWrapper = $target.parents(fieldSelector).find(answerOptionsWrapperSelector);
44
- const value = $target.val();
78
+ const dynamicFieldsForAnswerOptions = {};
79
+
80
+ const isMultipleChoiceOption = ($selectField) => {
81
+ const value = $selectField.val();
82
+
83
+ return value === "single_option" || value === "multiple_option" || value === "sorting"
84
+ }
85
+
86
+ const setupInitialQuestionAttributes = ($target) => {
87
+ const fieldId = $target.attr("id");
88
+ const $fieldQuestionTypeSelect = $target.find(questionTypeSelector);
89
+
90
+ createFieldDependentInputs({
91
+ controllerField: $fieldQuestionTypeSelect,
92
+ wrapperSelector: fieldSelector,
93
+ dependentFieldsSelector: answerOptionsWrapperSelector,
94
+ dependentInputSelector: `${answerOptionFieldSelector} input`,
95
+ enablingCondition: ($field) => {
96
+ return isMultipleChoiceOption($field);
97
+ }
98
+ });
99
+
100
+ createFieldDependentInputs({
101
+ controllerField: $fieldQuestionTypeSelect,
102
+ wrapperSelector: fieldSelector,
103
+ dependentFieldsSelector: maxChoicesWrapperSelector,
104
+ dependentInputSelector: "select",
105
+ enablingCondition: ($field) => {
106
+ return $field.val() === "multiple_option"
107
+ }
108
+ });
109
+
110
+ dynamicFieldsForAnswerOptions[fieldId] = createDynamicFieldsForAnswerOptions(fieldId);
111
+
112
+ const dynamicFields = dynamicFieldsForAnswerOptions[fieldId];
45
113
 
46
- $answerOptionsWrapper.hide();
114
+ const onQuestionTypeChange = () => {
115
+ if (isMultipleChoiceOption($fieldQuestionTypeSelect)) {
116
+ const nOptions = $fieldQuestionTypeSelect.parents(fieldSelector).find(answerOptionFieldSelector).length;
47
117
 
48
- if (value === 'single_option' || value === 'multiple_option') {
49
- $answerOptionsWrapper.show();
118
+ if (nOptions === 0) {
119
+ dynamicFields._addField();
120
+ dynamicFields._addField();
121
+ }
122
+ }
123
+ };
124
+
125
+ $fieldQuestionTypeSelect.on("change", onQuestionTypeChange);
126
+
127
+ onQuestionTypeChange();
128
+ }
129
+
130
+ const hideDeletedQuestion = ($target) => {
131
+ const inputDeleted = $target.find("input[name$=\\[deleted\\]]").val();
132
+
133
+ if (inputDeleted === "true") {
134
+ $target.addClass("hidden");
135
+ $target.hide();
50
136
  }
51
- };
137
+ }
52
138
 
53
139
  createDynamicFields({
54
- templateId: 'survey-question-tmpl',
55
- tabsPrefix: 'survey-question',
140
+ placeholderId: "survey-question-id",
56
141
  wrapperSelector: wrapperSelector,
57
- containerSelector: '.survey-questions-list',
142
+ containerSelector: ".survey-questions-list",
58
143
  fieldSelector: fieldSelector,
59
- addFieldButtonSelector: '.add-question',
60
- removeFieldButtonSelector: '.remove-question',
144
+ addFieldButtonSelector: ".add-question",
145
+ removeFieldButtonSelector: ".remove-question",
146
+ moveUpFieldButtonSelector: ".move-up-question",
147
+ moveDownFieldButtonSelector: ".move-down-question",
61
148
  onAddField: ($field) => {
62
- const fieldId = $field.attr('id');
63
-
149
+ setupInitialQuestionAttributes($field);
64
150
  createSortableList();
151
+
152
+ $field.find(".editor-container").each((idx, el) => {
153
+ createQuillEditor(el);
154
+ });
155
+
65
156
  autoLabelByPosition.run();
66
- createDynamicFieldsForAnswerOptions(fieldId);
67
- setAnswerOptionsWrapperVisibility($field.find(questionTypeSelector));
157
+ autoButtonsByPosition.run();
68
158
  },
69
- onRemoveField: () => {
159
+ onRemoveField: ($field) => {
70
160
  autoLabelByPosition.run();
161
+ autoButtonsByPosition.run();
162
+
163
+ $field.find(answerOptionRemoveFieldButtonSelector).each((idx, el) => {
164
+ dynamicFieldsForAnswerOptions[$field.attr("id")]._removeField(el);
165
+ });
166
+ },
167
+ onMoveUpField: () => {
168
+ autoLabelByPosition.run();
169
+ autoButtonsByPosition.run();
170
+ },
171
+ onMoveDownField: () => {
172
+ autoLabelByPosition.run();
173
+ autoButtonsByPosition.run();
71
174
  }
72
175
  });
73
176
 
74
177
  createSortableList();
75
178
 
76
179
  $(fieldSelector).each((idx, el) => {
77
- createDynamicFieldsForAnswerOptions($(el).attr('id'));
78
- setAnswerOptionsWrapperVisibility($(el).find(questionTypeSelector));
79
- });
180
+ const $target = $(el);
80
181
 
81
- $(wrapperSelector).on('change', questionTypeSelector, (ev) => {
82
- const $target = $(ev.target);
83
- setAnswerOptionsWrapperVisibility($target);
182
+ hideDeletedQuestion($target);
183
+ setupInitialQuestionAttributes($target);
84
184
  });
185
+
186
+ autoLabelByPosition.run();
187
+ autoButtonsByPosition.run();
85
188
  })(window);
@@ -0,0 +1,65 @@
1
+ ((exports) => {
2
+ class AutosortableCheckboxesComponent {
3
+ constructor(options = {}) {
4
+ this.wrapperField = options.wrapperField;
5
+ this._bindEvent();
6
+ this._run();
7
+ }
8
+
9
+ _run() {
10
+ $(this.wrapperField).find("input[type=checkbox]").each((idx, el) => {
11
+ const $parentLabel = $(el).parents("label");
12
+
13
+ if ($(el).is(":checked")) {
14
+ const $lastSorted = this.wrapperField.find("label.sorted").last();
15
+
16
+ if ($lastSorted.length > 0) {
17
+ $lastSorted.removeClass("last-sorted");
18
+ $parentLabel.insertAfter($lastSorted);
19
+ } else {
20
+ $parentLabel.insertBefore(this.wrapperField.find("label:first-child"));
21
+ }
22
+
23
+ $parentLabel.addClass("sorted");
24
+ $parentLabel.addClass("last-sorted");
25
+ } else {
26
+ const $lastUnsorted = this.wrapperField.find("label:not(.sorted)").last();
27
+
28
+ if ($lastUnsorted.length > 0) {
29
+ $parentLabel.insertBefore($lastUnsorted);
30
+ } else {
31
+ $parentLabel.insertAfter(this.wrapperField.find("label:last-child"));
32
+ }
33
+
34
+ $parentLabel.removeClass("sorted");
35
+ }
36
+ });
37
+
38
+ $(this.wrapperField).find("label").each((idx, el) => {
39
+ const $positionSelector = $(el).find(".position");
40
+ const $positionField = $(el).find("input[name$=\\[position\\]]");
41
+
42
+ if ($(el).hasClass("sorted")) {
43
+ $positionField.val(idx);
44
+ $positionField.prop("disabled", false);
45
+ $positionSelector.html(`${idx + 1}. `);
46
+ } else {
47
+ $positionField.val("");
48
+ $positionField.prop("disabled", true);
49
+ $positionSelector.html("");
50
+ }
51
+ });
52
+ }
53
+
54
+ _bindEvent() {
55
+ $(this.wrapperField).find("input[type=checkbox]").on("change", () => {
56
+ this._run();
57
+ });
58
+ }
59
+ }
60
+
61
+ exports.Decidim = exports.Decidim || {};
62
+ exports.Decidim.createAutosortableCheckboxes = (options) => {
63
+ return new AutosortableCheckboxesComponent(options);
64
+ };
65
+ })(window);
@@ -0,0 +1,32 @@
1
+ ((exports) => {
2
+ class OptionAttachedInputsComponent {
3
+ constructor(options = {}) {
4
+ this.wrapperField = options.wrapperField;
5
+ this.controllerFieldSelector = options.controllerFieldSelector;
6
+ this.dependentInputSelector = options.dependentInputSelector;
7
+ this.controllerSelector = this.wrapperField.find(this.controllerFieldSelector);
8
+ this._bindEvent();
9
+ this._run();
10
+ }
11
+
12
+ _run() {
13
+ this.controllerSelector.each((idx, el) => {
14
+ const $field = $(el);
15
+ const enabled = $field.is(":checked");
16
+
17
+ $field.parents("label").find(this.dependentInputSelector).prop("disabled", !enabled);
18
+ });
19
+ }
20
+
21
+ _bindEvent() {
22
+ this.controllerSelector.on("change", () => {
23
+ this._run();
24
+ });
25
+ }
26
+ }
27
+
28
+ exports.Decidim = exports.Decidim || {};
29
+ exports.Decidim.createOptionAttachedInputs = (options) => {
30
+ return new OptionAttachedInputsComponent(options);
31
+ };
32
+ })(window);
@@ -0,0 +1,20 @@
1
+ // = require ./option_attached_inputs.component
2
+ // = require ./autosortable_checkboxes.component
3
+
4
+ ((exports) => {
5
+ const { createOptionAttachedInputs, createAutosortableCheckboxes } = exports.Decidim;
6
+
7
+ $(".radio-button-collection, .check-box-collection").each((idx, el) => {
8
+ createOptionAttachedInputs({
9
+ wrapperField: $(el),
10
+ controllerFieldSelector: "input[type=radio], input[type=checkbox]",
11
+ dependentInputSelector: "input[type=text], input[type=hidden]"
12
+ });
13
+ });
14
+
15
+ $(".sortable-check-box-collection").each((idx, el) => {
16
+ createAutosortableCheckboxes({
17
+ wrapperField: $(el)
18
+ })
19
+ });
20
+ })(window);
@@ -1,14 +1,31 @@
1
1
  form.answer-survey{
2
2
  .radio-button-collection,
3
- .check-box-collection{
3
+ .check-box-collection,
4
+ .sortable-check-box-collection{
4
5
  margin: 0 0 1rem;
5
6
  }
6
7
 
7
- .tos-agreement-help-text{
8
- margin: .2rem 0 0;
8
+ .tos-agreement{
9
+ margin: 1rem 0 0;
10
+
11
+ .help-text{
12
+ margin: .2rem 0 0;
13
+ }
9
14
  }
10
15
 
11
16
  label.survey-question{
12
17
  font-weight: bold;
13
18
  }
19
+
20
+ .help-text{
21
+ margin-top: .5em;
22
+
23
+ .ql-video{
24
+ margin: .5em auto;
25
+ }
26
+ }
27
+
28
+ .last-sorted{
29
+ margin-bottom: 1rem;
30
+ }
14
31
  }