Skip to content

[Collection forms] Make javascript generic #14340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2020

Conversation

tcheymol
Copy link
Contributor

@tcheymol tcheymol commented Oct 4, 2020

This pull request aims at making javascript code on the "embeded collection form" section reusable in any form collection

  • The aim is that we only need to add a <ul> tag, and add one init line in javascript if we embed another form collection
  • Also, I think that the $addLinkLi can perfectly be added in Twig instead of javascript, it reduces the size of the js function and improoves reusability

What I did is

  • Remove the $addLinkLi from javacripts
  • Add a data attribute to it so it can reference the list container class : data-collection-holder-class

I created a sample project implementing my working solution here

@tcheymol tcheymol force-pushed the collection-forms-make-js-generic branch from 34ddf47 to 45d8a41 Compare October 5, 2020 05:23
@tcheymol tcheymol force-pushed the collection-forms-make-js-generic branch from 45d8a41 to 5451488 Compare October 26, 2020 13:37
@wouterj wouterj changed the base branch from master to 4.4 November 5, 2020 14:09
@wouterj wouterj force-pushed the collection-forms-make-js-generic branch from 5451488 to 3abeceb Compare November 5, 2020 14:09
wouterj added a commit that referenced this pull request Nov 5, 2020
@wouterj wouterj merged commit 0ceb959 into symfony:4.4 Nov 5, 2020
@wouterj
Copy link
Member

wouterj commented Nov 5, 2020

Hi @tcheymol! Thank you for these great changes and especially massive thanks for creating the demo application. It's always very hard to review changes in this article, being able to test them in a Symfony application helps a lot here.

I've done some very minor textual changes in acfe6b6

wouterj added a commit that referenced this pull request Nov 5, 2020
* 4.4:
  addressed issue #11786
  Add array example on ChoiceType choice_attr option
  [#14340] Some minor textual changes
  [Collection forms] Make javascript generic
  Updating the Installer Related Instructions
wouterj added a commit that referenced this pull request Nov 5, 2020
* 5.1:
  addressed issue #11786
  Add array example on ChoiceType choice_attr option
  [#13619] Moved text into a note and added versionadded
  Add wither behavior with PHP8 static return type
  [#14340] Some minor textual changes
  [Collection forms] Make javascript generic
  Updating the Installer Related Instructions
  Non-standard adder/remover methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants