From cf072a67f88221f4e34fdb79ea186788dfb01679 Mon Sep 17 00:00:00 2001 From: vAugagneur Date: Wed, 23 Nov 2011 12:59:02 +0000 Subject: [PATCH] //clean header.tpl and footer.tpl --- admin-dev/themes/template/footer.tpl | 92 ---------------------------- admin-dev/themes/template/header.tpl | 23 +++---- classes/AdminController.php | 4 +- js/helpAccess.js | 25 ++++++++ js/toolbar.js | 68 ++++++++++++++++++++ 5 files changed, 103 insertions(+), 109 deletions(-) create mode 100644 js/helpAccess.js create mode 100644 js/toolbar.js diff --git a/admin-dev/themes/template/footer.tpl b/admin-dev/themes/template/footer.tpl index d3dcb8ca6..c7ee3e005 100644 --- a/admin-dev/themes/template/footer.tpl +++ b/admin-dev/themes/template/footer.tpl @@ -55,98 +55,6 @@ {/if} diff --git a/admin-dev/themes/template/header.tpl b/admin-dev/themes/template/header.tpl index 63244c32b..38dba83a5 100644 --- a/admin-dev/themes/template/header.tpl +++ b/admin-dev/themes/template/header.tpl @@ -31,6 +31,11 @@ {$meta_title} - PrestaShop™ {if $display_header} {/foreach} {/if} - {if $display_header} - - {/if} + + {if $display_header} {$HOOK_HEADER} {/if} diff --git a/classes/AdminController.php b/classes/AdminController.php index 2f19ef973..407988679 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -1503,7 +1503,9 @@ class AdminControllerCore extends Controller _PS_JS_DIR_.'toggle.js', _PS_JS_DIR_.'tools.js', _PS_JS_DIR_.'ajax.js', - _PS_JS_DIR_.'notifications.js' + _PS_JS_DIR_.'notifications.js', + _PS_JS_DIR_.'helpAccess.js', + _PS_JS_DIR_.'toolbar.js' )); } /** diff --git a/js/helpAccess.js b/js/helpAccess.js new file mode 100644 index 000000000..a8d6cdc4e --- /dev/null +++ b/js/helpAccess.js @@ -0,0 +1,25 @@ +$(document).ready(function(){ + if($('.help-context')) + { + $.ajax({ + type: 'POST', + url: 'index.php', + data: { + 'ajax' : '1', + 'action' : 'helpAccess', + 'item' : class_name, + 'isoUser' : iso_user, + 'country' : country_iso_code, + 'version' : _PS_VERSION_ + }, + async : true, + success: function(msg) { + if(msg.status == 'ok' && msg.content != 'none') + { + $(".help-context").html(msg.content); + $(".help-context").fadeIn("slow").show(); + } + } + }); + } +}); \ No newline at end of file diff --git a/js/toolbar.js b/js/toolbar.js new file mode 100644 index 000000000..bfc2dfbe1 --- /dev/null +++ b/js/toolbar.js @@ -0,0 +1,68 @@ +$(document).ready(function(){ + var message = $('.toolbarHead'); + var view = $(window); + + // bind only if message exists. placeholder will be its parent + view.bind("scroll resize", function(e) + { + message.each(function(el){ + if (message.length) + { + placeholder = $(this).parent(); + if(e.type == 'resize') + $(this).css('width', $(this).parent().width()); + + placeholderTop = placeholder.offset().top; + var viewTop = view.scrollTop() + 15; + // here we force the toolbar to be "not fixed" when + // the height of the window is really small (toolbar hiding the page is not cool) + window_is_more_than_twice_the_toolbar = view.height() > message.parent().height() * 2; + if (!$(this).hasClass("fix-toolbar") && (window_is_more_than_twice_the_toolbar && (viewTop > placeholderTop))) + { + $(this).css('width', $(this).width()); + // fixing parent height will prevent that annoying "pagequake" thing + // the order is important : this has to be set before adding class fix-toolbar + $(this).parent().css('height', $(this).parent().height()); + $(this).addClass("fix-toolbar"); + } + else if ($(this).hasClass("fix-toolbar") && (!window_is_more_than_twice_the_toolbar || (viewTop <= placeholderTop)) ) + { + $(this).removeClass("fix-toolbar"); + } + } + }); + }); // end bind + + // if count errors + $('#hideError').live('click', function(e) + { + e.preventDefault(); + $('.error').hide('slow', function (){ + $('.error').remove(); + }); + return false; + }); + + // if count warnings + $('#linkSeeMore').live('click', function(e){ + e.preventDefault(); + $('#seeMore').show('slow'); + $(this).hide(); + $('#linkHide').show(); + return false; + }); + $('#linkHide').live('click', function(e){ + e.preventDefault(); + $('#seeMore').hide('slow'); + $(this).hide(); + $('#linkSeeMore').show(); + return false; + }); + $('#hideWarn').live('click', function(e){ + e.preventDefault(); + $('.warn').hide('slow', function (){ + $('.warn').remove(); + }); + return false; + }); +}); \ No newline at end of file