Bug 11878 - Eliminate use of deprecated jQuery .toggle() method usage
Summary: Eliminate use of deprecated jQuery .toggle() method usage
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-28 20:25 UTC by Owen Leonard
Modified: 2015-06-04 23:30 UTC (History)
5 users (show)

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


Attachments
Bug 11878 - Eliminate use of deprecated jQuery .toggle() method usage (6.06 KB, patch)
2014-03-04 17:20 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 11878 - Eliminate use of deprecated jQuery .toggle() method usage (6.08 KB, patch)
2014-03-04 19:04 UTC, wajasu
Details | Diff | Splinter Review
[Signed-off] Bug 11878 - Eliminate use of deprecated jQuery .toggle() method usage (6.24 KB, patch)
2014-03-05 12:54 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 11878 - Eliminate use of deprecated jQuery .toggle() method usage (6.38 KB, patch)
2014-03-16 14:13 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2014-02-28 20:25:48 UTC
There are a few instances in the templates of the .toggle() method usage which is now deprecated:

http://jquery.com/upgrade-guide/1.9/#toggle-function-function-removed

These will need to be corrected before we can upgrade jQuery.
Comment 1 Owen Leonard 2014-03-04 17:20:55 UTC Comment hidden (obsolete)
Comment 2 wajasu 2014-03-04 19:04:10 UTC Comment hidden (obsolete)
Comment 3 wajasu 2014-03-04 19:07:51 UTC
Did a qucik search to see if other .toggle usage was present, and got these results, so if they don't need to be addressed, we could change the status to signed off, otherwise things will wait for further followup patches.
It may depend on the jquery update only needing to be done for OPAC.


12:45:28 {bug11878 %} ~/prj/kohaclone$ find . -name "*.js" -exec grep -Hn ".toggle()" {} \;

Some places where toggle is in our source tree after the 1st patch applied:

./koha-tmpl/opac-tmpl/bootstrap/lib/bootstrap/js/bootstrap.js:1814:    this.options.toggle && this.toggle()
./koha-tmpl/opac-tmpl/bootstrap/js/script.js:54:        $(".menu-collapse").toggle();

./koha-tmpl/intranet-tmpl/prog/en/js/pages/batchMod.js:15:        $("#itemst td:nth-child("+valCookie[i]+"),#itemst th:nth-child("+valCookie[i]+")").toggle();
./koha-tmpl/intranet-tmpl/prog/en/js/pages/batchMod.js:29:  $("#itemst td:nth-child("+hide+"),#itemst th:nth-child("+hide+")").toggle();
./koha-tmpl/intranet-tmpl/prog/en/js/pages/batchMod.js:65:  $("#itemst td:nth-child("+show+"),#itemst th:nth-child("+show+")").toggle();
./koha-tmpl/intranet-tmpl/prog/en/js/acq.js:863:    $("#plan td:nth-child("+hide+"),#plan th:nth-child("+hide+")").toggle();
./koha-tmpl/intranet-tmpl/prog/en/js/acq.js:872:    $("#plan td:nth-child("+show+"),#plan th:nth-child("+show+")").toggle();
Comment 4 Owen Leonard 2014-03-04 19:12:47 UTC
(In reply to wajasu from comment #3)
> Did a qucik search to see if other .toggle usage was present, and got these
> results, so if they don't need to be addressed, we could change the status
...
> ./koha-tmpl/intranet-tmpl/prog/en/js/acq.js:872:    $("#plan
> td:nth-child("+show+"),#plan th:nth-child("+show+")").toggle();

No, these do not need to be addressed: '.toggle(function, function, ... ) removed: This is the "click an element to run the specified functions" signature of .toggle(). It should not be confused with the "change the visibility of an element" of .toggle() which is not deprecated.'

My patch fixes all the instances which I know to be problematic.
Comment 5 Marc Véron 2014-03-05 12:54:11 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2014-03-16 14:13:40 UTC
Created attachment 26378 [details] [review]
[PASSED QA] Bug 11878 - Eliminate use of deprecated jQuery .toggle() method usage

jQuery's .toggle() method can no longer be used to trigger a pair of
specified functions. .toggle() can only be used to change the visibility
of an element. This patch fixes a few places in Koha where the
deprecated functionality was used.

To test, apply the patch and clear your browser cache.

- View the system preferences page in the staff client. Clicking a
  heading ("Appearance" under OPAC preferences, for instance) should
  collapse that section. Clicking again should expand it.

- View the MARC detail page for a record in the OPAC. Clicking the "view
  plain" link should display the plain MARC view. Clicking the "view
  labeled" view should return to the original view. Test in both prog
  and bootstrap themes.

Signed-off-by: wajasu <matted-34813@mypacks.net>

Followed test plan. Works fine.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.
No Javascript errors found.
Comment 7 Galen Charlton 2014-03-26 19:26:08 UTC
Pushed to master.  Thanks, Owen!
Comment 8 Fridolin Somers 2014-06-18 15:40:08 UTC
Pushed to 3.14.x, will be in 3.14.08