585 search results for Turbo

Fantastic Modal UX with a Loading State

... Let's pick up where we left off yesterday. The Ajax-powered modal loads! Try to submit it. Uh oh - something went wrong. It went to some page that didn't have a <turbo-frame id="modal">... which is odd, because every ...

8:04
186 lines | assets/styles/app.css
// ... lines 1 - 18
turbo-frame {
display: block;
}
turbo-frame[busy] {
opacity: .7;
}
turbo-frame[busy] .frame-loading-hide, turbo-frame .frame-loading-show {
display: none;
}
turbo-frame[busy] .frame-loading-show {
display: inline-block;
}
// ... lines 31 - 186
See Code Block in Script
38 lines | templates/voyage/new.html.twig
// ... lines 1 - 24
{% block stream_success %}
<turbo-stream action="prepend" targets="#voyage-list tbody">
<template>
{{ include('voyage/_row.html.twig') }}
</template>
</turbo-stream>
<turbo-stream action="update" target="modal">
<template></template>
</turbo-stream>
<turbo-stream action="append" target="flash-container">
<template>{{ include('_flashes.html.twig') }}</template>
</turbo-stream>
{% endblock %}
See Code Block in Script
46 lines | templates/product/_reviews.html.twig
// ... lines 1 - 2
<turbo-frame id="product-{{ product.id }}-review">
// ... lines 4 - 13
</turbo-frame>
<hr>
<turbo-frame id="product-reviews-form">
// ... lines 19 - 44
</turbo-frame>
See Code Block in Script
... w https://last-stack.wip/assets/vendor/@hotwired/turbo/turbo.index-810f44ef1a202a441e4866b7a4c72d11.js:7 notifyApplicationBeforeCachingSnapshot https://last-stack.wip/assets/vendor/@hotwired/turbo/turbo.index ...
16 lines | assets/app.js
// ... lines 1 - 12
import './turbo/turbo-helper';
import './turbo/prefetch';
See Code Block in Script
Turbo has had a lot of updates. Here's a much simpler way to get the same functionality using stimulus (I'm not using the global turbo-helper): Sorry, this text editor kind of screws up the code and changes some ...
Hello, My solution was to add the *data-turbo-cach"false"* directly into the div.alert within the turbo-stream from the stimulus controller. I aslo added the attribute to the default div.alert from base.html.twig for ...
Nondediou
Nondediou
Read Full Comment
{% block create %}
<turbo-stream action="update" target="product-{{ product.id }}-quick-stats">
<template>
{{ include('product/_quickStats.html.twig') }}
</template>
</turbo-stream>
<turbo-stream action="append" target="product-{{ product.id }}-review-list">
<template>
{{ include('product/_review.html.twig', {
review: newReview,
isNew: true
}) }}
</template>
</turbo-stream>
{% endblock %}
// ... lines 17 - 25
See Code Block in Script
<turbo-stream action="update" target="product-quick-stats">
<template>
{{ include('product/_quickStats.html.twig') }}
</template>
</turbo-stream>
<turbo-stream action="replace" target="product-review">
<template>
{{ include('product/_reviews.html.twig') }}
</template>
</turbo-stream>
See Code Block in Script
56 lines | templates/vinyl/browse.html.twig
// ... lines 1 - 27
<turbo-frame id="mix-browse-list-{{ pager.currentPage }}">
<div class="row">
// ... lines 30 - 47
{% if pager.hasNextPage %}
<turbo-frame id="mix-browse-list-{{ pager.nextPage }}" src="{{ pagerfanta_page_url(pager, pager.nextPage) }}" loading="lazy"></turbo-frame>
{% endif %}
</div>
</turbo-frame>
// ... lines 53 - 56
See Code Block in Script
<turbo-frame
id="add-to-cart-controls"
data-turbo-form-redirect="true"
>
// ... lines 5 - 46
</turbo-frame>
See Code Block in Script
Hey @Marc! Hmm. That is weird. It *sounds* like Turbo is somehow being initialized *twice*. Internally, Turbo registers `turbo-frame` as a custom element (on CustomElementRegistry). So the error seems to be clearly ...
weaverryan
weaverryan
Read Full Comment
26 lines | assets/controllers.json
{
"controllers": {
// ... lines 3 - 12
"@symfony/ux-turbo": {
"turbo-core": {
"enabled": true,
"fetch": "eager"
},
"mercure-turbo-stream": {
"enabled": false,
"fetch": "eager"
}
}
},
// ... line 24
}
See Code Block in Script
{
"controllers": {
"@symfony/ux-turbo": {
"turbo-core": {
"enabled": true,
"fetch": "eager"
},
"mercure-turbo-stream": {
"enabled": false,
"fetch": "eager"
}
}
},
"entrypoints": []
}
See Code Block in Script
HTML dialog for Modals

... in app.js, we disabled a feature in Turbo called page cache... because it apparently doesn't always play nicely with view transitions. When view transitions become standard in Turbo 8, I'm guessing this won't be a ...

13:18
I just did: *composer require symfony/ux-turbo* at my Easy Admin project. My controllers.json was edited: ``` "controllers": { "@symfony/ux-turbo": { "turbo-core ...
180 lines | assets/styles/app.css
// ... lines 1 - 18
turbo-frame[busy] .frame-loading-hide, turbo-frame .frame-loading-show {
display: none;
}
turbo-frame[busy] .frame-loading-show {
display: inline-block;
}
// ... lines 25 - 180
See Code Block in Script
{% if app.request.headers.get('turbo-frame') == frame %}
<turbo-stream action="append" target="flash-container">
<template>{{ include('_flashes.html.twig') }}</template>
</turbo-stream>
{% for stream in app.flashes('stream') %}
{{ stream|raw }}
{% endfor %}
{% endif %}
See Code Block in Script
Publishing Mercure Updates in PHP

We now know that we can easily subscribe to a Mercure topic in JavaScript. And, if we publish a message to that topic with <turbo-stream> HTML in it, our JavaScript will instantly notice & process it. Sweet! So far ...

3:47