Move pins to my space

We used the my/ space in HEY to reflect anything that was primarily
hinged off Current.user. Good to use here too.
This commit is contained in:
David Heinemeier Hansson
2025-04-05 14:57:24 +02:00
parent 7494dad91e
commit bfb7ed1216
9 changed files with 25 additions and 16 deletions
@@ -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
@@ -1,3 +0,0 @@
<%= turbo_frame_tag "pins" do %>
<%= render collection: @pins, partial: "bubbles/pins/pin" %>
<% end %>
@@ -1,3 +0,0 @@
<%= turbo_frame_tag "pins" do %>
<%= render collection: @pins, partial: "bubbles/pins/pin" %>
<% end %>
+1 -1
View File
@@ -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 %>
</footer>
@@ -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 %>
<div class="tray__actions border border-radius">
<button class="txt-uppercase btn btn--reversed borderless fill-transparent txt-x-small translucent center" data-action="click->dialog#close">Pinned</button>
@@ -10,4 +10,4 @@
<button class="tray__expander" data-action="dialog#toggle" aria-label="Expand pins stack">
</button>
<% end %>
<% end %>
+3
View File
@@ -0,0 +1,3 @@
<%= turbo_frame_tag "pins" do %>
<%= render collection: @pins, partial: "my/pins/pin" %>
<% end %>
+2 -5
View File
@@ -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 ]
@@ -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