diff --git a/app/components/basic-modal.hbs b/app/components/basic-modal.hbs index f74ea5a00..dcae48620 100644 --- a/app/components/basic-modal.hbs +++ b/app/components/basic-modal.hbs @@ -11,7 +11,7 @@ class='btn-close' data-bs-dismiss='modal' aria-label='Close' - {{action @closeModal}} + {{on 'click' @closeModal}} type='button' > {{/if}} @@ -24,14 +24,14 @@ {{/if}} {{#if @closeModal}} - {{/if}} diff --git a/app/components/cards/public-activity-card-small.hbs b/app/components/cards/public-activity-card-small.hbs index 51e484ea7..19af7576f 100644 --- a/app/components/cards/public-activity-card-small.hbs +++ b/app/components/cards/public-activity-card-small.hbs @@ -2,7 +2,7 @@ itemscope itemtype='https://schema.org/Event' class='card-body p-0' - {{action action}} + {{on 'click' @action}} >
- +
{{/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 @@ @@ -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}}
-{{#each question.sortedOptions as |opt|}} +{{#each @question.sortedOptions as |opt|}} {{#unless opt.isDeleted}}
- - - +
- {{#unless question.form.hasResponses}} + {{#unless @question.form.hasResponses}} @@ -119,8 +118,8 @@ {{/unless}} {{/each}} -{{#unless question.form.hasResponses}} - {{/unless}} \ No newline at end of file diff --git a/app/components/form/closed-question.js b/app/components/form/closed-question.js index c144b45a3..e3e1bcf8e 100644 --- a/app/components/form/closed-question.js +++ b/app/components/form/closed-question.js @@ -1,42 +1,43 @@ import { ClosedQuestionTypes } from 'amber-ui/constants'; import { inject as service } from '@ember/service'; import OpenQuestionComponent from './open-question'; +import { action } from '@ember/object'; -export default OpenQuestionComponent.extend({ - store: service(), - questionTypes: ClosedQuestionTypes, - init() { - this._super(); - }, - actions: { - addOption() { - const position = - this.question.get('sortedOptions.lastObject.position') + 1 || 0; - this.store.createRecord('form/closed-question-option', { - question: this.question, - position, - }); - }, - deleteOption(option) { - option.deleteRecord(); - }, - moveOptionUp(option) { - const index = this.question.get('sortedOptions').indexOf(option); - if (index > 0) { - const previousOption = this.question - .get('sortedOptions') - .objectAt(index - 1); - this.send('switchPositions', option, previousOption); - } - }, - moveOptionDown(option) { - const index = this.question.get('sortedOptions').indexOf(option); - if (index < this.question.get('sortedOptions.length') - 1) { - const nextOption = this.question - .get('sortedOptions') - .objectAt(index + 1); - this.send('switchPositions', option, nextOption); - } - }, - }, -}); +export default class ClosedQuestionComponent extends OpenQuestionComponent { + @service store; + questionTypes = ClosedQuestionTypes; + @action + addOption() { + const position = + this.question.get('sortedOptions.lastObject.position') + 1 || 0; + this.store.createRecord('form/closed-question-option', { + question: this.question, + position, + }); + } + + @action + deleteOption(option) { + option.deleteRecord(); + } + + @action + moveOptionUp(option) { + const index = this.question.get('sortedOptions').indexOf(option); + if (index > 0) { + const previousOption = this.question + .get('sortedOptions') + .objectAt(index - 1); + this.switchPositions(option, previousOption); + } + } + + @action + moveOptionDown(option) { + const index = this.question.get('sortedOptions').indexOf(option); + if (index < this.question.get('sortedOptions.length') - 1) { + const nextOption = this.question.get('sortedOptions').objectAt(index + 1); + this.switchPositions(option, nextOption); + } + } +} diff --git a/app/components/form/form-form.hbs b/app/components/form/form-form.hbs index 523d00171..e71284722 100644 --- a/app/components/form/form-form.hbs +++ b/app/components/form/form-form.hbs @@ -26,9 +26,9 @@
{{#if question.isOpenQuestion}} - {{form/open-question question form=model}} + {{else}} - {{form/closed-question question form=model}} + {{/if}}
diff --git a/app/components/form/open-question.hbs b/app/components/form/open-question.hbs index beeb6ae3e..f68d3883f 100644 --- a/app/components/form/open-question.hbs +++ b/app/components/form/open-question.hbs @@ -1,8 +1,8 @@ Open vraag -{{#unless question.form.hasResponses}} +{{#unless @question.form.hasResponses}}
- +
{{/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 @@
@@ -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}}
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 }} - + -