Sha256: 742139c4eb71f0ba687674b2b233c8b4590ed37c3d8d1a47c705bbd2b6c12503
Contents?: true
Size: 659 Bytes
Versions: 1
Compression:
Stored size: 659 Bytes
Contents
module Opale module ScriptInserter BODY_TAG = %r{</body>} JS_SCRIPT = %q( <script> function sortable(event, column) { console.log("sortable"); var direction = $("#direction").val(); $("#sort").val(column); $("#direction").val(direction == "desc" ? "asc" : "desc"); $('#direction').parent().submit(); //event.preventDefault(); } </script> ) def insert_opalejs if ( response.content_type == 'text/html' && response.body.match(BODY_TAG) ) response.body = response.body.gsub(BODY_TAG, JS_SCRIPT + '\\0') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opale-0.1.31 | lib/opale/script_inserter.rb |