Get rid of odd toggles concept

This is just assignments.
This commit is contained in:
David Heinemeier Hansson
2025-04-05 14:16:04 +02:00
parent f063116df4
commit 384de24132
6 changed files with 29 additions and 31 deletions
@@ -1,4 +1,4 @@
class Assignments::TogglesController < ApplicationController
class AssignmentsController < ApplicationController
include BubbleScoped, BucketScoped
def new
+1 -1
View File
@@ -3,7 +3,7 @@
<dialog class="popup panel flex-column align-start gap-half fill-white shadow" data-dialog-target="dialog">
<strong class="popup__title margin-block-start-half pad-inline-half txt-nowrap">Assign this to…</strong>
<%= form_with url: bucket_bubble_assignment_toggles_path(bubble.bucket, bubble), class: "flex flex-column full-width popup__list", data: { controller: "form" } do |form| %>
<%= form_with url: bucket_bubble_assignments_path(bubble.bucket, bubble), class: "flex flex-column full-width popup__list", data: { controller: "form" } do |form| %>
<% bubble.bucket.users.active.sort_by(&:name).each do |user| %>
<div class="btn popup__item">
<%= form.check_box "assignee_id[]", {
@@ -1,3 +1,3 @@
<%= render "bubbles/cards/common/assignees", bubble: bubble do %>
<%= turbo_frame_tag bubble, :assignment, src: new_bucket_bubble_assignment_toggle_path(bubble.bucket, bubble) %>
<%= turbo_frame_tag bubble, :assignment, src: new_bucket_bubble_assignment_path(bubble.bucket, bubble) %>
<% end %>
+1 -3
View File
@@ -57,9 +57,7 @@ Rails.application.routes.draw do
resource :pin, only: [ :show, :create, :destroy ]
end
namespace :assignments, as: :assignment do
resources :toggles
end
resources :assignments
namespace :taggings, as: :tagging do
resources :toggles
@@ -1,25 +0,0 @@
require "test_helper"
class Assignments::TogglesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :kevin
end
test "new" do
get new_bucket_bubble_assignment_toggle_url(buckets(:writebook), bubbles(:logo))
assert_response :success
end
test "create" do
assert_changes "bubbles(:logo).assigned_to?(users(:david))", from: false, to: true do
post bucket_bubble_assignment_toggles_url(buckets(:writebook), bubbles(:logo)), params: { assignee_id: users(:david).id }, as: :turbo_stream
end
assert_response :success
assert_changes "bubbles(:logo).assigned_to?(users(:david))", from: true, to: false do
post bucket_bubble_assignment_toggles_url(buckets(:writebook), bubbles(:logo)), params: { assignee_id: users(:kevin).id }, as: :turbo_stream
end
assert_response :success
end
end
@@ -0,0 +1,25 @@
require "test_helper"
class AssignmentsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :kevin
end
test "new" do
get new_bucket_bubble_assignment_url(buckets(:writebook), bubbles(:logo))
assert_response :success
end
test "create" do
assert_changes "bubbles(:logo).assigned_to?(users(:david))", from: false, to: true do
post bucket_bubble_assignments_url(buckets(:writebook), bubbles(:logo)), params: { assignee_id: users(:david).id }, as: :turbo_stream
end
assert_response :success
assert_changes "bubbles(:logo).assigned_to?(users(:david))", from: true, to: false do
post bucket_bubble_assignments_url(buckets(:writebook), bubbles(:logo)), params: { assignee_id: users(:kevin).id }, as: :turbo_stream
end
assert_response :success
end
end