Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #305 [GridBuilder] Apply transition action (loic425)
This PR was merged into the 1.13 branch. Discussion ---------- An helper for this kind of feature: https://github.com/Sylius/Sylius/blob/1.13/src/Sylius/Bundle/AdminBundle/Resources/config/grids/product_review.yml#L56 I choose not to add "graph" on the action constructor and let the developer add it on the "options" side. The reason is that is it's not mandatory and Symfony workflow & Winzou state machine have 2 default values (`default` for Winzou and `null` for Symfony workflow). The current template which is a Winzou specific one. I do not remember if I've changed sth on that template on my Workflow PoC. ```twig <!-- @SyliusUi/Grid/Action/applyTransition.html.twig --> {% set labeled = options.labeled is defined ? options.labeled : true %} {% if sm_can(data, options.transition, options.graph) %} <form action="{{ path(options.link.route, options.link.parameters) }}" method="post"> <input type="hidden" name="_csrf_token" value="{{ csrf_token(data.id) }}"> <input type="hidden" name="_method" value="PUT"> <button class="ui loadable {{ options.class|default }} {% if labeled %}labeled{% endif %} icon button" type="submit" data-js-disable=".sylius-grid-table-wrapper button, .sylius-grid-table-wrapper a"> <i class="{{ action.icon }} icon"></i> {% if labeled %}{{ action.label|trans }}{% endif %} </button> </form> {% endif %} ``` I do not like the way "setOptions" has been done (https://github.com/Sylius/SyliusGridBundle/blob/1.13/src/Bundle/Builder/Action/Action.php#L69). I think it's very confusing that it removes the existing values. I think we should merge the Options for a future version and add a removeOption method instead to remove a specific option. Commits ------- 08148e0 [GridBuilder] Apply transition action
- Loading branch information