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

fixing filters being reordered after editing #778

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

LeXofLeviafan
Copy link
Collaborator

@LeXofLeviafan LeXofLeviafan commented Sep 6, 2024

fixes #624 (as a workaround):

  • now when clicking "Apply" in the list filters form, the filter numbers are automatically reassigned to match their order

also:

  • when filter index is > 9, its index is automatically converted into a letter (since filters sorting is lexicographical); this is done during the submission, in the pagination links, and in the generated filters (filter_key())
  • updated completions (for implementing search-with-markers #777 changes)

Note: this also deals with the upstream bug mentioned in #777 (externally); though these two pull-requests might have a minor merge conflict with each other due to how git calculates changes (i.e. their modifications affect adjacent lines)

Example

before
(changed a filter in the middle – this would normally cause it to be numbered last)
modifying filters
(after submission)
after
URL query (formatted for readability):

?flt0_title_equals=a
&flt1_title_equals=b
&flt2_title_equals=c
&flt3_title_not_equal=D
&flt4_title_equals=e
&flt5_title_not_equal=F
&flt6_title_equals=g
&flt7_title_equals=h
&flt8_title_equals=i
&flt9_title_not_equal=J
&fltA_title_equals=k
&fltB_title_not_equal=L
&fltC_title_equals=m
&fltD_title_equals=n

@@ -180,7 +180,7 @@ def get_detail_value(self, context, model, name):
edit_template = "bukuserver/bookmark_edit.html"
named_filter_urls = True
extra_css = ['/static/bukuserver/css/' + it for it in ('bookmark.css', 'modal.css')]
extra_js = ['/static/bukuserver/js/' + it for it in ('page_size.js', 'last_page.js')]
extra_js = ['/static/bukuserver/js/' + it for it in ('page_size.js', 'last_page.js', 'filters_fix.js')]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

More specifically, there's a chance of this (or the next) change causing a merge conflict since the other pull-request modifies extra_css.

@LeXofLeviafan LeXofLeviafan force-pushed the fix-filters-order branch 2 times, most recently from 31a2419 to 0da714c Compare September 6, 2024 04:00
@jarun
Copy link
Owner

jarun commented Sep 7, 2024

There's a merge conflict. Please resolve and merge.

@LeXofLeviafan
Copy link
Collaborator Author

@jarun fixed the conflict & updated completion files

@jarun jarun merged commit 4b8263a into jarun:master Sep 8, 2024
1 check passed
@jarun
Copy link
Owner

jarun commented Sep 8, 2024

Thank you!

@LeXofLeviafan LeXofLeviafan deleted the fix-filters-order branch September 10, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants