-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Refactor: {{action}}
helper usage, the sequel
#896
Refactor: {{action}}
helper usage, the sequel
#896
Conversation
… of ModelSaveUtils
… how to do this, and it should not have taken this long lol.
…oller, and they are now all in octane style! :)
…ting late, so I will continue this some other time.
…factoring templates to use the new action
…at call the cancel action from one of the Created, Edit, Destroy Controllers
…hod to the madness lol
…osts in a paged fashion everytime the queryparams change
I initially began rewriting components to glimmer when I encountered them, but that's quite a lot of work and not strictly related to the task this PR is really meant for. I've found it more efficient to just refactor all action helpers and leave other non-octane things as they are for now. We can tackle them in other PRs. I've also not tested that every action occurrence I've refactored in in this PR still functions properly. Not yet at least. I did test that for #635 , but I figured it's more efficient to first rewrite, and then go through all the corresponding pages and test their functioning. |
* 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
i think you forgot 4 files
app/components/advertisement-tool.js
app/components/boolean-tag.js
app/components/cards/activity-card.js
app/components/cards/photo-album-card.js
when these are updated i will aprove
edit: i am stupid, ember/component is not the same
…lper_usage_electric_boogaloo
DO NOT MERGE BEFORE #635 IS MERGED
bases on #635
ref #899
may require a third PR after this
How to review this:
New prevent-default helper
This PR also introduces a new template helper:
prevent-default
. It is used to wrap the action we assign to be executed when an event takes place. Specifically, it adds a call toevent.preventDefault()
. Why would we do this in a helper? Well:e.preventDefault();
calls.preventDefault
should take place in the template, because that's where it is easiest to determine.To elaborate on point two, when we have the following action:
Then a template with
requires a call to
e.preventDefault()
:otherwise the page is reloaded automatically (because that's what a submit event on a form does, apparently.) Now, suppose instead the template contains
then we don't need a
e.preventDefault()
call... See how that's confusing? Sidenote: in reality the underlying ComponentForDoingSomething generally still performs a call toe.preventDefault
, but that's none of our business, since principles like dependency inversion dictate that we do not concern ourselves with the implementation details of a child component, but only with the parts we can 'see' of that child component.Now let's make the point even better: if we have a problematic template that contains both of these types of usages:
then what do we do? We need to call
e.preventDefault()
for one element in the template, but not for the other. But that's easily solved with the new helper: