diff --git a/app/controllers/bubbles/pins/trays_controller.rb b/app/controllers/my/pins_controller.rb similarity index 51% rename from app/controllers/bubbles/pins/trays_controller.rb rename to app/controllers/my/pins_controller.rb index ef79beae2..c7f222d33 100644 --- a/app/controllers/bubbles/pins/trays_controller.rb +++ b/app/controllers/my/pins_controller.rb @@ -1,5 +1,5 @@ -class Bubbles::Pins::TraysController < ApplicationController - def show +class My::PinsController < ApplicationController + def index @pins = Current.user.pins.includes(:bubble).ordered.limit(20) end end diff --git a/app/views/bubbles/pins/trays/show.html.erb b/app/views/bubbles/pins/trays/show.html.erb deleted file mode 100644 index 1e155e3c5..000000000 --- a/app/views/bubbles/pins/trays/show.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= turbo_frame_tag "pins" do %> - <%= render collection: @pins, partial: "bubbles/pins/pin" %> -<% end %> \ No newline at end of file diff --git a/app/views/bubbles/pins_trays/show.html.erb b/app/views/bubbles/pins_trays/show.html.erb deleted file mode 100644 index 1e155e3c5..000000000 --- a/app/views/bubbles/pins_trays/show.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= turbo_frame_tag "pins" do %> - <%= render collection: @pins, partial: "bubbles/pins/pin" %> -<% end %> \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 57f76180a..1e6afa890 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -48,7 +48,7 @@ <% if Current.user %> <%= render "notifications/tray" %> - <%= render "bubbles/pins/tray" %> + <%= render "my/pins/tray" %> <%= turbo_frame_tag "terminal", src: terminal_path, data: { turbo_permanent: true } %> <% end %> diff --git a/app/views/bubbles/pins/_pin.html.erb b/app/views/my/pins/_pin.html.erb similarity index 100% rename from app/views/bubbles/pins/_pin.html.erb rename to app/views/my/pins/_pin.html.erb diff --git a/app/views/bubbles/pins/_tray.html.erb b/app/views/my/pins/_tray.html.erb similarity index 89% rename from app/views/bubbles/pins/_tray.html.erb rename to app/views/my/pins/_tray.html.erb index 7551f3781..70c1d5a16 100644 --- a/app/views/bubbles/pins/_tray.html.erb +++ b/app/views/my/pins/_tray.html.erb @@ -2,7 +2,7 @@ <%= tag.dialog id: "pin-tray", class: "tray pin-tray", data: { controller: "dialog", turbo_permanent: true, dialog_modal_value: false, dialog_target: "dialog", action: "keydown.esc->dialog#close:stop click@document->dialog#closeOnClickOutside" } do %> - <%= turbo_frame_tag "pins", src: bubbles_pins_tray_path %> + <%= turbo_frame_tag "pins", src: my_pins_path %>
@@ -10,4 +10,4 @@ -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/my/pins/index.html.erb b/app/views/my/pins/index.html.erb new file mode 100644 index 000000000..d4c176587 --- /dev/null +++ b/app/views/my/pins/index.html.erb @@ -0,0 +1,3 @@ +<%= turbo_frame_tag "pins" do %> + <%= render collection: @pins, partial: "my/pins/pin" %> +<% end %> diff --git a/config/routes.rb b/config/routes.rb index b4099406f..2b9b15d91 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -95,11 +95,8 @@ Rails.application.routes.draw do get "up", to: "rails/health#show", as: :rails_health_check get "manifest" => "rails/pwa#manifest", as: :pwa_manifest - namespace :bubbles do - namespace :pins do - resource :tray, only: :show - end - resources :pins, only: :index + namespace :my do + resources :pins end resource :terminal, only: [ :show, :edit ] diff --git a/test/controllers/my/pins_controller_test.rb b/test/controllers/my/pins_controller_test.rb new file mode 100644 index 000000000..cb6b9f9c0 --- /dev/null +++ b/test/controllers/my/pins_controller_test.rb @@ -0,0 +1,15 @@ +require "test_helper" + +class My::PinsControllerTest < ActionDispatch::IntegrationTest + setup do + sign_in_as :kevin + end + + test "index" do + get my_pins_url + + assert_response :success + assert_select "div", text: /#{users(:kevin).pins.first.bubble.title}/ + end +end +