Remove the buckets#index action and view
and have bucket#destroy redirect to root_path
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
class BucketsController < ApplicationController
|
||||
before_action :set_bucket, except: %i[ index new create ]
|
||||
|
||||
def index
|
||||
@filters = Current.user.filters.all
|
||||
@buckets = Current.user.buckets.all
|
||||
end
|
||||
before_action :set_bucket, except: %i[ new create ]
|
||||
|
||||
def new
|
||||
@bucket = Current.account.buckets.build
|
||||
@@ -29,7 +24,7 @@ class BucketsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
@bucket.destroy
|
||||
redirect_to buckets_path
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<% @page_title = "Collections" %>
|
||||
|
||||
<% content_for :header do %>
|
||||
<nav class="align-start">
|
||||
<%= link_to account_users_path, class: "btn borderless flex-item-justify-start" do %>
|
||||
<%= image_tag "settings.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Account settings</span>
|
||||
<% end %>
|
||||
|
||||
<header class="flex flex-column center">
|
||||
<div class="flex align-center gap-half justify-center">
|
||||
<%= link_to "Collections", root_path %>
|
||||
<%= link_to "Activity", root_path %>
|
||||
</div>
|
||||
<h1 class="txt-x-large"><%= @page_title %></h1>
|
||||
</header>
|
||||
|
||||
<%= link_to new_bucket_path, class: "btn flex-item-justify-end borderless", style: "view-transition-name: new-bucket" do %>
|
||||
<%= image_tag "add.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Add a new project</span>
|
||||
<% end %>
|
||||
</nav>
|
||||
<% end %>
|
||||
|
||||
<ul class="buckets margin-block-double unpad align-start justify-center flex flex-wrap gap" data-controller="bubble-size">
|
||||
<%= render @buckets, cached: true %>
|
||||
</ul>
|
||||
<ul class="buckets margin-block-double unpad align-start justify-center flex flex-wrap gap" data-controller="bubble-size">
|
||||
<%= render @filters %>
|
||||
</ul>
|
||||
@@ -5,11 +5,6 @@ class BucketsControllerTest < ActionDispatch::IntegrationTest
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "index" do
|
||||
get buckets_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "new" do
|
||||
get new_bucket_url
|
||||
assert_response :success
|
||||
@@ -56,7 +51,7 @@ class BucketsControllerTest < ActionDispatch::IntegrationTest
|
||||
test "destroy" do
|
||||
assert_difference -> { Bucket.count }, -1 do
|
||||
delete bucket_url(buckets(:writebook))
|
||||
assert_redirected_to buckets_url
|
||||
assert_redirected_to root_url
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user