590 search results for Turbo

<turbo-frame id="product-{{ product.id }}-review">
{% for review in product.reviews %}
<div class="component-light my-3 p-3">
<p><i class="fas fa-user-circle me-2"></i>{{ review.owner.email }} <i class="fas fa-star ms-4"></i> {{ review.stars }}/5</p>
<div>
{{ review.content }}
</div>
</div>
{% else %}
<p>This product has not been reviewed yet!</p>
{% endfor %}
</turbo-frame>
See Code Block in Script
128 lines | src/Controller/ProductController.php
// ... lines 1 - 20
class ProductController extends AbstractController
{
// ... lines 23 - 71
/**
* @Route("/product/{id}/reviews", name="app_product_reviews")
*/
public function productReviews(Product $product, CategoryRepository $categoryRepository, Request $request, EntityManagerInterface $entityManager, HubInterface $mercureHub)
{
// ... lines 77 - 82
if ($request->isMethod('POST')) {
// ... lines 84 - 85
$update = new Update(
'product-reviews',
'<turbo-stream action="update" target="product-quick-stats"><template>QUICK STATS CHANGED!</template></turbo-stream>'
);
$mercureHub->publish($update);
// ... lines 91 - 109
}
// ... lines 111 - 117
}
// ... lines 119 - 126
}
See Code Block in Script
49 lines | templates/product/show.html.twig
{% extends 'product/productBase.html.twig' %}
{% block productBody %}
<turbo-frame id="product-info" target="_top" class="row pt-3 product-show">
// ... lines 5 - 31
<div class="p-3 mt-4 d-flex justify-content-between flex-wrap flex-lg-nowrap">
<div id="product-quick-stats">
{{ include('product/_quickStats.html.twig') }}
</div>
<div>
{{ include('product/_cart_add_controls.html.twig') }}
</div>
</div>
// ... line 40
</turbo-frame>
// ... lines 42 - 46
{{ include('product/_reviews.html.twig') }}
{% endblock %}
See Code Block in Script
// ... lines 1 - 9
class TurboFrameRedirectSubscriber implements EventSubscriberInterface
{
public function onKernelResponse(ResponseEvent $event)
{
if (!$this->shouldWrapRedirect($event->getRequest(), $event->getResponse())) {
return;
}
$response = new Response(null, 200, [
'Turbo-Location' => $event->getResponse()->headers->get('Location'),
]);
$event->setResponse($response);
}
// ... lines 23 - 30
private function shouldWrapRedirect(Request $request, Response $response): bool
{
if (!$response->isRedirection()) {
return false;
}
return (bool) $request->headers->get('Turbo-Frame-Redirect');
}
}
See Code Block in Script
// ... lines 1 - 9
class TurboFrameRedirectSubscriber implements EventSubscriberInterface
{
public function onKernelResponse(ResponseEvent $event)
{
if (!$this->shouldWrapRedirect($event->getRequest(), $event->getResponse())) {
return;
}
}
// ... lines 18 - 25
private function shouldWrapRedirect(Request $request, Response $response): bool
{
if (!$response->isRedirection()) {
return false;
}
if (!$request->headers->has('Turbo-Frame')) {
return false;
}
if ($request->headers->get('Turbo-Frame-Redirect')) {
return true;
}
return false;
}
}
See Code Block in Script
<turbo-frame id="add-to-cart-controls">
{{ form_start(addToCartForm, {
attr: { class: 'cart-add-controls d-flex align-items-center justify-content-baseline' }
}) }}
{% if addToCartForm.color is defined %}
// ... lines 6 - 25
{% endif %}
// ... lines 27 - 34
{{ form_end(addToCartForm) }}
<div>
{{ form_errors(addToCartForm) }}
{% if addToCartForm.color is defined %}
{{ form_errors(addToCartForm.color) }}
{% endif %}
{{ form_errors(addToCartForm.quantity) }}
</div>
</turbo-frame>
See Code Block in Script
<div
class="modal fade"
tabindex="-1"
aria-hidden="true"
data-modal-form-target="modal"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{ modalTitle }}</h5>
<button type="button" class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<turbo-frame
class="modal-body"
src="{{ modalSrc }}"
id="{{ id }}"
>
{{ modalContent|default('Loading...') }}
</turbo-frame>
</div>
</div>
</div>
See Code Block in Script
15 lines | templates/product_admin/new.html.twig
// ... lines 1 - 4
{% block body %}
<div class="container mt-4">
<a href="{{ path('product_admin_index') }}"><i class="fas fa-caret-left"></i> Back to list</a>
<h1 class="mt-3">Create new Product</h1>
<turbo-frame id="product-info" target="_top">
{{ include('product_admin/_form.html.twig') }}
</turbo-frame>
</div>
{% endblock %}
See Code Block in Script
18 lines | templates/product_admin/edit.html.twig
// ... lines 1 - 4
{% block body %}
<div class="container mt-4">
<a href="{{ path('product_admin_index') }}"><i class="fas fa-caret-left"></i> Back to list</a>
<turbo-frame id="product-info" target="_top">
<div class="d-flex justify-content-between">
<h1 class="mt-3">Edit Product</h1>
{{ include('product_admin/_delete_form.html.twig') }}
</div>
{{ include('product_admin/_form.html.twig', {'button_label': 'Update'}) }}
</turbo-frame>
</div>
{% endblock %}
See Code Block in Script
40 lines | tests/AppBrowser.php
// ... lines 1 - 4
use Facebook\WebDriver\WebDriverBy;
// ... lines 6 - 7
class AppBrowser extends PantherBrowser
{
// ... lines 10 - 17
public function waitForDialog(): self
{
$this->client()->wait()->until(function() {
return $this->crawler()->filter('dialog[open]')->count() > 0;
});
if ($this->crawler()->filter('dialog[open] turbo-frame')->count() > 0) {
$this->waitForTurboFrameLoad();
}
return $this;
}
public function waitForTurboFrameLoad(): self
{
$this->client()->wait()->until(function() {
return $this->crawler()->filter('turbo-frame[aria-busy="true"]')->count() === 0;
});
return $this;
}
}
See Code Block in Script
67 lines | templates/base.html.twig
<!DOCTYPE html>
<html>
// ... lines 3 - 15
<body class="bg-black text-white font-mono">
// ... lines 17 - 54
<twig:Modal>
<turbo-frame
id="modal"
data-modal-target="dynamicContent"
data-action="turbo:before-fetch-request->modal#showLoading"
class="aria-busy:opacity-50 transition-opacity"
>
{{ include('_frameSuccessStreams.html.twig', { frame: 'modal' }) }}
</turbo-frame>
</twig:Modal>
</body>
</html>
See Code Block in Script
74 lines | templates/base.html.twig
<!DOCTYPE html>
<html>
// ... lines 3 - 15
<body class="bg-black text-white font-mono">
// ... lines 17 - 55
<div
// ... lines 57 - 58
>
<dialog
// ... lines 61 - 63
>
<div class="flex grow p-5">
<div class="grow overflow-auto p-1">
<turbo-frame id="modal" data-modal-target="dynamicContent"></turbo-frame>
</div>
</div>
</dialog>
</div>
</body>
</html>
See Code Block in Script
102 lines | templates/base.html.twig
<!DOCTYPE html>
<html>
// ... lines 3 - 15
<body class="bg-black text-white font-mono">
// ... lines 17 - 51
<div
// ... lines 53 - 54
>
<dialog
// ... lines 57 - 59
>
<div class="flex grow p-5">
<div class="grow overflow-auto p-1">
<turbo-frame
id="modal"
// ... lines 65 - 67
>
// ... lines 69 - 71
{% for stream in app.flashes('stream') %}
{{ stream|raw }}
{% endfor %}
</turbo-frame>
</div>
</div>
</dialog>
// ... lines 79 - 94
</div>
// ... lines 96 - 99
</body>
</html>
See Code Block in Script
95 lines | templates/base.html.twig
<!DOCTYPE html>
<html>
// ... lines 3 - 15
<body class="bg-black text-white font-mono">
// ... lines 17 - 55
<div
// ... lines 57 - 58
>
<dialog
// ... lines 61 - 63
>
<div class="flex grow p-5">
<div class="grow overflow-auto p-1">
<turbo-frame
// ... lines 68 - 70
class="aria-busy:opacity-50 transition-opacity"
></turbo-frame>
</div>
</div>
</dialog>
// ... lines 76 - 91
</div>
</body>
</html>
See Code Block in Script
94 lines | templates/base.html.twig
<!DOCTYPE html>
<html>
// ... lines 3 - 15
<body class="bg-black text-white font-mono">
// ... lines 17 - 55
<div
// ... lines 57 - 58
>
<dialog
// ... lines 61 - 63
>
<div class="flex grow p-5">
<div class="grow overflow-auto p-1">
<turbo-frame
id="modal"
data-modal-target="dynamicContent"
data-action="turbo:before-fetch-request->modal#showLoading"
></turbo-frame>
</div>
</div>
</dialog>
// ... lines 75 - 90
</div>
</body>
</html>
See Code Block in Script
56 lines | templates/planet/show.html.twig
// ... lines 1 - 4
{% block body %}
<div class="m-4 p-4 bg-gray-800 rounded-lg">
// ... lines 7 - 8
<turbo-frame id="planet-info">
// ... lines 10 - 35
<div class="mt-2">
<a href="{{ path('app_homepage') }}">&lt;-- Back</a>
<a href="{{ path('app_planet_edit', {'id': planet.id}) }}">Edit</a>
</div>
</turbo-frame>
// ... lines 42 - 53
</div>
{% endblock %}
See Code Block in Script
54 lines | templates/planet/show.html.twig
// ... lines 1 - 4
{% block body %}
<div class="m-4 p-4 bg-gray-800 rounded-lg">
// ... lines 7 - 8
<turbo-frame id="planet-info">
<table class="min-w-full bg-gray-800 text-white">
// ... lines 11 - 33
</table>
<div class="mt-2">
<a href="{{ path('app_homepage') }}">&lt;-- Back</a>
</div>
</turbo-frame>
// ... lines 40 - 51
</div>
{% endblock %}
See Code Block in Script
138 lines | templates/main/homepage.html.twig
// ... lines 1 - 27
{% block body %}
<div class="flex">
// ... lines 30 - 36
<section class="flex-1 ml-10">
// ... lines 38 - 55
<turbo-frame id="voyage-list">
<div class="bg-gray-800 p-4 rounded">
<table class="w-full text-white">
// ... lines 59 - 120
</table>
</div>
<div class="flex items-center mt-6 space-x-4">
// ... lines 124 - 132
</div>
</turbo-frame>
</section>
</div>
{% endblock %}
See Code Block in Script
80 lines | templates/main/homepage.html.twig
// ... lines 1 - 43
<div
data-controller="popover"
data-action="mouseenter->popover#show mouseleave->popover#hide"
class="relative"
>
// ... lines 49 - 54
<template data-popover-target="content">
<div
data-popover-target="card"
class="max-w-sm rounded shadow-lg bg-gray-900 absolute left-0 bottom-10"
>
<turbo-frame loading="lazy" id="planet-card-{{ voyage.planet.id }}" target="_top" src="{{ path('app_planet_show_card', {
'id': voyage.planet.id,
}) }}"></turbo-frame>
</div>
</template>
</div>
// ... lines 66 - 80
See Code Block in Script
80 lines | templates/main/homepage.html.twig
// ... lines 1 - 43
<div
data-controller="popover"
data-action="mouseenter->popover#show mouseleave->popover#hide"
class="relative"
>
// ... lines 49 - 54
<div data-popover-target="content">
<div
data-popover-target="card"
class="max-w-sm rounded shadow-lg bg-gray-900 absolute left-0 bottom-10"
>
<turbo-frame loading="lazy" id="planet-card-{{ voyage.planet.id }}" target="_top" src="{{ path('app_planet_show_card', {
'id': voyage.planet.id,
}) }}"></turbo-frame>
</div>
</div>
</div>
// ... lines 66 - 80
See Code Block in Script