Wire up filters for tags and assignees
This commit is contained in:
@@ -14,6 +14,11 @@ class BubblesController < ApplicationController
|
||||
@tag = Current.account.tags.find(params[:tag_id])
|
||||
@bubbles = @bubbles.tagged_with(@tag)
|
||||
end
|
||||
|
||||
if params[:assignee_id]
|
||||
@assignee = @bucket.users.find(params[:assignee_id])
|
||||
@bubbles = @bubbles.assigned_to(@assignee)
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<h1 class="txt-large">
|
||||
<div class="filter" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn btn--plain filter__button" data-action="click->dialog#toggle" data-dialog-modal-value="true">
|
||||
Most active
|
||||
</button>
|
||||
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<li><a href="#" class="filter__button">Most active</a></li>
|
||||
<li><a href="#" class="filter__button">Most discussed</a></li>
|
||||
<li><a href="#" class="filter__button">Most boosted</a></li>
|
||||
<li><a href="#" class="filter__button">Newest</a></li>
|
||||
<li><a href="#" class="filter__button">Oldest</a></li>
|
||||
<li><a href="#" class="filter__button">Popped</a></li>
|
||||
</menu>
|
||||
</dialog>
|
||||
</div>
|
||||
|
||||
in
|
||||
|
||||
<div class="filter" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn btn--plain filter__button" data-action="click->dialog#toggle" data-dialog-modal-value="true">
|
||||
<%= bucket.name %>
|
||||
</button>
|
||||
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<% Current.user.buckets.order(:name).each do |bucket| %>
|
||||
<li><%= link_to bucket.name, bucket_bubbles_path(bucket), class: "filter__button" %></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
</dialog>
|
||||
</div>
|
||||
</h1>
|
||||
|
||||
<h2 class="txt-medium txt-normal margin-none flex align-center gap-half">
|
||||
<%= tag ? "Tagged" : "with" %>
|
||||
|
||||
<div class="filter" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn btn--plain filter__button" data-action="click->dialog#toggle" data-dialog-modal-value="true">
|
||||
<%= tag&.title || "any tag" %>
|
||||
</button>
|
||||
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<% Current.account.tags.order(:title).each do |tag| %>
|
||||
<li><%= link_to tag.title, params.permit(:filter, :assignee_id).merge(tag_id: tag.id) %></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
</dialog>
|
||||
|
||||
<% if tag %>
|
||||
<%= link_to params.permit(:filter, :assignee_id), class: "btn", style: "font-size: 0.4em;" do %>
|
||||
<%= image_tag "remove.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Clear</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
and
|
||||
|
||||
<div class="filter" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn btn--plain filter__button" data-action="click->dialog#toggle" data-dialog-modal-value="true">
|
||||
assigned to <%= assignee&.name || "anyone" %>
|
||||
</button>
|
||||
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<% Current.account.users.order(:name).each do |user| %>
|
||||
<li><%= link_to user.name, params.permit(:filter, :tag_id).merge(assignee_id: user.id) %></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
</dialog>
|
||||
|
||||
<% if assignee %>
|
||||
<%= link_to params.permit(:filter, :tag_id), class: "btn", style: "font-size: 0.4em;" do %>
|
||||
<%= image_tag "remove.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Clear</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</h2>
|
||||
@@ -8,88 +8,7 @@
|
||||
<% end %>
|
||||
|
||||
<header class="txt-align-center">
|
||||
<h1 class="txt-large">
|
||||
<div class="filter" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn btn--plain filter__button"
|
||||
data-action="click->dialog#toggle"
|
||||
data-dialog-modal-value="true">Most active</button>
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<li><button class="btn btn--plain filter__button">Most active</button></li>
|
||||
<li><button class="btn btn--plain filter__button">Most discussed</button></li>
|
||||
<li><button class="btn btn--plain filter__button">Most boosted</button></li>
|
||||
<li><button class="btn btn--plain filter__button">Newest</button></li>
|
||||
<li><button class="btn btn--plain filter__button">Oldest</button></li>
|
||||
<li><button class="btn btn--plain filter__button">Popped</button></li>
|
||||
</menu>
|
||||
</dialog>
|
||||
</div>
|
||||
in
|
||||
<div class="filter" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn btn--plain filter__button"
|
||||
data-action="click->dialog#toggle"
|
||||
data-dialog-modal-value="true"><%= @bucket.name %></button>
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<% Current.user.buckets.order(:name).each do |bucket| %>
|
||||
<li><button class="btn btn--plain filter__button"><%= bucket.name %></button></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
</dialog>
|
||||
</div>
|
||||
</h1>
|
||||
|
||||
<h2 class="txt-medium txt-normal margin-none flex align-center gap-half">
|
||||
<% if @tag %>
|
||||
Tagged
|
||||
|
||||
<div class="filter" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn btn--plain filter__button"
|
||||
data-action="click->dialog#toggle"
|
||||
data-dialog-modal-value="true"><%= @tag.title %></button>
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<% Current.account.tags.order(:title).each do |tag| %>
|
||||
<li><button class="btn btn--plain filter__button"><%= tag.title %></button></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
</dialog>
|
||||
</div>
|
||||
|
||||
<%= link_to bucket_bubbles_path(@bucket), class: "btn", style: "font-size: 0.4em;" do %>
|
||||
<%= image_tag "remove.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Clear</span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
with
|
||||
|
||||
<div class="filter" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn btn--plain filter__button"
|
||||
data-action="click->dialog#toggle"
|
||||
data-dialog-modal-value="true">any tag</button>
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<% Current.account.tags.order(:title).each do |tag| %>
|
||||
<li><button class="btn btn--plain filter__button"><%= tag.title %></button></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
</dialog>
|
||||
</div>
|
||||
<% end %>
|
||||
and
|
||||
<div class="filter" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn btn--plain filter__button"
|
||||
data-action="click->dialog#toggle"
|
||||
data-dialog-modal-value="true">assigned to anyone</button>
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<% Current.account.users.order(:name).each do |user| %>
|
||||
<li><button class="btn btn--plain filter__button"><%= user.name %></button></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
</dialog>
|
||||
</div>
|
||||
</h2>
|
||||
<%= render "bubbles/filters", bucket: @bucket, tag: @tag, assignee: @assignee %>
|
||||
</header>
|
||||
|
||||
<%= button_to bucket_bubbles_path(@bucket), method: :post, class: "btn btn--plain", form_class: "flex-item-justify-end" do %>
|
||||
@@ -107,6 +26,9 @@
|
||||
<header class="flex-inline align-center center gap txt-small margin-block-end-half">
|
||||
<form>
|
||||
<input type="search" name="filter" class="input center flex-inline" placeholder="Type to filter…" value="<%= params[:filter] %>">
|
||||
<% params.permit(:tag_id, :assignee_id).each do |name, value| %>
|
||||
<%= hidden_field_tag name, value %>
|
||||
<% end %>
|
||||
</form>
|
||||
</header>
|
||||
|
||||
|
||||
+1
-35
@@ -22,42 +22,8 @@
|
||||
89
|
||||
],
|
||||
"note": ""
|
||||
},
|
||||
{
|
||||
"warning_type": "Dynamic Render Path",
|
||||
"warning_code": 15,
|
||||
"fingerprint": "95ded3afec947789921bb5e8ce5d29bd8b2e1a7be03623ecd8810051769ef72d",
|
||||
"check_name": "Render",
|
||||
"message": "Render path contains parameter value",
|
||||
"file": "app/views/bubbles/index.html.erb",
|
||||
"line": 103,
|
||||
"link": "https://brakemanscanner.org/docs/warning_types/dynamic_render_path/",
|
||||
"code": "render(action => @bucket.bubbles.not_popped.reverse_chronologically.mentioning(params[:filter]).ordered_by_activity.limit(10).tagged_with(Current.account.tags.find(params[:tag_id])), {})",
|
||||
"render_path": [
|
||||
{
|
||||
"type": "controller",
|
||||
"class": "BubblesController",
|
||||
"method": "index",
|
||||
"line": 16,
|
||||
"file": "app/controllers/bubbles_controller.rb",
|
||||
"rendered": {
|
||||
"name": "bubbles/index",
|
||||
"file": "app/views/bubbles/index.html.erb"
|
||||
}
|
||||
}
|
||||
],
|
||||
"location": {
|
||||
"type": "template",
|
||||
"template": "bubbles/index"
|
||||
},
|
||||
"user_input": "params[:tag_id]",
|
||||
"confidence": "Weak",
|
||||
"cwe_id": [
|
||||
22
|
||||
],
|
||||
"note": ""
|
||||
}
|
||||
],
|
||||
"updated": "2024-10-03 16:25:56 +0100",
|
||||
"updated": "2024-10-03 15:28:53 -0400",
|
||||
"brakeman_version": "6.2.1"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user