Skip to content
Extraits de code Groupes Projets
Valider cb36cba1 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

make sure widgets in admin are positioned correctly

parent 2988260c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
function piwikContentBlock(piwik){ function piwikContentBlock(piwik){
var contentTopPosition = null; var adminContent = null;
return { return {
restrict: 'A', restrict: 'A',
...@@ -47,24 +47,35 @@ ...@@ -47,24 +47,35 @@
scope.feature = scope.contentTitle; scope.feature = scope.contentTitle;
} }
if (contentTopPosition !== false) { if (adminContent === null) {
if (contentTopPosition === null) { // cache admin node for further content blocks
var $content = $('#content.admin'); adminContent = $('#content.admin');
if ($content.size()) { }
// cache top position for further content blocks
contentTopPosition = $content.offset().top; var contentTopPosition;
} else {
contentTopPosition = false; if (adminContent.size()) {
} contentTopPosition = adminContent.offset().top;
} else {
contentTopPosition = false;
}
if (contentTopPosition || contentTopPosition === 0) {
var parents = element.parentsUntil('.col', '[piwik-widget-loader]');
var topThis;
if (parents.size()) {
// when shown within the widget loader, we need to get the offset of that element
// as the widget loader might be still shown. Would otherwise not position correctly
// the widgets on the admin home page
topThis = parents.offset().top;
} else {
topThis = element.offset().top;
} }
if (contentTopPosition || contentTopPosition === 0) { if ((topThis - contentTopPosition) < 17) {
var topThis = element.offset().top; // we make sure to display the first card with no margin-top to have it on same as line as
if ((topThis - contentTopPosition) < 17) { // navigation
// we make sure to display the first card with no margin-top to have it on same as line as element.css('marginTop', '0');
// navigation
element.css('marginTop', '0');
}
} }
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter