Bug 35194 - Javascript error: Uncaught TypeError: $(...).sortable is not a function
Summary: Javascript error: Uncaught TypeError: $(...).sortable is not a function
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Marcel de Rooy
QA Contact: Emily Lamancusa
URL:
Keywords: rel_23_11_candidate
Depends on: 34114
Blocks: 35304
  Show dependency treegraph
 
Reported: 2023-10-30 21:42 UTC by Katrin Fischer
Modified: 2023-11-11 07:21 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00


Attachments
Bug 35194: Remove obsoleted sortable function (2.72 KB, patch)
2023-11-09 10:38 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 35194: Remove obsoleted sortable function (2.72 KB, patch)
2023-11-09 13:21 UTC, David Nind
Details | Diff | Splinter Review
Bug 35194: Remove obsoleted sortable function (2.79 KB, patch)
2023-11-09 15:29 UTC, Emily Lamancusa
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2023-10-30 21:42:28 UTC
The error appears in both the cataloguing and authority editor. Go to a repeatable field, like 500. Repeat it with the console open:

Uncaught TypeError: $(...).sortable is not a function
Comment 1 Lucas Gass 2023-10-31 13:56:45 UTC
sortable() is a jQueryUI function which was removed from Koha. It looks like that line just needs to be removed:

-    $("ul.sortable_subfield", clone).sortable();


Without it you can still sort and clone repeatable fields.
Comment 2 Marcel de Rooy 2023-11-09 10:27:47 UTC
git grep "sortable("

koha-tmpl/intranet-tmpl/prog/en/modules/admin/didyoumean.tt:            $( ".pluginlist" ).sortable();
koha-tmpl/intranet-tmpl/prog/js/cataloging.js:    $("ul.sortable_subfield", clone).sortable();
koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js:                        // $('#sortable_stages').sortable('cancel');
Comment 3 Marcel de Rooy 2023-11-09 10:30:47 UTC
This also breaks didyoumean configuration.
Comment 4 Marcel de Rooy 2023-11-09 10:38:15 UTC
Created attachment 158709 [details] [review]
Bug 35194: Remove obsoleted sortable function

Removes two occurrences and a commented one.

Test plan:
[1] Go to cataloguing editor. Open dev console. Clone 500.
[2] Go to Admin/Did you mean. Try to toggle options.

With this patch it works. Without this patch, JS errors.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Marcel de Rooy 2023-11-09 10:39:03 UTC
(In reply to Marcel de Rooy from comment #3)
> This also breaks didyoumean configuration.

This asks for Major imo.
Comment 6 Marcel de Rooy 2023-11-09 10:42:57 UTC
22.11 grep gives me more results:

 git grep "sortable("
koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt:            $("#subfieldtabs > ul").sortable({
koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt:        $( "ul.sortable_field", "#authoritytabs" ).sortable();
koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt:        $( "ul.sortable_subfield", "#authoritytabs" ).sortable();
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt:        $( "ul.sortable_field", "#addbibliotabs" ).sortable({
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt:        $( "ul.sortable_subfield", "#addbibliotabs" ).sortable({
koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js:    $("#subfieldtabs > ul").sortable({
koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js:    $(".sortable").sortable();
koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js:    $('#sortable_stages').sortable({
koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js:            $('#sortable_stages').sortable('disable');
koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js:                $('#sortable_stages').sortable('cancel');
koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js:                $('#sortable_stages').sortable('enable');
Comment 7 Marcel de Rooy 2023-11-09 12:43:50 UTC
(In reply to Marcel de Rooy from comment #6)
> 22.11 grep gives me more results:
> 
>  git grep "sortable("
> koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt:  
> $("#subfieldtabs > ul").sortable({
> koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt:       
> $( "ul.sortable_field", "#authoritytabs" ).sortable();
> koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt:       
> $( "ul.sortable_subfield", "#authoritytabs" ).sortable();
> koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt:        $(
> "ul.sortable_field", "#addbibliotabs" ).sortable({
> koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt:        $(
> "ul.sortable_subfield", "#addbibliotabs" ).sortable({
> koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js:   
> $("#subfieldtabs > ul").sortable({
> koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js:   
> $(".sortable").sortable();
> koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js:   
> $('#sortable_stages').sortable({
> koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js:           
> $('#sortable_stages').sortable('disable');
> koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js:               
> $('#sortable_stages').sortable('cancel');
> koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js:               
> $('#sortable_stages').sortable('enable');

No worries. 22.11 still has the library.
Comment 8 David Nind 2023-11-09 13:21:55 UTC
Created attachment 158714 [details] [review]
Bug 35194: Remove obsoleted sortable function

Removes two occurrences and a commented one.

Test plan:
[1] Go to cataloguing editor. Open dev console. Clone 500.
[2] Go to Admin/Did you mean. Try to toggle options.

With this patch it works. Without this patch, JS errors.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Comment 9 Emily Lamancusa 2023-11-09 15:29:05 UTC
Created attachment 158746 [details] [review]
Bug 35194: Remove obsoleted sortable function

Removes two occurrences and a commented one.

Test plan:
[1] Go to cataloguing editor. Open dev console. Clone 500.
[2] Go to Admin/Did you mean. Try to toggle options.

With this patch it works. Without this patch, JS errors.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 10 Emily Lamancusa 2023-11-09 16:07:24 UTC
Looks great!

It seems like the new Sortable library never got added to the didyoumean page, though. I'll open a related bug for it. If it makes more sense to add a follow-up here instead, feel free to mark the new bug as a dupe and I'll QA the follow-up here.
Comment 11 Emily Lamancusa 2023-11-09 16:42:09 UTC
(In reply to Emily Lamancusa from comment #10)

> It seems like the new Sortable library never got added to the didyoumean
> page, though. I'll open a related bug for it. If it makes more sense to add
> a follow-up here instead, feel free to mark the new bug as a dupe and I'll
> QA the follow-up here.

lol it was an easy fix. Patch uploaded on bug 35304
Comment 12 Tomás Cohen Arazi 2023-11-09 17:44:11 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 13 Marcel de Rooy 2023-11-10 07:08:28 UTC
(In reply to Emily Lamancusa from comment #9)
> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>

Thanks Emily
Comment 14 Fridolin Somers 2023-11-11 07:21:18 UTC
Depends on Bug 34114 not in 23.05.x