forked from hopsoft/turbo_boost-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to replace the turbo_frame contents
- Loading branch information
Showing
23 changed files
with
471 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ on: | |
- '*' | ||
push: | ||
branches: | ||
- main | ||
- '*' | ||
|
||
jobs: | ||
standard: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
test/dummy/app/controllers/turbo_frame_replaces_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class TurboFrameReplacesController < ApplicationController | ||
# GET /turbo_frame_replace | ||
def show | ||
@extra_data ||= "Unchanged" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
test/dummy/app/views/turbo_frame_replaces/_turbo_frame_replace.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!-- content... --> | ||
|
||
<%= turbo_frame_tag "basic_command-turbo-frame-replace" do %> | ||
<h3>Counter</h3> | ||
|
||
<p> | ||
In this demo, the counter value or "state" is managed by the User model. | ||
It is persisted to the database and used when rendering the page. But this data: | ||
</p> | ||
<code class="mb-3" role="state"><%= @extra_data %></code> | ||
<p> | ||
is outside of the frame and although it is updated in the returned HTML, it is not updated on the screen. | ||
</p> | ||
|
||
<%= turbo_frame_tag :replace_this do %> | ||
<code role="counter"><%= padded_number Current.user.count %></code> | ||
|
||
<% cache do %> | ||
<div> | ||
<button data-turbo-command="IncrementCountCommand"> | ||
<%= render "icons/heroicons/plus", solid: true %> Increment | ||
</button> | ||
|
||
<button data-turbo-command="DecrementCountCommand"> | ||
<%= render "icons/heroicons/minus", solid: true %> Decrement | ||
</button> | ||
|
||
<button data-turbo-command="ResetCountCommand" data-turbo-confirm="Are you sure?"> | ||
<%= render "icons/heroicons/arrow_path", solid: true %> Reset | ||
</button> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<!-- content... --> |
16 changes: 16 additions & 0 deletions
16
test/dummy/app/views/turbo_frame_replaces/_turbo_frame_replace_files.sh.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
├── app | ||
│ ├── commands | ||
│ │ ├── decrement_count_command.rb | ||
│ │ ├── increment_count_command.rb | ||
│ │ └── reset_count_command.rb | ||
│ │ | ||
│ ├── controllers | ||
│ │ └── turbo_framereplaces_controller.rb | ||
│ │ | ||
│ ├── models | ||
│ │ └── user.rb | ||
│ │ | ||
│ ├── views | ||
│ │ └── basic_commands | ||
│ │ ├── _turbo_frame_replace.html.erb | ||
│ │ └── show.html.erb |
Oops, something went wrong.