From 7494dad91ed57663c64b529574ff485f5a040dc5 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 5 Apr 2025 14:20:06 +0200 Subject: [PATCH] Drop the toggles scope for taggings as well --- .../toggles_controller.rb => taggings_controller.rb} | 2 +- app/views/bubbles/_tagging.html.erb | 4 ++-- app/views/bubbles/cards/perma/_tags.html.erb | 2 +- config/routes.rb | 5 +---- ...es_controller_test.rb => taggings_controller_test.rb} | 9 ++++----- 5 files changed, 9 insertions(+), 13 deletions(-) rename app/controllers/{taggings/toggles_controller.rb => taggings_controller.rb} (94%) rename test/controllers/{taggings/toggles_controller_test.rb => taggings_controller_test.rb} (53%) diff --git a/app/controllers/taggings/toggles_controller.rb b/app/controllers/taggings_controller.rb similarity index 94% rename from app/controllers/taggings/toggles_controller.rb rename to app/controllers/taggings_controller.rb index d768c4cc7..629f4fb7a 100644 --- a/app/controllers/taggings/toggles_controller.rb +++ b/app/controllers/taggings_controller.rb @@ -1,4 +1,4 @@ -class Taggings::TogglesController < ApplicationController +class TaggingsController < ApplicationController include BubbleScoped, BucketScoped def new diff --git a/app/views/bubbles/_tagging.html.erb b/app/views/bubbles/_tagging.html.erb index e37696cc2..466f46121 100644 --- a/app/views/bubbles/_tagging.html.erb +++ b/app/views/bubbles/_tagging.html.erb @@ -3,7 +3,7 @@ Tag this… - <%= form_with url: bucket_bubble_tagging_toggles_path(bubble.bucket, bubble), class: "flex gap-half align-center full-width pad-inline-half margin-block-end" do |form| %> + <%= form_with url: bucket_bubble_taggings_path(bubble.bucket, bubble), class: "flex gap-half align-center full-width pad-inline-half margin-block-end" do |form| %> <%= form.text_field :tag_title, placeholder: "New tag name...", class: "input txt-small full-width" %> <%= form.button "Add a tag…", type: "submit", class: "btn txt-small" do %> <%= icon_tag "add" %> @@ -11,7 +11,7 @@ <% end %> <% end %> - <%= form_with url: bucket_bubble_tagging_toggles_path(bubble.bucket, bubble), class: "flex flex-column full-width popup__list", data: { controller: "form" } do |form| %> + <%= form_with url: bucket_bubble_taggings_path(bubble.bucket, bubble), class: "flex flex-column full-width popup__list", data: { controller: "form" } do |form| %> <% tags.sort_by { |tag| tag.hashtag.downcase }.each do |tag| %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index bd3e3b4d3..b4099406f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -58,10 +58,7 @@ Rails.application.routes.draw do end resources :assignments - - namespace :taggings, as: :tagging do - resources :toggles - end + resources :taggings end end diff --git a/test/controllers/taggings/toggles_controller_test.rb b/test/controllers/taggings_controller_test.rb similarity index 53% rename from test/controllers/taggings/toggles_controller_test.rb rename to test/controllers/taggings_controller_test.rb index 4d54086ad..547a137be 100644 --- a/test/controllers/taggings/toggles_controller_test.rb +++ b/test/controllers/taggings_controller_test.rb @@ -1,25 +1,24 @@ require "test_helper" -class Taggings::TogglesControllerTest < ActionDispatch::IntegrationTest +class TaggingsControllerTest < ActionDispatch::IntegrationTest setup do sign_in_as :kevin end test "new" do - get new_bucket_bubble_tagging_toggle_url(buckets(:writebook), bubbles(:logo)) - + get new_bucket_bubble_tagging_url(buckets(:writebook), bubbles(:logo)) assert_response :success end test "create" do assert_changes "bubbles(:logo).tagged_with?(tags(:mobile))", from: false, to: true do - post bucket_bubble_tagging_toggles_url(buckets(:writebook), bubbles(:logo)), params: { tag_id: tags(:mobile).id }, as: :turbo_stream + post bucket_bubble_taggings_url(buckets(:writebook), bubbles(:logo)), params: { tag_id: tags(:mobile).id }, as: :turbo_stream end assert_response :success assert_changes "bubbles(:logo).tagged_with?(tags(:web))", from: false, to: true do assert_changes "bubbles(:logo).tagged_with?(tags(:mobile))", from: true, to: false do - post bucket_bubble_tagging_toggles_url(buckets(:writebook), bubbles(:logo)), params: { tag_id: tags(:web).id }, as: :turbo_stream + post bucket_bubble_taggings_url(buckets(:writebook), bubbles(:logo)), params: { tag_id: tags(:web).id }, as: :turbo_stream end end assert_response :success