Bug 19710: Move plugins templates javascript to the footer

This patch modifies the staff client plugins template so that
JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of
the modified template:

- The plugins link should be bold in the sidebar menu.
- Choosing "Uninstall" for an installed plugin should trigger a
  confirmation alert.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

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:
Owen Leonard 2017-11-28 19:04:43 +00:00 committed by Jonathan Druart
parent 44e7d5e84b
commit 76d9c74ffa
2 changed files with 16 additions and 10 deletions

View File

@ -1,17 +1,8 @@
[% USE KohaDates %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Plugins </title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'calendar.inc' %]
<script type="text/javascript">
$(document).ready(function(){
$(".uninstall_plugin").on("click", function(){
$(".dropdown").removeClass("open");
var plugin_name = $(this).data("plugin-name");
return confirmDelete( _("Are you sure you want to uninstall the plugin %s?").format( plugin_name ) );
});
});
</script>
</head>
<body id="plugins_plugins_home" class="plugins">
@ -142,5 +133,18 @@
</div>
</div>
[% MACRO jsinclude BLOCK %]
<script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
[% INCLUDE 'calendar.inc' %]
<script type="text/javascript">
$(document).ready(function(){
$(".uninstall_plugin").on("click", function(){
$(".dropdown").removeClass("open");
var plugin_name = $(this).data("plugin-name");
return confirmDelete( _("Are you sure you want to uninstall the plugin %s?").format( plugin_name ) );
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]

View File

@ -12,6 +12,8 @@
$('#navmenulist a[href$="/cgi-bin/koha/tools/batchMod.pl?del=1"]').css('font-weight','bold');
} else if (path.indexOf("quotes-upload.pl") >= 0 ){
$('#navmenulist a[href$="/cgi-bin/koha/tools/quotes.pl"]').css('font-weight','bold');
} else if (path.indexOf("plugins") >= 0 ) {
$('#navmenulist a[href$="/cgi-bin/koha/plugins/plugins-home.pl?method=tool"]').css('font-weight','bold');
} else {
$('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold');
}