From 92b26b3f9ba10e234d8c1eb282fe2b5e28b430d3 Mon Sep 17 00:00:00 2001 From: Josef Moravec <josef.moravec@gmail.com> Date: Mon, 25 Jun 2018 14:43:29 +0000 Subject: [PATCH] Bug 15326: (follow-up) Move js to footer, use Asset plugin Signed-off-by: Josef Moravec <josef.moravec@gmail.com> --- .../prog/en/modules/tools/cmspages.tt | 115 +++++++++++---------- 1 file changed, 60 insertions(+), 55 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt index d67bc0f..d2082ae 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt @@ -1,66 +1,14 @@ [% USE KohaDates %] [% USE Koha %] +[% USE Asset %] +[% SET footerjs = 1 %] [% SET link_opac_base = Koha.Preference( 'OPACBaseURL' ) %] [% SET link_opac = link_opac_base _ '/cgi-bin/koha/opac-cmspages.pl' %] [% INCLUDE 'doc-head-open.inc' %] <title>Koha › Tools › Pages</title> [% INCLUDE 'doc-head-close.inc' %] -<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> +[% Asset.css("css/datatables.css") %] [% INCLUDE 'datatables.inc' %] -<script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script> -<script type="text/javascript">//<![CDATA[ -$(document).ready(function() { - $("#pages_table").dataTable($.extend(true, {}, dataTablesDefaults, { - "aoColumnDefs": [ - { "aTargets": [ 0, -1 ], "bSortable": false, "bSearchable": false }, - ], - "sPaginationType": "full_numbers" - })); - - $("#del_button").on("click",function(){ - if ($("input[name='ids'][type='checkbox']:checked").length){ - return confirmDelete(_("Are you sure you want to delete the selected page(s)?")); - } else { - alert(_("No pages have been selected.")); - return false; - } - }); - - $(".del_single").on("click", function(){ - return confirmDelete(_("Are you sure you want to delete this page?")); - }); - - $(".SelectAll").on("click", function(){ - $("input[name='ids'][type='checkbox']").prop("checked", true); - }); - - $(".ClearAll").on("click", function(){ - $("input[name='ids'][type='checkbox']").prop("checked", false); - }); -}); - -tinyMCE.init({ - mode : "textareas", - theme : "advanced", - convert_urls : false, - relative_urls : false, - content_css : "[% themelang %]/css/tinymce.css", - plugins : "table,save,advhr,advlink,searchreplace,print,contextmenu", - theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,search,replace,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,|,print", - theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap", - theme_advanced_buttons3 : "", - theme_advanced_toolbar_location : "top", - theme_advanced_toolbar_align : "left", - theme_advanced_path_location : "bottom", - theme_advanced_resizing : true, - plugin_insertdate_dateFormat : "%Y-%m-%d", - plugin_insertdate_timeFormat : "%H:%M:%S", - apply_source_formatting : true, - height : "300", - width : "700" -//]]> -}); -</script> </head> <body id="tools_koha-content" class="tools"> [% INCLUDE 'header.inc' %] @@ -323,4 +271,61 @@ tinyMCE.init({ </div> [% END %] </div> +[% MACRO jsinclude BLOCK %] +[% Asset.js("lib/tiny_mce/tiny_mce.js") %] +<script type="text/javascript">//<![CDATA[ +$(document).ready(function() { + $("#pages_table").dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumnDefs": [ + { "aTargets": [ 0, -1 ], "bSortable": false, "bSearchable": false }, + ], + "sPaginationType": "full_numbers" + })); + + $("#del_button").on("click",function(){ + if ($("input[name='ids'][type='checkbox']:checked").length){ + return confirmDelete(_("Are you sure you want to delete the selected page(s)?")); + } else { + alert(_("No pages have been selected.")); + return false; + } + }); + + $(".del_single").on("click", function(){ + return confirmDelete(_("Are you sure you want to delete this page?")); + }); + + $(".SelectAll").on("click", function(){ + $("input[name='ids'][type='checkbox']").prop("checked", true); + }); + + $(".ClearAll").on("click", function(){ + $("input[name='ids'][type='checkbox']").prop("checked", false); + }); +}); + +tinyMCE.baseURL = "[% interface %]/lib/tiny_mce"; +tinyMCE.init({ + mode : "textareas", + theme : "advanced", + convert_urls : false, + relative_urls : false, + content_css : "[% interface %]/[% theme %]/css/tinymce.css", + plugins : "table,save,advhr,advlink,searchreplace,print,contextmenu", + theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,search,replace,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,|,print", + theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap", + theme_advanced_buttons3 : "", + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "left", + theme_advanced_path_location : "bottom", + theme_advanced_resizing : true, + plugin_insertdate_dateFormat : "%Y-%m-%d", + plugin_insertdate_timeFormat : "%H:%M:%S", + apply_source_formatting : true, + height : "300", + width : "700" +}); +//]]> +</script> +[% END %] [% INCLUDE 'intranet-bottom.inc' %] -- 2.1.4