Bug 7882: (follow-up) Update sorting interaction

This follow-up modifies the CSS for the sortable fields so that a
different icon is used. Elsewhere in Koha (stock rotation stage sorting)
we use the "bars" icon to indicate a sortable element. I think it would
be good to continue to use this. The cursor is now styled as a "Move"
cursor.

The configuration of the sortable function in the script has been
updated in two ways: 1. The movement of the element is constrained along
the y-axis, and 2. The movement of the element is contstrained to the
container within which it can be moved (for the tag, the tab, and for
the subfield, the tag).

To test, apply the patch and edit a MARC record in the basic cataloging
editor.

Confirm that the new icon is used, and that the "Move" cursor shows when
you hover over the icon.

Confirm that a tag can be dragged up and down within the constraints of
the visible section. A subfield should be only movable within its parent
tag.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Owen Leonard 2019-12-16 19:06:57 +00:00 committed by Martin Renvoize
parent 802d7d30c9
commit a37d89d835
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
2 changed files with 14 additions and 5 deletions

View file

@ -26,16 +26,19 @@ ul li.tag, ul li.tag li.subfield_line {
padding-left: 30px;
}
ul li.tag:before, ul li.tag li.subfield_line:before {
ul li.tag::before,
ul li.tag li.subfield_line::before {
color: #999;
cursor: move;
position: absolute;
font-family: 'FontAwesome';
font-size: .8em;
top: 0;
left: 10px;
content: "\f047";
content: "\f0c9";
}
ul li.tag:before {
ul li.tag::before {
padding-top: 1.7em;
}

View file

@ -26,8 +26,14 @@
var $tabs = $('#addbibliotabs').tabs().bind('show.ui-tabs', function(e, ui) {
$("#"+ui.panel.id+" input:eq(0)").focus();
});
$( "ul.sortable_field", $tabs ).sortable();
$( "ul.sortable_subfield", $tabs ).sortable();
$( "ul.sortable_field", $tabs ).sortable({
axis: "y",
containment: $("#addbibliotabs")
});
$( "ul.sortable_subfield", $tabs ).sortable({
axis: "y",
containment: "parent"
});
[% IF tab %]
link = $("a[href='#[% tab | html %]']");