585 search results for Turbo

Hey @Ole! No worries :). It IS imported from `app.js` - we did it WAY back on chapter 11 - https://symfonycasts.com/screencast/turbo/organize#codeblock-b154ca5114 Let me know if that helps! Cheers! ...
weaverryan
weaverryan
Read Full Comment
... I'm sorry, I did not completly understand, how is the turbo-helper instantiated? Does/should it happen automatically, oder do i have to create it from within app.js manually?
For people using a more recent version of Turbo (in my case 7.2.4) there's no error in the console, but the page redirects to the /cart/_featured page instead. ...
Thank you very much. I will try to implement all your recommendations. It's true that I haven't practiced enough in the Turbo and stimulus technologies yet. It's probably time to put myself on it. ...
Hi David! The JavaScript ecosystem has indeed grown and matured A LOT during the past 6 or so years. It's quite remarkable! I'm glad you find this useful! I think you will love the stimulus/turbo tutorials as well! ...
Simply out of curiosity, why isn't the behavior behind the data-turbo-track="reload" attribute something that's done by default? Isn't this something you always want checked? Why is it optional? ...
Hey again shadowc ! Just a small update: this is now supported in Turbo 7.1.0 - here are the docs :) https://turbo.hotwired.dev/handbook/frames#promoting-a-frame-navigation-to-a-page-visit Cheers! ...
weaverryan
weaverryan
Read Full Comment
... Ah! You're right! It's new in RC4! https://github.com/hotwired/turbo/releases/tag/v7.0.0-rc.4 So that will allow us to simplify things. I'll investigate and add a note to the video to help people. Thanks for the pointer!
weaverryan
weaverryan
Read Full Comment
Hey Ilya, Thank you for your interest in SymfonyCasts tutorials! This course should be the next after "Symfony UX: Turbo" that is releasing right now. I think this should happen in about 2 weeks. Thank you for your patience! Cheers! ...
Yes! It worked! You're the King, Ryan! Thank you for your help and, once again, for your great tutorials. I'm looking forward to the next one on "Turbo". Cyril ...
Hey Michael B.! Ah!!! This is awesome - and I'm so honored. Alpine is a very powerful system - so I'm even happier that you like Stimulus (I also much prefer its approach). And Turbo is... starting today! Cheers! ...
weaverryan
weaverryan
Read Full Comment
My mind is now fully blown by how easy and intuitive stimulus makes doing front-end javascript dev without abandoning Twig. Thanks and I can't wait for the Turbo course! ...
... Hey Axel! We'll cover that :). Well, specifically Turbo and Mercure - there is absolutely a built-in feature for having a section of your site subscribe for updates and have them added automatically. It's pretty sweet. Cheers!
weaverryan
weaverryan
Read Full Comment
105 lines | src/Controller/ProductAdminController.php
// ... lines 1 - 31
/**
* @Route("/new", name="product_admin_new", methods={"GET","POST"})
*/
public function new(Request $request): Response
{
// ... lines 37 - 55
return $this->renderForm('product_admin/' . $template, [
'product' => $product,
'form' => $form,
'formTarget' => $request->headers->get('Turbo-Frame', '_top')
]);
}
// ... lines 63 - 105
See Code Block in Script
104 lines | src/Controller/ProductAdminController.php
// ... lines 1 - 61
/**
* @Route("/{id}/edit", name="product_admin_edit", methods={"GET","POST"})
*/
public function edit(Request $request, Product $product): Response
{
// ... lines 68 - 82
return $this->renderForm('product_admin/edit.html.twig', [
'product' => $product,
'form' => $form,
'formTarget' => $request->headers->get('Turbo-Frame', '_top')
]);
}
// ... lines 89 - 104
See Code Block in Script
36 lines | templates/cart/_featuredSidebar.html.twig
// ... lines 1 - 17
{% if showDescription %}
{{ featuredProduct.description }}
{% else %}
{{ featuredProduct.description|u.truncate(25)|trim }}...
<a
data-turbo-frame="cart-sidebar"
class="frame-loading-hide"
href="{{ path('_app_cart_product_featured', {
description: true,
}) }}">(read more)</a>
<span class="frame-loading-show fas fa-spinner fa-spin"></span>
{% endif %}
// ... lines 31 - 36
See Code Block in Script
import { Controller } from 'stimulus';
import { visit } from '@hotwired/turbo';
export default class extends Controller {
count = 0;
static targets = ['count'];
increment() {
this.count++;
this.countTarget.innerText = this.count;
if (this.count === 10) {
visit('/you-won');
}
}
}
See Code Block in Script
113 lines | src/Controller/VoyageController.php
// ... lines 1 - 15
class VoyageController extends AbstractController
{
// ... lines 18 - 64
public function edit(Request $request, Voyage $voyage, EntityManagerInterface $entityManager): Response
{
// ... lines 67 - 69
if ($form->isSubmitted() && $form->isValid()) {
// ... lines 71 - 73
if ($request->headers->has('turbo-frame')) {
$stream = $this->renderBlockView('voyage/edit.html.twig', 'stream_success', [
'voyage' => $voyage
]);
$this->addFlash('stream', $stream);
}
// ... lines 81 - 82
}
// ... lines 84 - 88
}
// ... lines 90 - 111
}
See Code Block in Script
14 lines | templates/voyage/_row.html.twig
<tr class="even:bg-gray-700 odd:bg-gray-600">
// ... lines 2 - 4
<td class="px-6 py-4 whitespace-nowrap">
// ... line 6
<a
href="{{ path('app_voyage_edit', {'id': voyage.id}) }}"
class="ml-4 text-yellow-400 hover:text-yellow-600"
data-turbo-frame="modal"
>edit</a>
</td>
</tr>
See Code Block in Script
As a note, Turbo 8 (added in UX v2.15.0) includes "InstantClick" (https://turbo.hotwired.dev/handbook/drive#instantclick) which causes a pre-load like event (and additional XHR calls) on hover. InstantClick also ...