Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/go 368 filters #249

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
473af6d
Pass filter via url params and tweak message threads table title base…
alhafoudh Dec 11, 2023
914d2fb
Tweak title text
alhafoudh Dec 11, 2023
0a03182
Implement pinning and unpinning filters in sidebar
alhafoudh Dec 11, 2023
a6b44f0
Remove dependency on tailwindcss-scoped-groups since it is a native t…
alhafoudh Dec 12, 2023
be94fbe
Implement filter sorting
alhafoudh Dec 13, 2023
d8e29ff
Replace bars icon with grip icon
alhafoudh Dec 13, 2023
5b0b7a3
Tweak styles
alhafoudh Jan 4, 2024
2fcbce2
Merge branch 'main' into feature/GO-368-filters
alhafoudh Jan 4, 2024
8d1e4e9
Fix FlashComponent renamed namespace
alhafoudh Jan 4, 2024
8bfd59d
Update schema.rb and tenant.rb annotation
alhafoudh Jan 4, 2024
44d03c7
User visibility settings for Tags, Filters v1
stage-rl Jan 8, 2024
f6108e5
Merge branch 'main' into feature/GO-368-filters
alhafoudh Feb 28, 2024
3281e2e
Resolve merge conflict
alhafoudh Feb 28, 2024
34e344b
Merge branch 'feature/tags_user_visibility_settings' into feature/GO-…
alhafoudh Feb 28, 2024
a11f431
Fix db schema
alhafoudh Feb 28, 2024
9a6425f
Fix wrong merge
alhafoudh Feb 28, 2024
d07a6a0
Merge branch 'refs/heads/main' into feature/GO-368-filters
alhafoudh May 23, 2024
8bcf810
Remove pinning from sidebar
alhafoudh May 23, 2024
adf8361
Tweak sidebar for filter list
alhafoudh May 23, 2024
ef6105c
Rename visibility model to UserItemVisibility and add reordering
alhafoudh May 23, 2024
87c0bd8
Reorganize filtering and enable TagFilter usage
alhafoudh Jun 24, 2024
7cc6801
Make first filter default
alhafoudh Jul 6, 2024
3783ec4
Redirect to default filter and fix active sidebar item tracking
alhafoudh Jul 6, 2024
5935dd4
Add buttons with icons for up down
alhafoudh Jul 6, 2024
cf6ebfa
Make Filter author nullable
alhafoudh Sep 10, 2024
6c4313f
Remove binding.pry
alhafoudh Sep 10, 2024
6a69302
Merge branch 'main' into feature/GO-368-filters
Sep 13, 2024
41f947a
Update filters and tags views, forms, icons, ..
Sep 13, 2024
ab4b919
Refactor routes
Sep 13, 2024
6afd341
Update filter editable scope
Sep 16, 2024
01240ec
Fix filter fixtures
Sep 16, 2024
c845d7b
FGRA-9973: Update tests
Sep 16, 2024
715141c
Update filters creation, scope, components
Sep 20, 2024
15dfcdd
Update tests
Sep 20, 2024
901e018
Try fix random failing notifications_test
Sep 20, 2024
25c6d2a
Merge branch 'main' into feature/GO-368-filters
Sep 20, 2024
d0bf118
Change default_max_wait_time for Capybara
Sep 20, 2024
699fc2f
Update notifications_test
Sep 20, 2024
6f5ba24
Fix migration and filtering by tag filters
Sep 25, 2024
29cc358
Remove is_pinned from filters
Sep 25, 2024
0776ad3
Refactoring after review
Sep 30, 2024
84646a6
Refactoring after review
Nov 15, 2024
21ef1b7
Merge branch 'main' into feature/GO-368-filters
Nov 17, 2024
8824a1f
Basic fix
Nov 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ gem 'jwt'
gem 'stimulus-rails'
gem 'jsbundling-rails'
gem 'pdf-reader'
gem "acts_as_list"
gem 'grover'

# Monitoring
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ GEM
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
acts_as_list (1.1.0)
activerecord (>= 4.2)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
afm (0.2.2)
Expand Down Expand Up @@ -508,6 +510,7 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
acts_as_list
annotate
bootsnap (>= 1.4.4)
brakeman
Expand Down
10 changes: 8 additions & 2 deletions app/components/common/icon_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="<%= @stroke_width %>" stroke="currentColor" class="shrink-0 <%= @classes.present? ? @classes : "w-6 h-6" %>">
<path stroke-linecap="round" stroke-linejoin="round" d="<%= @svg %>" />
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="<%= @stroke_width %>" stroke="currentColor" class="shrink-0 <%= @classes.presence || "w-6 h-6" %>">
<% if @svg.class == Array %>
<% @svg.each do |svg| %>
<path stroke-linecap="round" stroke-linejoin="round" d="<%= svg %>" />
<% end %>
<% else %>
<path stroke-linecap="round" stroke-linejoin="round" d="<%= @svg %>" />
<% end %>
</svg>
3 changes: 3 additions & 0 deletions app/components/common/icon_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ class IconComponent < ViewComponent::Base
"bell-slash" => "M9.143 17.082a24.248 24.248 0 003.844.148m-3.844-.148a23.856 23.856 0 01-5.455-1.31 8.964 8.964 0 002.3-5.542m3.155 6.852a3 3 0 005.667 1.97m1.965-2.277L21 21m-4.225-4.225a23.81 23.81 0 003.536-1.003A8.967 8.967 0 0118 9.75V9A6 6 0 006.53 6.53m10.245 10.245L6.53 6.53M3 3l3.53 3.53",
"chat-bubble-left-right" => "M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 01-.825-.242m9.345-8.334a2.126 2.126 0 00-.476-.095 48.64 48.64 0 00-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0011.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155",
"chevron-down" => "m19.5 8.25-7.5 7.5-7.5-7.5",
"chevron-up" => "M4.5 15.75l7.5-7.5 7.5 7.5",
"archive-box" => "M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z",
"archive-box-x-mark" => "m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z",
"trash" => "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0",
"shield-check" => "M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z",
"exclamation-triangle" => "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z",
"clock" => "M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z",
"cloud-arrow-down" => "M12 9.75v6.75m0 0-3-3m3 3 3-3m-8.25 6a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z",
"tag" => ["M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z", "M6 6h.008v.008H6V6Z"],
"bookmark" => "M17.593 3.322c1.1.128 1.907 1.077 1.907 2.185V21L12 17.25 4.5 21V5.507c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0 1 11.186 0Z",
"paper-airplane" => "M6 12 3.269 3.125A59.769 59.769 0 0 1 21.485 12 59.768 59.768 0 0 1 3.27 20.875L5.999 12Zm0 0h7.5",
"document-arrow-down" => "M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m.75 12 3 3m0 0 3-3m-3 3v-6m-1.5-9H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z",
"document-text" => "M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z",
Expand Down
15 changes: 13 additions & 2 deletions app/components/filters/filter_form_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,26 @@
<%= render Common::CloseButtonComponent.new(link_to: filters_path) %>
</div>
<%= form_with model: @filter, data: { turbo_frame: "_top" } do |form| %>
<%= form.hidden_field :type %>
<div class="flex flex-col justify-start items-start self-stretch w-96">
<div class="flex justify-start items-center self-stretch gap-4 p-6">
<div class="flex flex-col justify-start items-start self-stretch flex-grow overflow-hidden gap-2 rounded-md">
<%= form.text_field :name, placeholder: "Názov filtra", class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
<%= form.label :name, "Názov filtra" %>
<%= form.text_field :name, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
</div>
</div>
<% if @filter.is_a? FulltextFilter %>
<div class="flex justify-start items-center self-stretch gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200">
<div class="flex flex-col justify-start items-start self-stretch flex-grow overflow-hidden gap-2 rounded-md">
<%= form.label :query, "Dopyt na vyhľadávanie" %>
<%= form.text_field :query, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
</div>
</div>
<% end %>
<div class="flex justify-start items-center self-stretch gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200">
<div class="flex flex-col justify-start items-start self-stretch flex-grow overflow-hidden gap-2 rounded-md">
<%= form.text_field :query, placeholder: "Dopyt na vyhľadávanie", class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
<%= form.label :icon, "Ikona" %>
<%= form.select :icon, helpers.icon_select_options, {}, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
</div>
</div>
</div>
Expand Down
14 changes: 11 additions & 3 deletions app/components/filters/filters_list_row_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
<div class="self-stretch p-6 border-b border-gray-200 justify-start items-center gap-4 inline-flex">
<div class="relative inline-flex items-center justify-center w-16 h-16 overflow-hidden bg-blue-600 rounded-full">
<span class="text-white text-2xl font-normal"><%= @filter.name[0] %></span>
<% if (@filter.icon || @filter.tag&.icon).presence %>
<%= render Common::IconComponent.new(@filter.icon || @filter.tag.icon, classes: "w-6 h-6 stroke-gray-300", stroke_width: 2) %>
<% else %>
<span class="text-white text-2xl font-normal"><%= @filter.name[0] %></span>
<% end %>
</div>
<div class="grow shrink basis-0 flex-col justify-start items-start gap-1 inline-flex">
<div class="text-center text-gray-900 text-lg font-medium leading-loose">
<%= render Common::InlineRenameComponent.new(name: @filter.name, model: @filter) %>
</div>
<div class="text-center text-gray-500 text-base font-normal leading-normal">
<%= @filter.query %>
<% if @filter.is_a? TagFilter %>
<%= render Common::TagComponent.new(@filter.tag) %>
<% else %>
<%= @filter.query %>
<% end %>
</div>
</div>
<div class="justify-start items-start gap-2 flex">
<%= link_to edit_filter_path(@filter), title: "Upraviť filter" do %>
<%= render Common::EditButtonComponent.new %>
<% end %>
<%= link_to filter_path(@filter), title: "Zmazať filter", data: { turbo_confirm: "Naozaj?", turbo_method: :delete } do %>
<%= button_to filter_path(@filter), title: "Zmazať filter", method: :delete, data: { turbo_confirm: "Naozaj chcete zmazať filter?" } do %>
<%= render Common::DeleteButtonComponent.new %>
<% end %>
</div>
Expand Down
36 changes: 26 additions & 10 deletions app/components/layout/filter_list_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
<% if @filters.present? %>
<div class="flex flex-col justify-start items-start gap-2" data-test="filters">
<div class="flex justify-start items-start px-4 py-2">
<p class="text-sm text-center text-gray-400">Filtre</p>
</div>
<div
<% if @sortable %>
data-controller="sortable"
data-sortable-url-value="<%= sort_filters_path %>"
data-sortable-draggable-class=".item"
data-sortable-handle-class=".handle"
<% end %>
class="w-full flex flex-col justify-start items-start gap-2"
data-test="filters"
>
<% if @sortable %>
<%= link_to 'Sort', '', class: 'hidden', data: { turbo_method: :patch, sortable_target: 'submit', url: sort_filters_path } %>
<% end %>
<% if @label.present? %>
<div class="flex justify-start items-start px-4 py-2">
<p class="text-sm text-center text-gray-400"><%= @label %></p>
</div>
<% end %>
<% @filters.each do |filter| %>
<% url = message_threads_path(q: filter.query) %>
<%= link_to url, class: "text-gray-700 hover:text-indigo-600 hover:bg-gray-50 group w-72 flex gap-x-3 rounded-md p-2 px-4 text-sm leading-6 font-semibold data-[active=true]:bg-gray-50 data-[active=true]:text-indigo-600", data: { active: current_page?(url) } do %>
<%= render Icons::BookmarkComponent.new %>
<p class="truncate text-base font-medium"><%= filter.name %></p>
<% end %>
<%= render TW::SidebarMenuItemComponent.new(
name: filter.name,
url: filtered_message_threads_path(filter:),
icon: icon_for(filter),
variant: :light,
classes: "item #{!@sortable ? 'pl-4' : ''}",
) %>
<% end %>
</div>
<% end %>
<% end %>
17 changes: 16 additions & 1 deletion app/components/layout/filter_list_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
class Layout::FilterListComponent < ViewComponent::Base
def initialize(filters:)
include MessageThreadHelper

def initialize(label: nil, filters:, sortable: false)
@label = label
@filters = filters
@sortable = sortable
end

def icon_for(filter)
return Common::IconComponent.new(filter.icon) if filter.icon.present?

if filter.tag.present?
return Common::IconComponent.new(filter.tag.icon) if filter.tag.icon.present?
return Icons::TagComponent.new
end

Icons::BookmarkComponent.new
end
end
4 changes: 2 additions & 2 deletions app/components/message_options_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
<% if @mode == :thread_view && @message.collapsible? %>
<% if @message.collapsed %>
<%= button_to message_path(@message), params: { collapsed: false }, method: :patch, class: 'whitespace-nowrap flex gap-3', role: 'menu-item', tabindex: -1 do %>
<%= render Icons::ChevronDownComponent.new(css_classes: "w-5 h-5") %>
<%= render Common::IconComponent.new("chevron-down", classes: "w-5 h-5") %>
Vždy zobrazovať
<% end %>
<% else %>
<%= button_to message_path(@message), params: { collapsed: true }, method: :patch, class: 'whitespace-nowrap flex gap-3', role: 'menu-item', tabindex: -1 do %>
<%= render Icons::ChevronUpComponent.new(css_classes: "w-5 h-5") %>
<%= render Common::IconComponent.new("chevron-up", classes: "w-5 h-5") %>
Zbaliť a už nerozbaľovať
<% end %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<%= tag.turbo_frame id: "bulk_actions" do %>
<div class="flex justify-stretch items-center gap-4 px-4 lg:py-4 border-t-0 border-r-0 border-b border-l-0 border-gray-200 min-h-[3rem] sm:min-h-[5rem]">
<%= check_box_tag("", nil, false, { class: "hidden sm:block h-4 w-4 rounded border-gray-300 text-blue-500 focus:ring-0", type: "checkbox", id: "checkbox-all", data: { action: "all-checkboxes#toggle", "all-checkboxes-target": "checkbox" } }) %>

<span class="grow sm:text-xl text-base font-semibold text-left text-gray-900"><%= @ids.present? ? t(:selected_message, count: @ids.count) : "Správy v schránke" %>
<span class="grow sm:text-xl text-base font-semibold text-left text-gray-900"><%= title %>
<% if @filter %>
<% if @filter_subscription %>
<%= link_to edit_filter_filter_subscription_path(@filter, @filter_subscription), title: "Nastaviť notifikácie", "data-turbo-frame": :modal, form_class: "inline" do %>
Expand All @@ -25,7 +24,7 @@
<div>
<button type="button" data-action="dropdown#toggle click@window->dropdown#hide" class="inline-flex w-full justify-center items-center gap-x-1.5 rounded-md bg-white px-2 py-1 sm:px-3 sm:py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50" id="menu-button" aria-expanded="true" aria-haspopup="true">
Hromadné akcie
<%= render Icons::ChevronDownComponent.new(css_classes: "w-4 h-4 text-gray-400", stroke_width: 2) %>
<%= render Common::IconComponent.new('chevron-down', classes: "w-4 h-4 text-gray-400", stroke_width: 2) %>
</button>
</div>

Expand Down Expand Up @@ -127,7 +126,7 @@
<div>
<button type="button" data-action="dropdown#toggle click@window->dropdown#hide" class="inline-flex w-full justify-center items-center gap-x-1.5 rounded-md bg-white px-2 py-1 sm:px-3 sm:py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50" id="menu-button" aria-expanded="true" aria-haspopup="true">
Vytvoriť novú správu
<%= render Icons::ChevronDownComponent.new(css_classes: "w-4 h-4 text-gray-400", stroke_width: 2) %>
<%= render Common::IconComponent.new('chevron-down', classes: "w-4 h-4 text-gray-400", stroke_width: 2) %>
</button>
</div>

Expand Down
12 changes: 11 additions & 1 deletion app/components/message_threads_bulk_actions_component.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
class MessageThreadsBulkActionsComponent < ViewComponent::Base
def initialize(ids:, signable:, filter: nil, filter_subscription: nil)
def initialize(ids: nil, signable:, filter: nil, query: nil, filter_subscription: nil)
@ids = ids
@signable = signable
@filter = filter
@query = query
@filter_subscription = filter_subscription
end

def title
return t(:selected_message, count: @ids.count) if @ids.present?
return @filter.name if @filter.present? && @filter.is_a?(EverythingFilter)
return "Správy z filtra '#{@filter.name}'" if @filter.present?
return "Hľadaný výraz '#{@query}'" if @query.present?

"Správy v schránke"
end
end
2 changes: 1 addition & 1 deletion app/components/message_threads_table_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="flex flex-col justify-stretch items-stretch gap-4 sm:p-4">
<div class="flex flex-col justify-stretch items-stretch sm:rounded-md bg-white sm:border sm:border-gray-200" data-controller="form all-checkboxes">
<%= render MessageThreadsBulkActionsComponent.new(ids: [], filter: @filter, filter_subscription: @filter_subscription, signable: Current.user.signer?) %>
<%= render MessageThreadsBulkActionsComponent.new(ids: [], filter:, query:, filter_subscription:, signable: Current.user.signer?) %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ak su toto nepovinne parametre tak ich tam neposielajme, ale zvlastne ze to nepotrebujeme.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

niesu nepovinne, ale ide zase o Shorthand Hash Syntax

<%= form_with url: bulk_actions_message_threads_path, data: { "form-target": "form", "all-checkboxes-target": "form" } do %>
<ul role="list" id="message_threads" data-controller="visited-links" class="divide-y divide-gray-100">
<% message_threads.each do |message_thread| %>
Expand Down
5 changes: 4 additions & 1 deletion app/components/message_threads_table_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ class MessageThreadsTableComponent < ViewComponent::Base
renders_many :message_threads
renders_one :next_page_area

def initialize(filter:, filter_subscription:)
attr_reader :filter, :query, :filter_subscription

def initialize(filter: nil, query: nil, filter_subscription:)
@filter = filter
@query = query
@filter_subscription = filter_subscription
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="w-full p-4 flex-col justify-start items-start gap-4 inline-flex">
<div class="self-stretch bg-white rounded-md border border-gray-200 flex-col justify-start items-start flex">
<div class="flex-col self-stretch p-6 border-b border-gray-200 justify-start items-start gap-4 inline-flex">
<div class="grow shrink basis-0 text-gray-900 text-xl font-semibold leading-[35px]">Filtre</div>
Nastavte si osobnú preferenciu viditeľnosti filtrov v ľavom menu
</div>
<div class="self-stretch flex-col justify-start items-start flex">
<%= render Settings::UserFilterVisibilities::ListRowComponent.with_collection(@visibilities) %>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Settings::UserFilterVisibilities::ListComponent < ViewComponent::Base
def initialize(visibilities)
@visibilities = visibilities
end
end
Loading
Loading