-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor:
{{action}}
helper usage (#635)
* todos * add checks for overrides of ModelSaveUtils, using the entity property of ModelSaveUtils * got the activity destroy controller working properly, it seems :) * article comments now properly redirect. Took me a while to figure out how to do this, and it should not have taken this long lol. * this is starting to look like something. not perfect, but it works for now * this should comprise the last of controllers that extend DestroyController, and they are now all in octane style! :) * debit collection show is currently broken, do not understand why. getting late, so I will continue this some other time. * starting to get a grip on how ember works, I think * more progress, now also added cancel action to editcontroller, and refactoring templates to use the new action * refactoring all usages of "Annuleren" LinkTo elements into buttons that call the cancel action from one of the Created, Edit, Destroy Controllers * jslint * FINALLY figured out how to do a union of ObjectProxies * moved thread save logic to model * more stuff * fix debit collection controllers * going through the controllers alphabetically, decided to add some method to the madness lol * idk, changes from last time I worked on this * fix js lint * fix template lint * I found a way to keep the model just the model, while also querying posts in a paged fashion everytime the queryparams change * more changes * more changes * typo * better handling of transitions in destroycontrollers * I think I have had all new edit and destroy controllers * js lint fixes * remove comment * start of refactoring action helper usage * remove preventdefaults * rewrite board room presence in octane * use @action syntax on newPresence, and move permission check to template * use on, fn * modal, sidebar * rewrite privacy-modal to octane (afaik) * remove unused import * action helper in public-activity-card-small * write open and closed question components in octane * fix lint * fix broken submit based on #896 * fix poll form
- Loading branch information
1 parent
865ba61
commit fa25ea1
Showing
56 changed files
with
526 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.