Skip to content

Commit

Permalink
Change examples to use subfolder partials instead of underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
tonysm committed Sep 1, 2024
1 parent fcaa0e0 commit 86c1ee4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ If you're rendering a Turbo Stream inside a your Blade files, you may use the `<

```blade
<x-turbo::stream :target="$post" action="update">
@include('posts._post', ['post' => $post])
@include('posts.partials.post', ['post' => $post])
<x-turbo::stream>
```

Expand Down
2 changes: 1 addition & 1 deletion docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class CreatesCommentsTest extends TestCase
TurboStream::assertBroadcasted(function (PendingBroadcast $broadcast) use ($todo) {
return $broadcast->target === 'comments'
&& $broadcast->action === 'append'
&& $broadcast->partialView === 'comments._comment'
&& $broadcast->partialView === 'comments.partials.comment'
&& $broadcast->partialData['comment']->is($todo->comments->first())
&& count($broadcast->channels) === 1
&& $broadcast->channels[0]->name === sprintf('private-%s', $todo->broadcastChannel());
Expand Down
14 changes: 7 additions & 7 deletions docs/turbo-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Although it's handy to pass a model instance to the `turbo_stream()` function -
turbo_stream()
->target('comments')
->action('append')
->view('comments._comment', ['comment' => $comment]);
->view('comments.partials.comment', ['comment' => $comment]);
```

There are also shorthand methods which may be used as well:
Expand Down Expand Up @@ -122,7 +122,7 @@ For both the `before` and `after` methods you need additional calls to specify t
```php
turbo_stream()
->before($comment)
->view('comments._flash_message', [
->view('comments.partials.flash_message', [
'message' => __('Comment created!'),
]);
```
Expand Down Expand Up @@ -199,7 +199,7 @@ When creating Turbo Streams using the builders, you may also specify the CSS cla
turbo_stream()
->targets('.comment')
->action('append')
->view('comments._comment', ['comment' => $comment]);
->view('comments.partials.comment', ['comment' => $comment]);
```

## Turbo Stream Macros
Expand Down Expand Up @@ -281,7 +281,7 @@ return turbo_stream([
->append($comment)
->target(dom_id($comment->post, 'comments')),
turbo_stream()
->update(dom_id($comment->post, 'comments_count'), view('posts._comments_count', [
->update(dom_id($comment->post, 'comments_count'), view('posts.partials.comments_count', [
'post' => $comment->post,
])),
]);
Expand All @@ -308,7 +308,7 @@ Here's an example of a more complex custom Turbo Stream view:
<turbo-stream target="@domid($comment->post, 'comments')" action="append">
<template>
@include('comments._comment', ['comment' => $comment])
@include('comments.partials.comment', ['comment' => $comment])
</template>
</turbo-stream>
```
Expand All @@ -319,7 +319,7 @@ Remember, these are Blade views, so you have the full power of Blade at your han
@if (session()->has('status'))
<turbo-stream target="notice" action="append">
<template>
@include('layouts._flash')
@include('layouts.partials.flash')
</template>
</turbo-stream>
@endif
Expand All @@ -331,7 +331,7 @@ Similar to the `<x-turbo::frame>` Blade component, there's also a `<x-turbo::str
@include('layouts.turbo.flash_stream')
<x-turbo::stream :target="[$comment->post, 'comments']" action="append">
@include('comments._comment', ['comment' => $comment])
@include('comments.partials.comment', ['comment' => $comment])
</x-turbo::stream>
```

Expand Down

0 comments on commit 86c1ee4

Please sign in to comment.