Do combobox filtering client-side
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
class Bubbles::TagsController < ApplicationController
|
||||
include BubbleScoped, BucketScoped
|
||||
|
||||
def index
|
||||
@tags = Current.account.tags.search params[:q]
|
||||
end
|
||||
end
|
||||
@@ -1,7 +0,0 @@
|
||||
class Bubbles::UsersController < ApplicationController
|
||||
include BubbleScoped, BucketScoped
|
||||
|
||||
def index
|
||||
@users = @bucket.users.active.search params[:q]
|
||||
end
|
||||
end
|
||||
@@ -6,8 +6,6 @@ class Tag < ApplicationRecord
|
||||
has_many :taggings, dependent: :destroy
|
||||
has_many :bubbles, through: :taggings
|
||||
|
||||
scope :search, ->(query) { where "title LIKE ?", "%#{query}%" }
|
||||
|
||||
def hashtag
|
||||
"#" + title
|
||||
end
|
||||
|
||||
@@ -23,7 +23,6 @@ class User < ApplicationRecord
|
||||
|
||||
scope :active, -> { where(active: true) }
|
||||
scope :alphabetically, -> { order("LOWER(name)") }
|
||||
scope :search, ->(query) { where "name LIKE ?", "%#{query}%" }
|
||||
|
||||
def initials
|
||||
name.to_s.scan(/\b\p{L}/).join.upcase
|
||||
|
||||
@@ -23,47 +23,8 @@
|
||||
</label>
|
||||
<% end %>
|
||||
|
||||
<%= render "bubbles/sidebar/assignment", bubble: @bubble %>
|
||||
<%= render "bubbles/sidebar/tag", bubble: @bubble %>
|
||||
|
||||
<%= form_with url: "/", 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…</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 %>
|
||||
|
||||
<div class="position-relative" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn full-width justify-start borderless" data-action="dialog#toggle">
|
||||
<%= image_tag "tag.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span>Tags</span>
|
||||
</button>
|
||||
|
||||
<dialog class="tag-picker panel fill-white shadow gap-half align-center" data-dialog-target="dialog" data-action="keydown.esc->dialog#close click@document->dialog#closeOnClickOutside">
|
||||
<%= image_tag "tag.svg", aria: { hidden: true }, size: 24 %>
|
||||
|
||||
<%= form_with model: Tag.new, url: bucket_bubble_tags_path(@bubble.bucket, @bubble), class: "min-width flex-item-grow", data: { turbo_frame: "_top" } do |form| %>
|
||||
<%= form.text_field :title, class: "input", autofocus: "on", list: "tags-list" %>
|
||||
<%= form.submit "Create Tag", hidden: true %>
|
||||
|
||||
<datalist id="tags-list">
|
||||
<%= Current.account.tags.each do |tag| %>
|
||||
<option value="<%= tag.title %>"></option>
|
||||
<% end %>
|
||||
</datalist>
|
||||
<% end %>
|
||||
|
||||
<form method="dialog">
|
||||
<button class="btn txt-small" title="Close (esc)">
|
||||
<%= image_tag "remove.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Close</span>
|
||||
</button>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
<%= render "bubbles/sidebar/assignment", bubble: @bubble, users: @bucket.users.active %>
|
||||
<%= render "bubbles/sidebar/tag", bubble: @bubble, tags: Current.account.tags %>
|
||||
|
||||
<% if @bubble.image.attached? %>
|
||||
<%= button_to bucket_bubble_image_path(@bubble.bucket, @bubble), method: :delete, class: "btn full-width justify-start borderless" do %>
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
</summary>
|
||||
|
||||
<%= form_with url: bucket_bubble_assignment_toggles_path(bubble.bucket, bubble), data: { controller: "form" } do |form| %>
|
||||
<%= form.combobox :assignee_id, bucket_bubble_users_path(bubble.bucket, bubble), required: true, preload: true,
|
||||
<%= form.combobox :assignee_id, users, required: true, preload: true,
|
||||
render_in: { partial: "bubbles/users/select_option", as: :user, locals: { bubble: bubble } },
|
||||
data: { controller: "autofocus", action: "hw-combobox:selection->form#submit" } %>
|
||||
<% end %>
|
||||
</details>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
</summary>
|
||||
|
||||
<%= form_with url: bucket_bubble_tagging_toggles_path(bubble.bucket, bubble), data: { controller: "form" } do |form| %>
|
||||
<%= form.combobox :tag_id, bucket_bubble_tags_path(bubble.bucket, bubble),
|
||||
required: true, preload: true, name_when_new: "tag_title",
|
||||
<%= form.combobox :tag_id, tags, required: true, preload: true, name_when_new: "tag_title",
|
||||
render_in: { partial: "bubbles/tags/select_option", as: :tag, locals: { bubble: bubble } },
|
||||
data: { controller: "autofocus", action: "hw-combobox:selection->form#submit" } %>
|
||||
<% end %>
|
||||
</details>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<%= async_combobox_options @tags, render_in: { partial: "bubbles/tags/select_option", as: :tag, locals: { bubble: @bubble } } %>
|
||||
@@ -1 +0,0 @@
|
||||
<%= async_combobox_options @users, render_in: { partial: "bubbles/users/select_option", as: :user, locals: { bubble: @bubble } } %>
|
||||
@@ -24,8 +24,6 @@ Rails.application.routes.draw do
|
||||
resource :pop
|
||||
resource :stage_picker
|
||||
resources :stagings
|
||||
resources :tags
|
||||
resources :users
|
||||
end
|
||||
|
||||
namespace :assignments, as: :assignment do
|
||||
|
||||
Reference in New Issue
Block a user