Skip to content

Commit

Permalink
Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Dec 12, 2024
1 parent a1676ca commit 26a9a05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions examples/_datastar/save-entry.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
Entry successfully saved!
</span>
</div>
{% endfragment %}
{% fragment %}
<div id="title-{{ signals.entryId }}">
{{ signals.title }}
</div>
{% endfragment %}
{% fragment %}
<button id="edit-{{ signals.entryId }}" data-on-click="entryId.value = {{ signals.entryId }}; title..value = '{{ signals.title }}'" data-show="entryId.value != {{ signals.entryId }}" class="btn">
Edit
</button>
Expand Down
6 changes: 3 additions & 3 deletions examples/inline-entry-editing.twig
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@
</div>
</div>
<div data-show="entryId.value == {{ entry.id }}" style="display: none">
<input data-bind-title data-on-keydown:key_enter="save.value.click()" type="text" class="input input-bordered w-full">
<input data-bind-title data-on-keydown="evt.key == 'Enter' && save.value.click()" type="text" class="input input-bordered w-full">
</div>
</td>
<td>{{ entry.author.username }}</td>
<td>
<button id="edit-{{ entry.id }}" data-on-click="alert.value = false; entryId.value = {{ entry.id }}; title.value = '{{ entry.title }}'" data-show="entryId.value != {{ entry.id }}" class="btn">
Edit
</button>
<button data-on-click="alert.value = false; entryId.value = 0; this.value = title.value" data-show="entryId.value == {{ entry.id }}" class="btn" style="display: none">
<button data-on-click="alert.value = false; entryId.value = 0" data-show="entryId.value == {{ entry.id }}" class="btn" style="display: none">
Cancel
</button>
<button data-ref-save data-on-click="confirm('Are you sure?') && {{ datastar.post('_datastar/save-entry.twig') }}" data-show="entryId.value == {{ entry.id }}" class="btn btn-primary" style="display: none">
<button data-ref-save data-on-click="confirm('Are you sure?') && {{ datastar.sse('_datastar/save-entry.twig', {method: 'post'}) }}" data-show="entryId.value == {{ entry.id }}" class="btn btn-primary" style="display: none">
Save
</button>
</td>
Expand Down
2 changes: 1 addition & 1 deletion examples/two-way-binding-function.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<body>
{# https://tailwindcss.com/docs/container #}
<div class="container mx-auto max-w-xl py-16">
<div data-signals="{reversed: ''}" data-on-reverse.window="reversed.value = evt.detail.value" class="flex flex-col space-y-8">
<div data-signals="{reversed: ''}" data-on-reverse__window="reversed.value = evt.detail.value" class="flex flex-col space-y-8">
<div class="space-y-2">
<label>Name</label>
<input data-bind-name data-on-input="reverse(name.value)" class="input input-bordered w-full">
Expand Down

0 comments on commit 26a9a05

Please sign in to comment.