[views] Drop buggy monkey-patch on add_onload
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 25 Aug 2017 13:03:50 +0200
changeset 295 9f380df8b72e
parent 293 959dd18ff044
child 296 3fedbeede3d9
[views] Drop buggy monkey-patch on add_onload this has been inadvertently copied from francearchive and has nasty side effect since it also remove a wrapper that makes the js code called once the page is fully loaded.
cubicweb_sherpa/views/templates.py
--- a/cubicweb_sherpa/views/templates.py	Fri Aug 25 09:58:03 2017 +0200
+++ b/cubicweb_sherpa/views/templates.py	Fri Aug 25 13:03:50 2017 +0200
@@ -16,10 +16,8 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 """sherpa views/templates"""
 
-from logilab.common.decorators import monkeypatch
-
 from cubicweb import NotAnEntity
-from cubicweb.utils import HTMLHead, UStringIO
+from cubicweb.utils import UStringIO
 from cubicweb.web.views import basetemplates
 
 from . import jinja_render
@@ -29,16 +27,6 @@
 basetemplates.TheMainTemplate.twbs_container_cls = 'container-fluid'
 
 
-@monkeypatch(HTMLHead)
-def add_onload(self, jscode):
-    """original `add_onload` implementation use `$(cw)`
-    but `cw` variable is not available
-    in francearchive, use `$` instead"""
-    self.add_post_inline_script(u"""$(function() {
-  %s
-});""" % jscode)
-
-
 def render_component(comp):
     stream = UStringIO()
     w = stream.write