Bug 19607: Move admin templates JavaScript to the footer: Basic parameters
This patch modifies the staff client catalog-related administration templates so that JavaScript is included in the footer instead of the header. To test, apply the patch and test the JavaScript-driven features of each modified template: All button controls, DataTables functionality, tabs, etc. Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com> Edit: Rebased on Bug 19560 Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
04d79ba063
commit
00cfd934c1
|
|
@ -1,3 +1,4 @@
|
|||
[% SET footerjs = 1 %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>Koha › Administration › Authorized values
|
||||
[% IF op == 'add_form' %]
|
||||
|
|
@ -9,42 +10,6 @@
|
|||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
$(document).ready(function() {
|
||||
$("#table_authorized_values").dataTable($.extend(true, {}, dataTablesDefaults, {
|
||||
"aoColumnDefs": [
|
||||
{ "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
|
||||
],
|
||||
"aaSorting": [[ 1, "asc" ]],
|
||||
"sPaginationType": "four_button"
|
||||
}));
|
||||
|
||||
if ( $("#branches option:selected").length < 1 ) {
|
||||
$("#branches option:first").attr("selected", "selected");
|
||||
}
|
||||
$('#icons').tabs();
|
||||
|
||||
$("a.delete").click(function(){
|
||||
return confirm(_("Are you sure you want to delete this authorized value?"));
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
[% IF op == 'list' %]
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
$(document).ready(function() {
|
||||
$('#category').find("input:submit").hide();
|
||||
$('#searchfield').change(function() {
|
||||
$('#category').submit();
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
[% END %]
|
||||
|
||||
<style type="text/css">
|
||||
fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
|
||||
|
|
@ -53,6 +18,7 @@ $(document).ready(function() {
|
|||
fieldset.rows .ui-tabs-nav { margin-left : 10px; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body id="admin_authorised_values" class="admin">
|
||||
[% INCLUDE 'header.inc' %]
|
||||
[% INCLUDE 'prefs-admin-search.inc' %]
|
||||
|
|
@ -313,4 +279,36 @@ $(document).ready(function() {
|
|||
[% INCLUDE 'admin-menu.inc' %]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
<script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#table_authorized_values").dataTable($.extend(true, {}, dataTablesDefaults, {
|
||||
"aoColumnDefs": [
|
||||
{ "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
|
||||
],
|
||||
"aaSorting": [[ 1, "asc" ]],
|
||||
"sPaginationType": "four_button"
|
||||
}));
|
||||
|
||||
if ( $("#branches option:selected").length < 1 ) {
|
||||
$("#branches option:first").attr("selected", "selected");
|
||||
}
|
||||
$('#icons').tabs();
|
||||
|
||||
$("a.delete").click(function(){
|
||||
return confirm(_("Are you sure you want to delete this authorized value?"));
|
||||
});
|
||||
[% IF op == 'list' %]
|
||||
$('#category').find("input:submit").hide();
|
||||
$('#searchfield').change(function() {
|
||||
$('#category').submit();
|
||||
});
|
||||
[% END %]
|
||||
});
|
||||
</script>
|
||||
|
||||
[% END %]
|
||||
[% INCLUDE 'intranet-bottom.inc' %]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
[% SET footerjs = 1 %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>Koha › Administration › Libraries and groups
|
||||
[% IF op == 'editcategory' %]
|
||||
|
|
@ -12,48 +13,8 @@
|
|||
</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/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() {
|
||||
$("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, {
|
||||
"aoColumnDefs": [
|
||||
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
|
||||
],
|
||||
"iDisplayLength": 10,
|
||||
"sPaginationType": "four_button"
|
||||
}));
|
||||
|
||||
[% UNLESS library %]
|
||||
$("#Aform").on("submit", function( event ) {
|
||||
if ( $("#branchcode").val().match(/\s/) ) {
|
||||
event.preventDefault();
|
||||
alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
[% END %]
|
||||
});
|
||||
tinyMCE.init({
|
||||
mode : "textareas",
|
||||
theme : "advanced",
|
||||
content_css : "[% interface %]/[% theme %]/css/tinymce.css",
|
||||
plugins : "table,save,advhr,advlink,contextmenu",
|
||||
theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,",
|
||||
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,
|
||||
apply_source_formatting : true
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body id="admin_branches" class="admin">
|
||||
[% INCLUDE 'header.inc' %]
|
||||
[% INCLUDE 'prefs-admin-search.inc' %]
|
||||
|
|
@ -407,4 +368,48 @@ tinyMCE.init({
|
|||
[% INCLUDE 'admin-menu.inc' %]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
<script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, {
|
||||
"aoColumnDefs": [
|
||||
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
|
||||
],
|
||||
"iDisplayLength": 10,
|
||||
"sPaginationType": "four_button"
|
||||
}));
|
||||
|
||||
[% UNLESS library %]
|
||||
$("#Aform").on("submit", function( event ) {
|
||||
if ( $("#branchcode").val().match(/\s/) ) {
|
||||
event.preventDefault();
|
||||
alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
[% END %]
|
||||
});
|
||||
tinyMCE.init({
|
||||
mode : "textareas",
|
||||
theme : "advanced",
|
||||
content_css : "[% interface %]/[% theme %]/css/tinymce.css",
|
||||
plugins : "table,save,advhr,advlink,contextmenu",
|
||||
theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,",
|
||||
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,
|
||||
apply_source_formatting : true
|
||||
});
|
||||
</script>
|
||||
[% END %]
|
||||
|
||||
[% INCLUDE 'intranet-bottom.inc' %]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[% USE Koha %]
|
||||
[% USE AuthorisedValues %]
|
||||
[% USE Price %]
|
||||
[% SET footerjs = 1 %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>Koha › Administration › Item types [% IF op == 'add_form' %]›
|
||||
[% IF ( itemtype ) %]
|
||||
|
|
@ -22,33 +23,6 @@ Data deleted
|
|||
</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
|
||||
[% INCLUDE 'greybox.inc' %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
$(document).ready(function() {
|
||||
$('#icons').tabs();
|
||||
$("#table_item_type").dataTable($.extend(true, {}, dataTablesDefaults, {
|
||||
"aoColumnDefs": [
|
||||
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
|
||||
],
|
||||
"aaSorting": [[ 2, "asc" ]],
|
||||
"iDisplayLength": 10,
|
||||
"sPaginationType": "four_button"
|
||||
}));
|
||||
$( "#itemtypeentry" ).validate({
|
||||
rules: {
|
||||
itemtype: { required: true },
|
||||
description: { required: true },
|
||||
rentalcharge: { number: true }
|
||||
}
|
||||
});
|
||||
$("#itemtype").on("blur",function(){
|
||||
toUC(this);
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
<style type="text/css">
|
||||
fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
|
||||
fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-active {background-color : #F4F8F9; }
|
||||
|
|
@ -56,6 +30,7 @@ Data deleted
|
|||
fieldset.rows .ui-tabs-nav { margin-left : 10px; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body id="admin_itemtypes" class="admin">
|
||||
[% INCLUDE 'header.inc' %]
|
||||
[% INCLUDE 'prefs-admin-search.inc' %]
|
||||
|
|
@ -418,4 +393,33 @@ Item types administration
|
|||
[% INCLUDE 'admin-menu.inc' %]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
<script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
|
||||
[% INCLUDE 'greybox.inc' %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#icons').tabs();
|
||||
$("#table_item_type").dataTable($.extend(true, {}, dataTablesDefaults, {
|
||||
"aoColumnDefs": [
|
||||
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
|
||||
],
|
||||
"aaSorting": [[ 2, "asc" ]],
|
||||
"iDisplayLength": 10,
|
||||
"sPaginationType": "four_button"
|
||||
}));
|
||||
$( "#itemtypeentry" ).validate({
|
||||
rules: {
|
||||
itemtype: { required: true },
|
||||
description: { required: true },
|
||||
rentalcharge: { number: true }
|
||||
}
|
||||
});
|
||||
$("#itemtype").on("blur",function(){
|
||||
toUC(this);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
[% END %]
|
||||
[% INCLUDE 'intranet-bottom.inc' %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue