You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to be able to define a default method for an action on a controller so that only have one define the event and controller, or just the controller for an action.
So for example
classLogControllerextendsController{staticdefaultAction="log"log(){// do something interesting}}
<adata-action="click->log">Log</a>
an alternative could be having a reserved action name that stimulus uses if the method name is not in the action descriptor e.g.
classLogControllerextendsController{_(){// do something interesting}}
<adata-action="click->log">Log</a>
We have quite a lot of small, reusable single action controllers and this could simplify adding actions and make it a bit more economical.
I'd be happy to give it a go if folk like the idea and someone could give me a pointer on how to run a single test 😄
The text was updated successfully, but these errors were encountered:
@lb- Cheers for the reply, the log controller above was just an example, what I am proposing is making it easier to use controller with a single method by defining a default method for the controller, ether by specificing the name of the action or using _ as the method name.
In our app we have lots of controller that have just a single action. Some of these are, generic controllers like sumbitting a form on change or input, refreshing a turbo frame from an action other are specific to our application.
Hi,
It would be great to be able to define a default method for an action on a controller so that only have one define the event and controller, or just the controller for an action.
So for example
an alternative could be having a reserved action name that stimulus uses if the method name is not in the action descriptor e.g.
We have quite a lot of small, reusable single action controllers and this could simplify adding actions and make it a bit more economical.
I'd be happy to give it a go if folk like the idea and someone could give me a pointer on how to run a single test 😄
The text was updated successfully, but these errors were encountered: