linkifiers: Disable dragging when a filter is applied.

Dragging while a filter is applied can be confusing because the
reordering request won't succeed if the complete list of linkifiers is
not provided.
This commit is contained in:
Zixuan James Li 2023-08-14 19:01:19 -04:00 committed by Tim Abbott
parent b8a770d9c6
commit 255e382750
2 changed files with 4 additions and 3 deletions

View File

@ -133,7 +133,7 @@ export function populate_linkifiers(linkifiers_data) {
ListWidget.create($linkifiers_table, linkifiers_data, {
name: "linkifiers_list",
get_item: ListWidget.default_get_item,
modifier(linkifier) {
modifier(linkifier, filter_value) {
return render_admin_linkifier_list({
linkifier: {
pattern: linkifier.pattern,
@ -141,6 +141,7 @@ export function populate_linkifiers(linkifiers_data) {
id: linkifier.id,
},
can_modify: page_params.is_admin,
can_drag: filter_value.length === 0,
});
},
filter: {

View File

@ -1,7 +1,7 @@
{{#with linkifier}}
<tr class="linkifier_row{{#if ../can_modify}} movable-row{{/if}}" data-linkifier-id="{{id}}">
<tr class="linkifier_row{{#if (and ../can_modify ../can_drag)}} movable-row{{/if}}" data-linkifier-id="{{id}}">
<td>
{{#if ../can_modify}}
{{#if (and ../can_modify ../can_drag)}}
<i class="fa fa-ellipsis-v" aria-hidden="true"></i>
<i class="fa fa-ellipsis-v" aria-hidden="true"></i>
{{/if}}