Bugzilla – Attachment 25824 Details for
Bug 11878
Eliminate use of deprecated jQuery .toggle() method usage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11878 - Eliminate use of deprecated jQuery .toggle() method usage
Bug-11878---Eliminate-use-of-deprecated-jQuery-tog.patch (text/plain), 6.06 KB, created by
Owen Leonard
on 2014-03-04 17:20:55 UTC
(
hide
)
Description:
Bug 11878 - Eliminate use of deprecated jQuery .toggle() method usage
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2014-03-04 17:20:55 UTC
Size:
6.06 KB
patch
obsolete
>From 26a37f6e53a68a16a8e01b67401864999c78a008 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 4 Mar 2014 08:19:57 -0500 >Subject: [PATCH] Bug 11878 - Eliminate use of deprecated jQuery .toggle() > method usage >Content-Type: text/plain; charset="utf-8" > >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. >--- > .../intranet-tmpl/prog/en/js/pages/preferences.js | 14 ++++----- > .../bootstrap/en/modules/opac-MARCdetail.tt | 33 +++++++++++--------- > .../opac-tmpl/prog/en/modules/opac-MARCdetail.tt | 33 +++++++++++--------- > 3 files changed, 43 insertions(+), 37 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js >index 8fe6369..80b8429 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js >@@ -95,16 +95,16 @@ $( document ).ready( function () { > $("h3").attr("class","expanded").attr("title",MSG_CLICK_TO_EXPAND); > var collapsible = $(".collapsed,.expanded"); > >- $(collapsible).toggle( >- function () { >+ $(collapsible).on("click",function(){ >+ var panel = $(this).next("div"); >+ if(panel.is(":visible")){ > $(this).addClass("collapsed").removeClass("expanded").attr("title",MSG_CLICK_TO_EXPAND); >- $(this).next("div").hide(); >- }, >- function () { >+ panel.hide(); >+ } else { > $(this).addClass("expanded").removeClass("collapsed").attr("title",MSG_CLICK_TO_COLLAPSE); >- $(this).next("div").show(); >+ panel.show(); > } >- ); >+ }); > > if ( to_highlight ) { > var words = to_highlight.split( ' ' ); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-MARCdetail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-MARCdetail.tt >index d731c7d..004eecd 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-MARCdetail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-MARCdetail.tt >@@ -182,23 +182,26 @@ $(document).ready(function(){ > }); > > var loaded = 0; >- $("#switchview").toggle( >- function () { >- $(this).text(_("view labeled")); >- $("#labeledmarc").hide(); >- if(!loaded){ >- $("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface %]/[% theme %]/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=[% biblionumber %]&viewas=html"); >- loaded = 1; >+ var toggle = 0; >+ $("#switchview").on("click",function(e){ >+ e.preventDefault(); >+ if( toggle == 0){ >+ $(this).text(_("view labeled")); >+ $("#labeledmarc").hide(); >+ if(!loaded){ >+ $("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface %]/[% theme %]/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=[% biblionumber %]&viewas=html"); >+ loaded = 1; >+ } else { >+ $("#plainmarc").show(); >+ } >+ toggle = 1; > } else { >- $("#plainmarc").show(); >+ $(this).text(_("view plain")); >+ $("#labeledmarc").show(); >+ $("#plainmarc").hide(); >+ toggle = 0; > } >- }, >- function () { >- $(this).text(_("view plain")); >- $("#labeledmarc").show(); >- $("#plainmarc").hide(); >- } >- ); >+ }); > }); > [% END %] > //]]> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt >index 6e57f08..ee097fd 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt >@@ -33,23 +33,26 @@ $(document).ready(function(){ > }); > > var loaded = 0; >- $("#switchview").toggle( >- function () { >- $(this).text(_("view labeled")); >- $("#labeledmarc").hide(); >- if(!loaded){ >- $("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface %]/[% theme %]/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=[% biblionumber %]&viewas=html"); >- loaded = 1; >+ var toggle = 0; >+ $("#switchview").on("click",function(e){ >+ e.preventDefault(); >+ if( toggle == 0){ >+ $(this).text(_("view labeled")); >+ $("#labeledmarc").hide(); >+ if(!loaded){ >+ $("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface %]/[% theme %]/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=[% biblionumber %]&viewas=html"); >+ loaded = 1; >+ } else { >+ $("#plainmarc").show(); >+ } >+ toggle = 1; > } else { >- $("#plainmarc").show(); >+ $(this).text(_("view plain")); >+ $("#labeledmarc").show(); >+ $("#plainmarc").hide(); >+ toggle = 0; > } >- }, >- function () { >- $(this).text(_("view plain")); >- $("#labeledmarc").show(); >- $("#plainmarc").hide(); >- } >- ); >+ }); > }); > [% END %] > //]]> >-- >1.7.9.5
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 11878
:
25824
|
25831
|
25841
|
26378