Files
fizzy/config/routes.rb
T
Mike Dalessio cb61b36715 Allow boosts on cards (#2411)
* Add reactions association to Card model

Adds `has_many :reactions` to Card, matching the implementation in Comment.
This allows cards to be reacted to directly with emoji reactions.

The association:
- Orders reactions chronologically
- Uses polymorphic `:reactable` interface
- Deletes reactions when card is destroyed

Includes test coverage for the new association.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add reactions UI to card detail view

- Create Cards::ReactionsController with turbo stream responses
- Add card reactions views (reactions list, new form, menu partial)
- Position reaction button flush-right when no reactions exist
- Show reactions on bottom-left when present, with button inline
- Handle narrow viewports by flowing button below meta section
- Add controller tests for card reactions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add boost count to card preview

Display reaction count alongside comment count on card tiles in board
columns. Introduces a .card__counts wrapper to group both counts with
proper positioning on all viewport sizes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Consolidate reaction views for cards and comments

Extract shared views to app/views/reactions/ using polymorphic routing.
Both card and comment reactions now render the same partials, with a
helper to compute the correct path prefix for nested routes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix emoji picker width in card reactions

Override .card .popup { inline-size: 260px } for the reaction popup
so the emoji grid displays without horizontal scrollbar.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Hide boost count where comment count is hidden

Add .card__boosts alongside .card__comments in:
- Tray view (display: none)
- Cards with background images (opacity toggle on hover)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix reactions button overlap with zoom button in card footer

When a card has a background image, the footer contains both a reactions
button and a zoom button. Previously they would overlap because the
reactions button was absolutely positioned to the bottom-right.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Tighten up previews

* Move card reactions from meta partial to container

Fixes two issues:

1. Reactions were duplicated each time a card was assigned because the
   turbo stream replaced the meta div with the full perma/meta partial,
   which included reactions outside the replaced element.

2. Draft cards incorrectly showed the boost button because the meta
   partial was shared between published and draft containers.

Moving reactions to _container.html.erb (published cards only) fixes
both issues and keeps the meta partial focused on meta content.

Fixes https://app.fizzy.do/5986089/cards/3837
Fixes https://app.fizzy.do/5986089/cards/3835

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* WIP adjust perma page

* Position and style the footer

* Render the stamp in the card body instead of the footer

* Fix undefined local variable in public cards view

Changed `card` to `@card` when rendering the stamp partial.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Preload card reactions to avoid N+1 queries

Include reactions and their reacters in the preloaded scope, matching
what we already do for comments.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add model tests for card and comment reaction cleanup

Test that:
- Creating a card reaction touches the card's last_active_at
- Reactions are deleted when their parent comment is destroyed
- Reactions are deleted when their parent card is destroyed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Minor improvements to reactions code

- Use size instead of count in boosts partial to avoid extra SQL query
  on already-loaded collection
- Add else clause to reaction_path_prefix_for to raise ArgumentError
  for unknown reactable types instead of silently returning nil

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Bump specificity of reaction popup in the card perma

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Andy Smith <andy@37signals.com>
2026-01-23 13:25:55 -05:00

249 lines
5.4 KiB
Ruby

Rails.application.routes.draw do
root "events#index"
namespace :account do
resource :cancellation, only: [ :create ]
resource :entropy
resource :join_code
resource :settings
resources :exports, only: [ :create, :show ]
end
resources :users do
scope module: :users do
resource :avatar
resource :role
resource :events
resources :push_subscriptions
resources :email_addresses, param: :token do
resource :confirmation, module: :email_addresses
end
end
end
resources :boards do
scope module: :boards do
resource :subscriptions
resource :involvement
resource :publication
resource :entropy
namespace :columns do
resource :not_now
resource :stream
resource :closed
end
resources :columns
end
resources :cards, only: :create
resources :webhooks do
scope module: :webhooks do
resource :activation, only: :create
end
end
end
resources :columns, only: [] do
resource :left_position, module: :columns
resource :right_position, module: :columns
end
namespace :columns do
resources :cards do
scope module: :cards do
namespace :drops do
resource :not_now
resource :stream
resource :closure
resource :column
end
end
end
end
namespace :cards do
resources :previews
end
resources :cards do
scope module: :cards do
resource :draft, only: :show
resource :board
resource :closure
resource :column
resource :goldness
resource :image
resource :not_now
resource :pin
resource :publish
resource :reading
resource :triage
resource :watch
resource :reading
resources :reactions
resources :assignments
resource :self_assignment, only: :create
resources :steps
resources :taggings
resources :comments do
resources :reactions, module: :comments
end
end
end
resources :tags, only: :index
namespace :notifications do
resource :settings
resource :unsubscribe
end
resources :notifications do
scope module: :notifications do
get "tray", to: "trays#show", on: :collection
resource :reading
collection do
resource :bulk_reading, only: :create
end
end
end
resource :search
namespace :searches do
resources :queries
end
resources :filters do
scope module: :filters do
collection do
resource :settings_refresh, only: :create
end
end
end
resources :events, only: :index
namespace :events do
resources :days
namespace :day_timeline do
resources :columns, only: :show
end
end
resources :qr_codes
get "join/:code", to: "join_codes#new", as: :join
post "join/:code", to: "join_codes#create"
namespace :users do
resources :joins
resources :verifications, only: %i[ new create ]
end
resource :session do
scope module: :sessions do
resources :transfers
resource :magic_link
resource :menu
end
end
get "/signup", to: redirect("/signup/new")
resource :signup, only: %i[ new create ] do
collection do
scope module: :signups, as: :signup do
resource :completion, only: %i[ new create ]
end
end
end
resource :landing
namespace :my do
resource :identity, only: :show
resources :access_tokens
resources :pins
resource :timezone
resource :menu
end
namespace :prompts do
resources :cards
resources :tags
resources :users
resources :boards do
scope module: :boards do
resources :users
end
end
end
namespace :public do
resources :boards do
scope module: :boards do
namespace :columns do
resource :not_now, only: :show
resource :stream, only: :show
resource :closed, only: :show
end
resources :columns, only: :show
end
resources :cards, only: :show
end
end
direct :published_board do |board, options|
route_for :public_board, board.publication.key
end
direct :published_card do |card, options|
route_for :public_board_card, card.board.publication.key, card
end
resolve "Comment" do |comment, options|
options[:anchor] = ActionView::RecordIdentifier.dom_id(comment)
route_for :card, comment.card, options
end
resolve "Mention" do |mention, options|
polymorphic_url(mention.source, options)
end
resolve "Notification" do |notification, options|
polymorphic_url(notification.notifiable_target, options)
end
resolve "Event" do |event, options|
polymorphic_url(event.eventable, options)
end
resolve "Webhook" do |webhook, options|
route_for :board_webhook, webhook.board, webhook, options
end
# Support for legacy URLs
get "/collections/:collection_id/cards/:id", to: redirect { |params, request| "#{request.script_name}/cards/#{params[:id]}" }
get "/collections/:id", to: redirect { |params, request| "#{request.script_name}/boards/#{params[:id]}" }
get "/public/collections/:id", to: redirect { |params, request| "#{request.script_name}/public/boards/#{params[:id]}" }
get "up", to: "rails/health#show", as: :rails_health_check
get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
get "service-worker" => "pwa#service_worker"
namespace :admin do
mount MissionControl::Jobs::Engine, at: "/jobs"
end
end