diff --git a/app/controllers/boosts_controller.rb b/app/controllers/bubbles/boosts_controller.rb similarity index 83% rename from app/controllers/boosts_controller.rb rename to app/controllers/bubbles/boosts_controller.rb index 48400cc10..038de5e46 100644 --- a/app/controllers/boosts_controller.rb +++ b/app/controllers/bubbles/boosts_controller.rb @@ -1,4 +1,4 @@ -class BoostsController < ApplicationController +class Bubbles::BoostsController < ApplicationController include BubbleScoped def create diff --git a/app/views/bubbles/_messages.html.erb b/app/views/bubbles/_messages.html.erb index c55e8a122..243136bbb 100644 --- a/app/views/bubbles/_messages.html.erb +++ b/app/views/bubbles/_messages.html.erb @@ -1,7 +1,6 @@ <%= messages_tag(bubble) do %> <%# Template Dependency: comments/comment %> - <%# Template Dependency: event_summaries/event_summary %> - <%= render bubble.messages, cached: true %> + <%= render partial: "messages/message", collection: bubble.messages, cached: true %> <%= render "comments/new", bubble: bubble, cached: true %>
diff --git a/app/views/boosts/_boosts.html.erb b/app/views/bubbles/boosts/_boosts.html.erb similarity index 62% rename from app/views/boosts/_boosts.html.erb rename to app/views/bubbles/boosts/_boosts.html.erb index 684ce110e..b741a89fb 100644 --- a/app/views/boosts/_boosts.html.erb +++ b/app/views/bubbles/boosts/_boosts.html.erb @@ -1,10 +1,11 @@ -<%= form_with url: bucket_bubble_boosts_path(bubble.bucket, bubble), class: "pad-inline flex align-center gap" do %> +
<%= text_field_tag :boost_count, bubble.boosts_count, min: 1, class: "boost__input input", autocomplete: "off" %> <%= bubble.boosts_count == 1 ? "boost" : "boosts" %> - <%= tag.button class: "btn", type: :submit, style: "font-size: 0.5em" do %> + + <%= button_to bubble_boosts_path(bubble), class: "btn", type: :submit, style: "font-size: 0.5em" do %> <%= icon_tag "add" %> Boost <% end %> -<% end %> +
diff --git a/app/views/boosts/create.turbo_stream.erb b/app/views/bubbles/boosts/create.turbo_stream.erb similarity index 76% rename from app/views/boosts/create.turbo_stream.erb rename to app/views/bubbles/boosts/create.turbo_stream.erb index e9dcee709..63d73d4a9 100644 --- a/app/views/boosts/create.turbo_stream.erb +++ b/app/views/bubbles/boosts/create.turbo_stream.erb @@ -1,5 +1,5 @@ <%= turbo_stream.update dom_id(@bubble, :boosts) do %> - <%= render "boosts/boosts", bubble: @bubble %> + <%= render "bubbles/boosts/boosts", bubble: @bubble %> <% end %> <%= turbo_stream.replace dom_id(@bubble, :messages) do %> diff --git a/app/views/bubbles/cards/perma/_boosts.html.erb b/app/views/bubbles/cards/perma/_boosts.html.erb index a465a7a53..10c18c79e 100644 --- a/app/views/bubbles/cards/perma/_boosts.html.erb +++ b/app/views/bubbles/cards/perma/_boosts.html.erb @@ -1,3 +1,3 @@ <%= turbo_frame_tag dom_id(bubble, :boosts) do %> - <%= render "boosts/boosts", bubble: bubble %> + <%= render "bubbles/boosts/boosts", bubble: bubble %> <% end %> diff --git a/app/views/messages/_message.html.erb b/app/views/messages/_message.html.erb index cd12237f6..e747f9d90 100644 --- a/app/views/messages/_message.html.erb +++ b/app/views/messages/_message.html.erb @@ -1 +1,5 @@ -<%= render message.messageable %> +<% cache message do %> + <%# Template Dependency: event_summaries/event_summary %> + <%# Template Dependency: comments/comment %> + <%= render partial: message.messageable.to_partial_path, object: message.messageable %> +<% end %> diff --git a/config/routes.rb b/config/routes.rb index 8414ffab4..b54b55c31 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,6 +13,7 @@ Rails.application.routes.draw do resource :pin resource :watch resources :assignments + resources :boosts resources :taggings end end @@ -39,7 +40,6 @@ Rails.application.routes.draw do end resources :bubbles do - resources :boosts resources :comments do resources :reactions, module: :comments end diff --git a/test/controllers/boosts_controller_test.rb b/test/controllers/bubbles/boosts_controller_test.rb similarity index 61% rename from test/controllers/boosts_controller_test.rb rename to test/controllers/bubbles/boosts_controller_test.rb index d5bca1c16..540166de6 100644 --- a/test/controllers/boosts_controller_test.rb +++ b/test/controllers/bubbles/boosts_controller_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class BoostsControllerTest < ActionDispatch::IntegrationTest +class Bubbles::BoostsControllerTest < ActionDispatch::IntegrationTest setup do sign_in_as :kevin end @@ -9,7 +9,7 @@ class BoostsControllerTest < ActionDispatch::IntegrationTest boost_count = bubbles(:logo).boosts_count assert_difference "bubbles(:logo).reload.boosts_count", +1 do - post bucket_bubble_boosts_url(buckets(:writebook), bubbles(:logo), params: { boost_count: boost_count }, format: :turbo_stream) + post bubble_boosts_path(bubbles(:logo), params: { boost_count: boost_count }, format: :turbo_stream) end assert_turbo_stream action: :update, target: dom_id(bubbles(:logo), :boosts) @@ -19,7 +19,7 @@ class BoostsControllerTest < ActionDispatch::IntegrationTest boost_count = 10 assert_changes "bubbles(:logo).reload.boosts_count", to: boost_count do - post bucket_bubble_boosts_url(buckets(:writebook), bubbles(:logo), params: { boost_count: boost_count }, format: :turbo_stream) + post bubble_boosts_path(bubbles(:logo), params: { boost_count: boost_count }, format: :turbo_stream) end assert_turbo_stream action: :update, target: dom_id(bubbles(:logo), :boosts) diff --git a/test/integration/bubble_messages.rb b/test/integration/bubble_messages.rb index 8b4ceea8c..803d1e98f 100644 --- a/test/integration/bubble_messages.rb +++ b/test/integration/bubble_messages.rb @@ -14,7 +14,7 @@ class BubbleMessagesTest < ActionDispatch::IntegrationTest assert_equal "created", bubble.messages.last.messageable.events.sole.action # Boost it - post bucket_bubble_boosts_url(buckets(:writebook), bubble, format: :turbo_stream) + post bubble_boosts_path(bubble, format: :turbo_stream) assert_equal 1, bubble.messages.count assert_predicate bubble.messages.last, :event_summary? assert_equal 2, bubble.messages.last.event_summary.events.count