Skip to content

Conversation

@1ed
Copy link
Contributor

@1ed 1ed commented May 22, 2022

Q A
Bug fix? no
New feature? yes
Tickets -
License MIT

Hello, this is just a quick draft, extracted from a project, to see if is it interesting enough to include here.

TODO

  • add to changelog
  • add docs
  • add tests
  • add a demo

Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks for working on this @1ed. Perfect use for live components!

@@ -0,0 +1,35 @@
{%- block live_collection_widget -%}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a different name. Maybe live_collection_form_theme.html.twig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be only one theme per component (and per variant like e.g. bootstrap or tailwind) and not per type, and maybe later we would like to add more blocks for an another type, so I would keep the name. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points, makes sense to me.

Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a really cool idea! Let's go for it!

'data-action': 'live#action',
'data-action-name': 'addCollectionItem(name=' ~ form.vars.full_name ~ ')'
}) }) }}
{% endif %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's funny, #90 adds this at the top of the list, and you have it at the bottom. Nothing will work for everyone, but the bottom I think DOES seem better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best would be probably both places :) saying this from experience when I've implemented this :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's start with one... but it occurs to me that it may be be useful to configure this easily (e.g. top, bottom or both)

@1ed 1ed force-pushed the live-collection branch from 596cc30 to 0c42b52 Compare June 7, 2022 17:45
@1ed 1ed marked this pull request as ready for review June 7, 2022 17:58
@seb-jean
Copy link
Contributor

seb-jean commented Jun 7, 2022

What is the difference with this PR?
#90

@kbond
Copy link
Member

kbond commented Jun 7, 2022

This requires your entire form be a live component, #90 does not. Basically, if your form already is a live component, just this would be required to add this functionality.

Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really wonderful work ❤️ . We may need more docs to mention that you should customize the live_collection_widget and live_collection_entry_row blocks in order to position the buttons just how you want them. I'm excited to try this in a real project and see how it goes :).

@weaverryan
Copy link
Member

Thank you Gábor!

@weaverryan weaverryan merged commit d33c02e into symfony:2.x Jun 14, 2022
@1ed
Copy link
Contributor Author

1ed commented Jun 14, 2022

Thank you Ryan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants