Tighten assignment flow

This commit is contained in:
Jason Zimdars
2024-11-14 12:22:30 -06:00
parent 0ff0291c18
commit ba861544fc
5 changed files with 13 additions and 33 deletions
@@ -9,7 +9,7 @@ class Bubbles::AssignmentsController < ApplicationController
def create
@bubble.assign(find_assignee)
render :show
redirect_to @bubble
end
private
+1 -10
View File
@@ -24,16 +24,7 @@ class BubblesController < ApplicationController
def update
@bubble.update! bubble_params
if turbo_frame_request?
if params[:bubble][:assignee_ids].present?
render "bubbles/assignments/show"
else
render :show
end
else
redirect_to @bubble
end
redirect_to @bubble
end
private
@@ -1,14 +0,0 @@
<%= turbo_frame_tag dom_id(@bubble, :assignments) do %>
<%= form_with url: bucket_bubble_assignments_path(@bubble.bucket, @bubble), data: { controller: "form" } do |form| %>
<div class="bubble__bubble bubble__meta bubble__assignee bubble__assignments--new">
<label class="btn btn--plain position-relative fill-transparent" style="<%= "--btn-icon-size: 2em;" unless @bubble.assignees.any? %>">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 17" fill="var(--bubble-color)"><path d="m11.5 10.3-.6-.2c-.2-.5-.3-1.1-.1-1.6 1.1-1.2 1.6-2.7 1.5-4.3 0-2.4-1.6-4.2-3.8-4.2S4.7 1.8 4.7 4.2c-.1 1.5.4 3.1 1.5 4.3.2.5.2 1.1-.1 1.6l-.6.2c-2.4.9-4.2 1.5-4.8 2.6-.4 1.2-.7 2.4-.7 3.6 0 .3.2.5.5.5h16c.3 0 .5-.2.5-.5 0-1.2-.3-2.4-.7-3.5-.6-1.1-2.4-1.8-4.8-2.7"/></svg>
<%= form.collection_select :assignee_id, @bubble.bucket.users.active, :id, :name, { prompt: "Assign to…", selected: @bubble.assignees.pluck(:id) },
class: "input input--hidden txt-medium",
data: { action: "change->form#submit click->form#showPicker" } %>
<span class="for-screen-reader">Assign to…</span>
</label>
<%= form.submit "Save", class: "btn", hidden: true %>
</div>
<% end %>
<% end %>
+1 -3
View File
@@ -1,7 +1,7 @@
<%= turbo_frame_tag dom_id(@bubble, :assignments) do %>
<% if @bubble.assignments.any? %>
<div class="bubble__bubble bubble__meta bubble__assignee">
<%= form_with url: bucket_bubble_assignments_path(@bubble.bucket, @bubble), data: { controller: "form" } do |form| %>
<%= form_with url: bucket_bubble_assignments_path(@bubble.bucket, @bubble), data: { controller: "form", turbo_frame: "_top" } do |form| %>
<label class="btn btn--plain position-relative fill-transparent" style="<%= "--btn-icon-size: 2em;" unless @bubble.assignees.any? %>">
<% if @bubble.assignees.any? %>
<% if @bubble.assignees.many? %>
@@ -20,8 +20,6 @@
data: { action: "change->form#submit click->form#showPicker" } %>
<span class="for-screen-reader">Assign to…</span>
</label>
<%= form.submit "Save", class: "btn", hidden: true %>
<% end %>
</div>
<% end %>
+10 -5
View File
@@ -25,12 +25,17 @@
</label>
<% end %>
<%= link_to new_bucket_bubble_assignments_path(@bubble.bucket, @bubble),
class: "btn full-width justify-start borderless",
data: { turbo_frame: dom_id(@bubble, :assignments) } do %>
<%= image_tag "person.svg", aria: { hidden: true }, size: 24 %>
<span>Assign to someone</span>
<%= form_with url: bucket_bubble_assignments_path(@bubble.bucket, @bubble), data: { controller: "form" } do |form| %>
<label class="btn full-width justify-start borderless">
<%= image_tag "person.svg", aria: { hidden: true }, size: 24 %>
<span>Assign to someone</span>
<%= form.collection_select :assignee_id, @bubble.bucket.users.active, :id, :name, { prompt: "Assign to…", selected: @bubble.assignees.pluck(:id) },
class: "input input--hidden txt-medium",
data: { action: "change->form#submit click->form#showPicker" } %>
</label>
<% end %>
<%= bubble_action_button('new-tag', 'tag', 'Tag this') %>
<%= bubble_action_button('new-attachment', 'picture-add', 'Attach a file') %>
<%= bubble_action_button('new-boost', 'thumb-up', 'Boost this') %>