-
+
{{/unless}}
@@ -13,8 +13,8 @@
aria-label='Vraag'
name='question'
placeholder='Vraag'
- @value={{question.question}}
- disabled={{question.form.hasResponses}}
+ @value={{@question.question}}
+ disabled={{@question.form.hasResponses}}
/>
@@ -25,11 +25,10 @@
-{{#each question.sortedOptions as |opt|}}
+{{#each @question.sortedOptions as |opt|}}
{{#unless opt.isDeleted}}
@@ -38,22 +37,22 @@
class='form-check-input'
@type='checkbox'
name='required'
- @checked={{question.required}}
- disabled={{question.form.hasResponses}}
- id="question-{{question.position}}-required-check"
+ @checked={{@question.required}}
+ disabled={{@question.form.hasResponses}}
+ id="question-{{@question.position}}-required-check"
/>
-
+
- {{#unless question.form.hasResponses}}
+ {{#unless @question.form.hasResponses}}
Omhoog
@@ -62,7 +61,7 @@
Omlaag
diff --git a/app/components/form/open-question.js b/app/components/form/open-question.js
index 4f7de2207..2335206a1 100644
--- a/app/components/form/open-question.js
+++ b/app/components/form/open-question.js
@@ -1,53 +1,58 @@
import { inject as service } from '@ember/service';
-import Component from '@ember/component';
-import { computed } from '@ember/object';
+import { action } from '@ember/object';
import { OpenQuestionTypes } from 'amber-ui/constants';
+import Component from '@glimmer/component';
-const OpenQuestionComponent = Component.extend({
- intl: service(),
- question: null,
- form: null,
- questionTypes: OpenQuestionTypes,
- questionTypeOptions: computed('questionTypes', function () {
+export default class OpenQuestionComponent extends Component {
+ @service intl;
+ questionTypes = OpenQuestionTypes;
+
+ get questionTypeOptions() {
return this.questionTypes.map((questionType) => ({
value: questionType,
label: this.intl.t(`tag.input.types.${questionType}`),
}));
- }),
- actions: {
- moveQuestionUp() {
- const index = this.form.get('sortedQuestions').indexOf(this.question);
- if (index > 0) {
- const previousQuestion = this.form
- .get('sortedQuestions')
- .objectAt(index - 1);
- this.send('switchPositions', this.question, previousQuestion);
- }
- },
- moveQuestionDown() {
- const index = this.form.get('sortedQuestions').indexOf(this.question);
- if (index < this.form.get('sortedQuestions.length') - 1) {
- const nextQuestion = this.form
- .get('sortedQuestions')
- .objectAt(index + 1);
- this.send('switchPositions', this.question, nextQuestion);
- }
- },
- deleteQuestion() {
- this.question.deleteRecord();
- },
- switchPositions(first, second) {
- const firstPosition = first.get('position');
- const secondPosition = second.get('position');
-
- first.set('position', secondPosition);
- second.set('position', firstPosition);
- },
- },
-});
-
-OpenQuestionComponent.reopenClass({
- positionalParams: ['question'],
-});
-
-export default OpenQuestionComponent;
+ }
+
+ get question() {
+ return this.args.question;
+ }
+
+ get form() {
+ return this.args.form;
+ }
+
+ @action
+ moveQuestionUp() {
+ const index = this.form.get('sortedQuestions').indexOf(this.question);
+ if (index > 0) {
+ const previousQuestion = this.form
+ .get('sortedQuestions')
+ .objectAt(index - 1);
+ this.switchPositions(this.question, previousQuestion);
+ }
+ }
+
+ @action
+ moveQuestionDown() {
+ const index = this.form.get('sortedQuestions').indexOf(this.question);
+ if (index < this.form.get('sortedQuestions.length') - 1) {
+ const nextQuestion = this.form.get('sortedQuestions').objectAt(index + 1);
+ this.switchPositions(this.question, nextQuestion);
+ }
+ }
+
+ @action
+ deleteQuestion() {
+ this.question.deleteRecord();
+ }
+
+ @action
+ switchPositions(first, second) {
+ const firstPosition = first.get('position');
+ const secondPosition = second.get('position');
+
+ first.set('position', secondPosition);
+ second.set('position', firstPosition);
+ }
+}
diff --git a/app/components/forms/poll-form.hbs b/app/components/forms/poll-form.hbs
index 722d768a1..99a18a931 100644
--- a/app/components/forms/poll-form.hbs
+++ b/app/components/forms/poll-form.hbs
@@ -26,7 +26,7 @@
{{#each @model.sortedQuestions as |question|}}
{{#unless question.isDeleted}}
- {{poll/closed-question question}}
+
{{/unless}}
{{/each}}
diff --git a/app/components/menu-sidebar.hbs b/app/components/menu-sidebar.hbs
index 60e40cf87..14df37d06 100644
--- a/app/components/menu-sidebar.hbs
+++ b/app/components/menu-sidebar.hbs
@@ -102,7 +102,7 @@
{{! Logout }}
-
+
-