diff --git a/hotwire-tw-demo/app/views/layouts/_sidebar.html.erb b/hotwire-tw-demo/app/views/layouts/_sidebar.html.erb index f9e1d44..9aa1c23 100644 --- a/hotwire-tw-demo/app/views/layouts/_sidebar.html.erb +++ b/hotwire-tw-demo/app/views/layouts/_sidebar.html.erb @@ -12,19 +12,19 @@ <% end %>
  • - <%= link_to root_path(icon: Tweet.icons[:love]), class: "nav-link #{active_css_class(root_path + "?icon=0")}" do %> + <%= link_to root_path(icon: Tweet.icons[:love]), class: "nav-link #{active_css_class(root_path + "?icon=0")}", data: { turbo_frame: "tweets" } do %> <%== show_icon(Tweet.icons[:love], width: 30, height: 30) %> <% end %>
  • - <%= link_to root_path(icon: Tweet.icons[:angry]), class: "nav-link #{active_css_class(root_path + "?icon=1")}" do %> + <%= link_to root_path(icon: Tweet.icons[:angry]), class: "nav-link #{active_css_class(root_path + "?icon=1")}", data: { turbo_frame: "tweets" } do %> <%== show_icon(Tweet.icons[:angry], width: 30, height: 30) %> <% end %>
  • - <%= link_to root_path(icon: Tweet.icons[:smile]), class: "nav-link #{active_css_class(root_path + "?icon=2")}" do %> + <%= link_to root_path(icon: Tweet.icons[:smile]), class: "nav-link #{active_css_class(root_path + "?icon=2")}", data: { turbo_frame: "tweets" } do %> <%== show_icon(Tweet.icons[:smile], width: 30, height: 30) %> diff --git a/hotwire-tw-demo/app/views/tweets/_new.html.erb b/hotwire-tw-demo/app/views/tweets/_new.html.erb index d91169d..1f98eff 100644 --- a/hotwire-tw-demo/app/views/tweets/_new.html.erb +++ b/hotwire-tw-demo/app/views/tweets/_new.html.erb @@ -9,7 +9,7 @@ <% end %> - <%= form_with model: @tweet || Tweet.new, local: true do |form| %> + <%= form_with model: @tweet || Tweet.new, local: true, data: { turbo_frame: "tweets" } do |form| %>
    <%= form.label :icon, "きもち", class: "col-sm-2 col-form-label" %>
    diff --git a/hotwire-tw-demo/app/views/tweets/index.html.erb b/hotwire-tw-demo/app/views/tweets/index.html.erb index 14da725..cc59cb3 100644 --- a/hotwire-tw-demo/app/views/tweets/index.html.erb +++ b/hotwire-tw-demo/app/views/tweets/index.html.erb @@ -3,5 +3,7 @@
      - <%= render partial: "tweet", collection: @tweets %> + <%= turbo_frame_tag "tweets" do %> + <%= render partial: "tweet", collection: @tweets %> + <% end %>