Bugzilla – Attachment 92453 Details for
Bug 23501
Drag-and-drop hold reordering in the staff interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23501: Drag-and-drop hold reordering in the staff client
Bug-23501-Drag-and-drop-hold-reordering-in-the-sta.patch (text/plain), 6.63 KB, created by
Owen Leonard
on 2019-08-23 15:41:42 UTC
(
hide
)
Description:
Bug 23501: Drag-and-drop hold reordering in the staff client
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2019-08-23 15:41:42 UTC
Size:
6.63 KB
patch
obsolete
>From eb9e2d9379b12310159fffb9f7fb6d5c3508660c Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 23 Aug 2019 14:43:00 +0000 >Subject: [PATCH] Bug 23501: Drag-and-drop hold reordering in the staff client > >This patch adds drag-and-drop priority reordering to the table of >existing holds on a title. > >To test, apply the patch and regenerate the staff client CSS >(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). > > - Log in to Koha as a user who has permission to modify holds priority > - Test on a record that has multiple holds, including one which is > waiting and one which is in transit. > - Holds which can be re-ordered should have a "drag handle" styled > table cell in the first column. > - Your mouse should show the "move" cursor when you hover over it. > - Clicking and dragging from this table cell should reorder the table > rows. > - The priority numbers should be automatically updated when you > "drop" the row. > - It should not be possible to move a hold which is waiting or in > transit. > - It should not be possible to move a hold before a waiting or in > transit hold. > - Toggle lowest priority on a hold. The row should become unsortable, > and it should be impossible to sort a hold below that hold. > > - Test again as a user who doesn't have permission to modify holds > priority. >--- > .../intranet-tmpl/prog/css/src/staff-global.scss | 36 +++++++++++++++++++++- > .../intranet-tmpl/prog/en/includes/holds_table.inc | 29 ++++++++++++++--- > .../prog/en/modules/reserve/request.tt | 13 ++++++++ > 3 files changed, 72 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >index 09dc82b52d8..caa48573f36 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -4078,10 +4078,44 @@ div#makechart ol li { > list-style: none; > } > >-@media (min-width: 200px) { >+/* Sortable table styling */ > >+.handle { >+ background: #FCFCFC url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMAQMAAABoTh6ZAAAABlBMVEVMaXHExMQ/ZYtiAAAAAXRSTlMAQObYZgAAABNJREFUeNpjYGBgMDYAIQjAxgYAKfECU0ml038AAAAASUVORK5CYII=") repeat-y; >+ cursor: move; >+ padding: 0 1em; > } > >+tr { >+ &.ui-sortable-helper { >+ td { >+ border-bottom: 2px solid #85CA11; >+ border-top: 2px solid #85CA11; >+ >+ &:first-child { >+ border-left: 2px solid #85CA11; >+ } >+ >+ &:last-child { >+ border-right: 2px solid #85CA11; >+ } >+ } >+ } >+} >+ >+.table-sort-placeholder { >+ height: 2.5em; >+ width: 100%; >+ >+ td { >+ background-color: #FFC; >+ border-color: #85CA11; >+ min-width: 3em; >+ } >+} >+ >+/* End sortable table styling */ >+ > @media (max-width: 767px) { > .header-menu-link { > display: inline-block; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >index 0e0462d2321..f4f36801167 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -1,7 +1,9 @@ > [% USE Koha %] >-<table> >+<table id="existing_holdst"> >+ <thead> > <tr> > [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] >+ <th> </th> > <th>Priority</th> > <th> </th> > [% ELSE %] >@@ -19,22 +21,38 @@ > <th> </th> > [% IF SuspendHoldsIntranet %]<th> </th><!-- Suspend Holds Column Header -->[% END %] > </tr> >- >+ </thead> >+ <tbody> > [% SET first_priority = 0 %] > [% SET last_priority = holds.last.priority %] > > [% FOREACH hold IN holds %] > [% IF !hold.found && first_priority == 0 %][% first_priority = hold.priority %][% END %] >- <tr> >+ [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] >+ [% IF ( hold.found ) %] >+ <tr class="no-sort"> >+ <td> </td> >+ [% ELSE %] >+ [% IF ( hold.lowestPriority ) %] >+ <tr class="no-sort"> >+ <td> </td> >+ [% ELSE %] >+ <tr> >+ <td class="handle"> </td> >+ [% END %] >+ [% END %] >+ [% ELSE %] >+ <tr class="no-sort"> >+ [% END %] > <td> > <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" /> > <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" /> > <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" /> > [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %] >- <select name="rank-request"> >+ <select class="rank-request" id="rank-request_[% hold.reserve_id | html %]" name="rank-request"> > [% ELSE %] > <input type="hidden" name="rank-request" value="[% hold.priority | html %]"> >- <select name="rank-request" disabled="disabled"> >+ <select class="rank-request" name="rank-request" disabled="disabled"> > [% END %] > [% IF ( hold.found ) %] > [% IF ( hold.intransit ) %] >@@ -210,4 +228,5 @@ > </tr> > > [% END %] >+ </tbody> > </table> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 91e4ebb6b5d..3408ef20ef5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -967,6 +967,19 @@ > [% END %] > [% END %] > >+ // Sortable table of existing holds >+ // #existing_holdst is found in holds_table.inc >+ $("#existing_holdst tbody").sortable({ >+ cursor: "move", // Cursor style >+ handle: ".handle", // Elements with this class will serve as "handle" for dragging >+ items: "tr:not(.no-sort)", // Only these elements will be draggable >+ placeholder: "table-sort-placeholder", >+ update: function( event, ui ){ >+ $(".rank-request:enabled").each(function( index ){ >+ $(this).val( index + 1 ); // Update the priority of the sortable holds based on the order >+ }); >+ } >+ }); > }); > </script> > [% END %] >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23501
:
92453
|
92465