585 search results for Turbo

... you referring to Symfony's fragments system - https://symfonycasts.com/screencast/turbo/frames-find-frames#using-fragment-uri ? Cheers!
weaverryan
weaverryan
Read Full Comment
What is better solution taking into account server load (Mercure Hub)? Users subscribe for one topic "product reviews" so that Mercure Pushes information to all of them and Turbo, based on frame ID, decides if do something with it or not - like shown in tutorial. Or the better solution is to have unique topic for each product? ...
Thanks for your reply Ryan. Actually I’m just into the code highlighting stuff for blog posts with shell scripts/source code. Expanding is not needed by me. And, by the way, many, many thanks for your great videos. Currently I’m into Stimulus, looking forward to Turbo. Keep on that great work. ...
103 lines | templates/base.html.twig
<!DOCTYPE html>
<html lang="en-US">
<head>
// ... lines 4 - 13
</head>
<body>
// ... lines 16 - 69
<div id="flash-container" data-turbo-cache="false">
{% for flash in app.session.flashBag.get('success') %}
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ flash }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
<span aria-hidden="true"></span>
</button>
</div>
{% endfor %}
</div>
// ... lines 81 - 100
</body>
</html>
See Code Block in Script
// ... lines 1 - 10
class TurboFrameRedirectSubscriber implements EventSubscriberInterface
{
private UrlGeneratorInterface $urlGenerator;
public function __construct(UrlGeneratorInterface $urlGenerator)
{
$this->urlGenerator = $urlGenerator;
}
// ... lines 20 - 37
private function shouldWrapRedirect(Request $request, Response $response): bool
{
if (!$response->isRedirection()) {
return false;
}
$location = $response->headers->get('Location');
if ($location === $this->urlGenerator->generate('app_login')) {
return true;
}
return (bool) $request->headers->get('Turbo-Frame-Redirect');
}
}
See Code Block in Script
19 lines | templates/voyage/_row.html.twig
<tr class="even:bg-gray-700 odd:bg-gray-600" id="voyage-list-item-{{ voyage.id }}">
// ... lines 2 - 4
<td class="px-6 py-4 whitespace-nowrap">
// ... lines 6 - 11
<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
89 lines | templates/base.html.twig
<!DOCTYPE html>
<html>
// ... lines 3 - 15
<body class="bg-black text-white font-mono">
<div class="container mx-auto min-h-screen flex flex-col">
<header class="my-8 px-4">
<nav class="flex items-center justify-between mb-4">
// ... lines 20 - 31
<twig:Modal :closeButton="true" padding="" :fixedTop="true" data-turbo-permanent id="global-search-modal">
// ... lines 33 - 43
</twig:Modal>
</nav>
</header>
// ... lines 47 - 56
</div>
// ... lines 58 - 86
</body>
</html>
See Code Block in Script
51 lines | templates/voyage/index.html.twig
// ... lines 1 - 4
{% block body %}
<div class="m-4 p-4 bg-gray-800 rounded-lg">
<div
class="flex justify-between"
>
<h1 class="text-xl font-semibold text-white mb-4">Voyages</h1>
<a
href="{{ path('app_voyage_new') }}"
data-turbo-frame="modal"
class="flex items-center space-x-1 bg-blue-500 hover:bg-blue-700 text-white text-sm font-bold px-4 rounded"
>
// ... lines 17 - 18
</a>
</div>
// ... lines 21 - 48
</div>
{% endblock %}
See Code Block in Script
106 lines | src/Controller/VoyageController.php
// ... lines 1 - 15
class VoyageController extends AbstractController
{
// ... lines 18 - 25
#[Route('/new', name: 'app_voyage_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
// ... lines 29 - 32
if ($form->isSubmitted() && $form->isValid()) {
// ... lines 34 - 38
if ($request->headers->has('turbo-frame')) {
$stream = $this->renderBlockView('voyage/new.html.twig', 'stream_success', [
'voyage' => $voyage
]);
$this->addFlash('stream', $stream);
}
// ... lines 46 - 47
}
// ... lines 49 - 53
}
// ... lines 55 - 104
}
See Code Block in Script
122 lines | src/Controller/VoyageController.php
// ... lines 1 - 15
class VoyageController extends AbstractController
{
// ... lines 18 - 91
public function delete(Request $request, Voyage $voyage, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$voyage->getId(), $request->request->get('_token'))) {
$id = $voyage->getId();
// ... lines 96 - 100
if ($request->headers->has('turbo-frame')) {
$stream = $this->renderBlockView('voyage/delete.html.twig', 'success_stream', [
'id' => $id,
]);
$this->addFlash('stream', $stream);
}
}
// ... lines 109 - 110
}
// ... lines 112 - 120
}
See Code Block in Script
52 lines | templates/base.html.twig
// ... lines 1 - 14
<body class="bg-black text-white font-mono">
<div class="container mx-auto min-h-screen flex flex-col">
<header class="my-8 px-4">
<nav class="flex items-center justify-between mb-4">
<div class="flex items-center">
// ... lines 20 - 27
<a href="{{ path('app_voyage_index') }}" data-turbo-preload class="ml-6 hover:text-gray-400">Voyages</a>
// ... line 29
</div>
// ... lines 31 - 36
</nav>
</header>
// ... lines 39 - 48
</div>
</body>
</html>
See Code Block in Script
13 lines | config/bundles.php
<?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Symfony\UX\Turbo\TurboBundle::class => ['all' => true],
];
See Code Block in Script
... should be opened or closed. > It feels like I'm missing something though, and even wondering if Turbo would solve this problem for me? Turbo CAN solve a lot of problems. But... probably not in this case. Well ...
weaverryan
weaverryan
Read Full Comment
Hey @Fabrice! Sorry for the slow reply! But I'm happy to chat about this topic! > 1. Requests are submitted via Ajax using Turbo Drive (if I understood correctly). But if our application is not ready to ...
weaverryan
weaverryan
Read Full Comment
Hey |mention:37880|! Morphing is alive and well on Turbo 8, though I admit that I don't have any real experience with it yet (not because it's bad or anything, I've just not been available!). If you have the `meta ...
weaverryan
weaverryan
Read Full Comment
Hey |mention:38873| Thank you for your kind words. I believe you need a full-page refresh for this case. To make a `turbo-frame` load the content on the outside you need to add this HTML attribute `target="_top"` I ...
MolloKhan
MolloKhan
Read Full Comment
I got your hive five! Hello, Turbo might be usefull but just one moment has not lighted in lesson. If you run some thing on page - JS loop counter, audio, video or WS/WSS connection - it would not be cancel whenever ...
... correct, I'll have to play with this at some point and see what needs to be done - we may need to tell Turbo to ignore that morph element :). Cheers!
weaverryan
weaverryan
Read Full Comment
Many thanks for the course! I haven't had much time to get to grips with AssetMapper or LiveComponents yet, so I was all the more pleased to finally get to know the packages. I also learned a few new tricks for Turbo ...
Sometimes you spend a good amount of time typing a message and find a solution a few minutes after it, I stumbled upon this tutorial, which has the answer for now: https://symfonycasts.com/screencast/turbo/prevent ...