Remove swapping
This commit is contained in:
@@ -130,10 +130,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
&:focus-within {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
border-radius: var(--bubble-shape);
|
||||
}
|
||||
|
||||
@@ -18,16 +18,3 @@
|
||||
background-color: var(--color-ink-reversed);
|
||||
}
|
||||
}
|
||||
|
||||
.bubble__meta {
|
||||
.hw-combobox {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: -0.25rem;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.hw-combobox__main__wrapper {
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
class Assignments::SwapsController < ApplicationController
|
||||
include BubbleScoped, BucketScoped
|
||||
|
||||
def create
|
||||
@bubble.swap_assignment incoming_assignee, outgoing_assignee
|
||||
redirect_to @bubble
|
||||
end
|
||||
|
||||
private
|
||||
def incoming_assignee
|
||||
@bucket.users.active.find params.expect(:incoming_assignee_id)
|
||||
end
|
||||
|
||||
def outgoing_assignee
|
||||
@bucket.users.active.find params.expect(:outgoing_assignee_id)
|
||||
end
|
||||
end
|
||||
@@ -1,21 +0,0 @@
|
||||
class Taggings::SwapsController < ApplicationController
|
||||
include BubbleScoped, BucketScoped
|
||||
|
||||
def create
|
||||
@bubble.swap_tag incoming_tag, outgoing_tag
|
||||
redirect_to @bubble
|
||||
end
|
||||
|
||||
private
|
||||
def incoming_tag
|
||||
if params[:incoming_tag_title]
|
||||
Tag.new title: params[:incoming_tag_title]
|
||||
else
|
||||
Current.account.tags.find params.expect(:incoming_tag_id)
|
||||
end
|
||||
end
|
||||
|
||||
def outgoing_tag
|
||||
Current.account.tags.find params.expect(:outgoing_tag_id)
|
||||
end
|
||||
end
|
||||
@@ -22,13 +22,6 @@ module Bubble::Assignable
|
||||
track_event :unassigned, assignee_ids: [ user.id ] if destructions.any?
|
||||
end
|
||||
|
||||
def swap_assignment(incoming, outgoing)
|
||||
transaction do
|
||||
unassign outgoing
|
||||
assign incoming unless incoming == outgoing
|
||||
end
|
||||
end
|
||||
|
||||
def toggle_assignment(user)
|
||||
assigned_to?(user) ? unassign(user) : assign(user)
|
||||
end
|
||||
|
||||
@@ -18,13 +18,6 @@ module Bubble::Taggable
|
||||
taggings.destroy_by tag: tag
|
||||
end
|
||||
|
||||
def swap_tag(incoming, outgoing)
|
||||
transaction do
|
||||
untag outgoing
|
||||
tag incoming unless incoming == outgoing
|
||||
end
|
||||
end
|
||||
|
||||
def toggle_tag(tag)
|
||||
tagged_with?(tag) ? untag(tag) : tag(tag)
|
||||
end
|
||||
|
||||
@@ -29,12 +29,10 @@ Rails.application.routes.draw do
|
||||
end
|
||||
|
||||
namespace :assignments, as: :assignment do
|
||||
resources :swaps
|
||||
resources :toggles
|
||||
end
|
||||
|
||||
namespace :taggings, as: :tagging do
|
||||
resources :swaps
|
||||
resources :toggles
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
require "test_helper"
|
||||
|
||||
class Assignments::SwapsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "swap with same user" do
|
||||
assert_changes "bubbles(:logo).assigned_to?(users(:kevin))", from: true, to: false do
|
||||
post bucket_bubble_assignment_swaps_url(buckets(:writebook), bubbles(:logo)), params: {
|
||||
incoming_assignee_id: users(:kevin).id,
|
||||
outgoing_assignee_id: users(:kevin).id
|
||||
}
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
|
||||
test "swap with another user" do
|
||||
assert_changes "bubbles(:logo).assigned_to?(users(:david))", from: false, to: true do
|
||||
assert_changes "bubbles(:logo).assigned_to?(users(:kevin))", from: true, to: false do
|
||||
post bucket_bubble_assignment_swaps_url(buckets(:writebook), bubbles(:logo)), params: {
|
||||
incoming_assignee_id: users(:david).id,
|
||||
outgoing_assignee_id: users(:kevin).id
|
||||
}
|
||||
end
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
|
||||
test "swap with another user when already assigned" do
|
||||
assert_no_changes "bubbles(:logo).assigned_to?(users(:jz))" do
|
||||
assert_changes "bubbles(:logo).assigned_to?(users(:kevin))", from: true, to: false do
|
||||
post bucket_bubble_assignment_swaps_url(buckets(:writebook), bubbles(:logo)), params: {
|
||||
incoming_assignee_id: users(:jz).id,
|
||||
outgoing_assignee_id: users(:kevin).id
|
||||
}
|
||||
end
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
end
|
||||
@@ -1,41 +0,0 @@
|
||||
require "test_helper"
|
||||
|
||||
class Taggings::SwapsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "swap with same tag" do
|
||||
assert_changes "bubbles(:logo).tagged_with?(tags(:web))", from: true, to: false do
|
||||
post bucket_bubble_tagging_swaps_url(buckets(:writebook), bubbles(:logo)), params: {
|
||||
incoming_tag_id: tags(:web).id,
|
||||
outgoing_tag_id: tags(:web).id
|
||||
}
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
|
||||
test "swap with another tag" do
|
||||
assert_changes "bubbles(:logo).tagged_with?(tags(:mobile))", from: false, to: true do
|
||||
assert_changes "bubbles(:logo).tagged_with?(tags(:web))", from: true, to: false do
|
||||
post bucket_bubble_tagging_swaps_url(buckets(:writebook), bubbles(:logo)), params: {
|
||||
incoming_tag_id: tags(:mobile).id,
|
||||
outgoing_tag_id: tags(:web).id
|
||||
}
|
||||
end
|
||||
end
|
||||
assert_redirected_to bubbles(:logo)
|
||||
end
|
||||
|
||||
test "swap with another tag when already tagged" do
|
||||
assert_no_changes "bubbles(:layout).tagged_with?(tags(:mobile))" do
|
||||
assert_changes "bubbles(:layout).tagged_with?(tags(:web))", from: true, to: false do
|
||||
post bucket_bubble_tagging_swaps_url(buckets(:writebook), bubbles(:layout)), params: {
|
||||
incoming_tag_id: tags(:mobile).id,
|
||||
outgoing_tag_id: tags(:web).id
|
||||
}
|
||||
end
|
||||
end
|
||||
assert_redirected_to bubbles(:layout)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user