-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Conversation
…d on filter or query
…ailwind functionality
@@ -0,0 +1,6 @@ | |||
class Icons::GripComponent < ViewComponent::Base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ukazalo sa, ze lepsi sposob je cez Common::IconComponent. kukni tam.
<% end %> | ||
<%= @name %> | ||
<% end %> | ||
<%= link_to \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooo toto nepoznam \
naucil som sa.
if @filter.save | ||
flash[:notice] = 'Filter bol úspešne vytvorený' | ||
if params[:to] == 'search' | ||
redirect_to message_threads_path(q: @filter.query) | ||
redirect_to helpers.filtered_message_threads_path(filter: @filter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toto nejde bez helpers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bez hanby by som to dal include do controllera
end | ||
|
||
Filter.transaction do | ||
filters.map.with_index do |filter, i| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
each_with_index
mozes tiez ak nepotrbujes vysledok
end | ||
end | ||
|
||
redirect_back fallback_location: filters_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toto je turbovina a vieme to lepsie, dnes sme @mirrec hutali 15 sposobov ako a asi mame ako treba. Pozri ako je v threadscontroller spraveny rename.
}) | ||
|
||
this.sortable.on('drag:stopped', async (e) => { | ||
// As of now, this is the only way to submit a PATCH request with Rails so Turbo updates the pages without a full reload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
myslim, ze ked mu posles format: :turbo_stream tak pojde aj inak.
config/routes.rb
Outdated
end | ||
|
||
collection do | ||
patch :sort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ak je jeden davam to onliner patch :sort, on: :collection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
# tag_id :bigint | ||
# tenant_id :bigint not null | ||
# | ||
class FulltextFilter < Filter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fulltext mi evokuje, ze to je ten text ale asi prezijem. Ak by sme mali ist konvenciou zo stitkov tak je to SimpleFilter ale to asi nie je :)
# Conflicts: # app/components/message_threads_bulk_actions_component.html.erb # app/components/message_threads_bulk_actions_component.rb # app/components/message_threads_table_component.html.erb # app/components/message_threads_table_component.rb # app/lib/sidebar_menu.rb # app/views/message_threads/index.html.erb # config/routes.rb # db/schema.rb
# Conflicts: # app/components/message_threads_bulk_actions_component.html.erb # app/components/message_threads_bulk_actions_component.rb # app/components/message_threads_table_component.html.erb # app/components/t_w/top_navigation_component.rb # app/controllers/application_controller.rb # app/views/message_threads/index.html.erb
…368-filters # Conflicts: # app/components/common/icon_component.rb # app/controllers/application_controller.rb # app/lib/sidebar_menu.rb # db/schema.rb
# Conflicts: # app/components/common/icon_component.rb
@@ -35,7 +35,9 @@ def index | |||
if params[:filter_id].present? | |||
@filter = policy_scope(Filter, policy_scope_class: FilterPolicy::ScopeShowable).find_by(id: params[:filter_id]) | |||
else | |||
@filter = Current.user.visible_filters.first | |||
if Current.user.visible_filters.any? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toto sa mi uplne nepozdava, ze tu davame redirect. v podstate sa nebude dat linkovat root (vzdy to spravi redirect). Nedava skor zmysel nastavit ten filter a nerobit redirect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, prerobim
@alhafoudh mas tu nejake konflikty este |
Dal som tu aj @luciajanikova na review, pozriem aj ja. |
Asi je nieco zle, vo vsetkych filtroch vidim rovnake vlakna. Skusala som spustit migracie na uz predtym existujucej DB a takto to vyzera. Na cistonovej DB sa zda, ze to funguje podla ocakavani. Predpokladam teda, ze migracia existujucich tagov na filtre nebude ok. @durcak Screen.Recording.2024-09-24.at.16.38.45.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zatial len nejake drobnosti, co som si vsimla. Pre mna je blocker, ze mi filtrovanie pri lokalnom testovani nefunguje. Az potom budem vediet este hlbsie pozriet.
@@ -0,0 +1,5 @@ | |||
class ChangeAuthorIdNullOnFilters < ActiveRecord::Migration[7.1] | |||
def change | |||
change_column_null :filters, :author_id, true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tato migracia by mala byt asi skor ako db/migrate/20240624114024_create_tag_filters_from_tags.rb
?
Lokalne som skusala a spominana migracia mi vyfailovala na tom, ze author_id
bol nil
(ActiveRecord::NotNullViolation
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixnute.
app/models/filter.rb
Outdated
scope :not_pinned, -> { where(is_pinned: false) } | ||
scope :visible_for, -> (user) { joins(:user_filter_visibilities) | ||
.where(user_filter_visibilities: { visible: true, user: user}) | ||
.where(is_pinned: false) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aky vyznam ma tento atribut is_pinned
? Ak spravne pozeram, tak defaultne je false, ale nevidim, ze by sa niekedy tato hodnota menila.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toto som dal prec, s Ahmedom sme sa dohodli, ze to netreba, bol to len nejaky povodny pokus o nieco.
@luciajanikova fixol som to filtrovanie, sorry netestoval som to dobre na starsich datach a zdalo sa mi, ze to funguje. Uz by to malo byt ok. |
Ked si vytvorim novy |
On prave pisal v chate v threade k tomuto, ze novy tag filter nema byt hned viditelny. Viditelne maju byt hned len novo vytvorene fulltext filtre. |
Okay, dakujem za rychle info. |
Mne este napadlo, ci nechcem aj FulltextTagFilter, tzn. ze ked mam zakliknuty nejaky tag filter a k nemu pridam query filter a dam ulozit ako novy filter tak sa bude filtrovat aj query a tag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Za mna inak asi ok, preklikala som sa cez to, vyzera to byt v poriadku. Trochu iba bojujem s tym, ze novy TagFilter nie je defaultne viditelny v lavom menu. Z mojho pohladu, ked si idem vytvarat Tag, tak chcem pomocou neho filtrovat spravy, rychlo najst tie, ktore su tagom oznacene. Takze chcem aby bol viditelny. Ak ho by default neuvidim, asi by ma to zmiatlo. Aky mas na to ty pohlad @jsuchal, ked preferujes default schovany?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luciajanikova toto bude mozno potrebovat tvoje pozretie tiez a skusenie lokalne, ze ako sa to sprava. Po FS mergi.
@@ -0,0 +1,3 @@ | |||
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-2.5 px-3.5 py-2.5 rounded-md bg-white border border-gray-300 hover:bg-gray-100"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tu sme sa dohodli, ze uz pouzivame IconComponent a nevyrabame komponenty per-ikona.
@@ -0,0 +1,4 @@ | |||
module Common |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detto
def icon_for(filter) | ||
return Common::IconComponent.new(filter.icon) if filter.icon.present? | ||
|
||
if filter.tag_id.present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if filter.tag_id.present? | |
if filter.tag.present? |
@@ -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?) %> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 model: [:settings, Current.user.user_filter_visibilities.new(filter: @filter)], method: :post do |form| %> | ||
<%= form.hidden_field :filter_id, value: @filter.id %> | ||
<%= form.hidden_field :visible, value: [email protected] %> | ||
<%= form.button class: "#{@visibility.hidden ? "bg-gray-200" : "bg-indigo-600"} relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2", role: :switch, aria: { checked: @visibility.hidden.to_s } do %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
existuje takyto fajny helper https://www.bigbinary.com/blog/rails-6-1-introduces-class_names-helper
<% end %> | ||
<%= form_with model: [:move_higher, :settings, @visibility], method: :post do |form| %> | ||
<%= form.button do %> | ||
<%= render Common::UpButtonComponent.new %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pouzit genericky komponent
<% end %> | ||
<%= form_with model: [:move_lower, :settings, @visibility], method: :post do |form| %> | ||
<%= form.button do %> | ||
<%= render Common::DownButtonComponent.new %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pouzit genericky komponent
app/policies/filter_policy.rb
Outdated
def pin? | ||
is_author_current_user? | ||
end | ||
|
||
def unpin? | ||
pin? | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toto sa niekde pouziva?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asi nie, davam prec
Gemfile
Outdated
@@ -39,6 +39,7 @@ gem 'jwt' | |||
gem 'stimulus-rails' | |||
gem 'jsbundling-rails' | |||
gem 'pdf-reader' | |||
gem "acts_as_list", "~> 1.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pin na verziu nerobime pokym naozaj nie je treba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Toto uz asi len mergnut s mainom a pretestovat? @jsuchal |
@luciajanikova ano |
Main mergnuty, konflikty vyriesene, ale netestoval som to uz. |
Pretestujem, keby na nieco narazim, pisem sem @durcak |
Tuto asi este zostalal moja pripomienka zabudnuta + pride mi pre bezneho pouzivatela trochu matuce, ze k tagu existuje aj (duplicitny) filter a pri oboch je mozne nastavovat viditelnost, ale znamena to nieco ine. Potrebujeme to mat takto dvojmo, s tou viditelnostou, neznamena to to iste? |
@luciajanikova neznamena to to iste myslim, jedno je viditelnost v lavom menu druhe je viditelnost na vlaknach. ale asi stoji za to zvazit to premenovat. kuknem to dnes vecer/zajtra. |
Ano, to je pravda, ale z pouzivatelskeho hladiska mi to uplne nedava zmysel, aby to boli dve rozne veci.
Za mna: ak nejaky stitok chcem pouzivat, tak chcem aby bol viditelny (nech ho viem pridavat na vlakna) a zaroven chcem vidiet aj filter, nech si viem spravy s danym stitkom vyfiltrovat. |
@luciajanikova nepovedal by som, lebo minimalne to lave menu je personalizovane per-user a viditelnost stitkov je per-tenant ak si spravne spominam. |
No description provided.