Skip to content
Extraits de code Groupes Projets
Valider 08c7e263 rédigé par Matthieu Aubry's avatar Matthieu Aubry
Parcourir les fichiers

Merge pull request #8974 from piwik/left_menu_tweaks

Left menu tweaks
parents dee81718 8a0e1350
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -250,6 +250,7 @@ class CoreHome extends \Piwik\Plugin ...@@ -250,6 +250,7 @@ class CoreHome extends \Piwik\Plugin
$translationKeys[] = 'Intl_Day_Min_StandAlone_5'; $translationKeys[] = 'Intl_Day_Min_StandAlone_5';
$translationKeys[] = 'Intl_Day_Min_StandAlone_6'; $translationKeys[] = 'Intl_Day_Min_StandAlone_6';
$translationKeys[] = 'Intl_Day_Min_StandAlone_7'; $translationKeys[] = 'Intl_Day_Min_StandAlone_7';
$translationKeys[] = 'General_And';
$translationKeys[] = 'General_Search'; $translationKeys[] = 'General_Search';
$translationKeys[] = 'General_Clear'; $translationKeys[] = 'General_Clear';
$translationKeys[] = 'General_MoreDetails'; $translationKeys[] = 'General_MoreDetails';
...@@ -272,5 +273,7 @@ class CoreHome extends \Piwik\Plugin ...@@ -272,5 +273,7 @@ class CoreHome extends \Piwik\Plugin
$translationKeys[] = 'CoreHome_PivotBySubtable'; $translationKeys[] = 'CoreHome_PivotBySubtable';
$translationKeys[] = 'CoreHome_QuickAccessTitle'; $translationKeys[] = 'CoreHome_QuickAccessTitle';
$translationKeys[] = 'CoreHome_Segments'; $translationKeys[] = 'CoreHome_Segments';
$translationKeys[] = 'CoreHome_MenuEntries';
$translationKeys[] = 'SitesManager_Sites';
} }
} }
<div class="quick-access" title="{{ 'CoreHome_QuickAccessTitle' | translate }}" <div class="quick-access" title="{{ quickAccessTitle }}"
ng-class="{active: view.searchActive, expanded: view.searchActive}" ng-class="{active: view.searchActive, expanded: view.searchActive}"
piwik-focus-anywhere-but-here="view.searchActive = false;"> piwik-focus-anywhere-but-here="view.searchActive = false;">
<span class="icon-search" ng-hide="search.term || view.searchActive" <span class="icon-search" ng-hide="search.term || view.searchActive"
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
(function () { (function () {
angular.module('piwikApp').directive('piwikQuickAccess', QuickAccessDirective); angular.module('piwikApp').directive('piwikQuickAccess', QuickAccessDirective);
QuickAccessDirective.$inject = ['$rootElement', '$timeout', 'piwik']; QuickAccessDirective.$inject = ['$rootElement', '$timeout', 'piwik', '$filter'];
function QuickAccessDirective ($rootElement, $timeout, piwik) { function QuickAccessDirective ($rootElement, $timeout, piwik, $filter) {
return { return {
restrict: 'A', restrict: 'A',
...@@ -33,7 +33,31 @@ ...@@ -33,7 +33,31 @@
var leftMenuItems = []; // cache for left menu items var leftMenuItems = []; // cache for left menu items
var segmentItems = []; // cache for segment items var segmentItems = []; // cache for segment items
var hasSegmentSelector = angular.element('.segmentEditorPanel').length; var hasSegmentSelector = angular.element('.segmentEditorPanel').length;
scope.hasSitesSelector = angular.element('[piwik-siteselector]').length; scope.hasSitesSelector = angular.element('.top_controls [piwik-siteselector]').length;
var translate = $filter('translate');
var searchAreasTitle = '';
var searchAreas = [translate('CoreHome_MenuEntries')]
if (hasSegmentSelector) {
searchAreas.push(translate('CoreHome_Segments'))
}
if (scope.hasSitesSelector) {
searchAreas.push(translate('SitesManager_Sites'))
}
while (searchAreas.length) {
searchAreasTitle += searchAreas.shift();
if (searchAreas.length >= 2) {
searchAreasTitle += ', ';
} else if (searchAreas.length === 1) {
searchAreasTitle += ' ' + translate('General_And') + ' ';
}
}
scope.quickAccessTitle = translate('CoreHome_QuickAccessTitle', searchAreasTitle);
function trim(str) { function trim(str) {
return str.replace(/^\s+|\s+$/g,''); return str.replace(/^\s+|\s+$/g,'');
......
...@@ -56,9 +56,6 @@ menu.prototype = ...@@ -56,9 +56,6 @@ menu.prototype =
var href = link.attr('href'); var href = link.attr('href');
if (!href) { if (!href) {
if (main_menu && !$this.find('li').length) {
$this.hide(); // no link and no child menu items -> hide it
}
return; return;
} }
var url = href.substr(1); var url = href.substr(1);
......
...@@ -15,12 +15,13 @@ $(function () { ...@@ -15,12 +15,13 @@ $(function () {
initTopControls(); initTopControls();
} }
if(isPageIsAdmin) { if (isPageIsAdmin) {
// don't use broadcast in admin page // don't use broadcast in admin page
initTopControls(); initTopControls();
return; return;
} }
if(isPageHasMenu) {
if (isPageHasMenu) {
broadcast.init(); broadcast.init();
} else { } else {
broadcast.init(true); broadcast.init(true);
......
...@@ -26,6 +26,8 @@ function initTopControls() { ...@@ -26,6 +26,8 @@ function initTopControls() {
var $topControlsContainer = $('.top_controls'), var $topControlsContainer = $('.top_controls'),
left = 0; left = 0;
var allRendered = true;
if ($topControlsContainer.length) { if ($topControlsContainer.length) {
$('.piwikTopControl').each(function () { $('.piwikTopControl').each(function () {
var $control = $(this); var $control = $(this);
...@@ -34,10 +36,22 @@ function initTopControls() { ...@@ -34,10 +36,22 @@ function initTopControls() {
} }
$control.css('left', left); $control.css('left', left);
var width = $control.outerWidth(true);
var isControlFullyRendered = width >= 30;
if (!isControlFullyRendered) {
allRendered = false;
}
left += $control.outerWidth(true); left += width;
}); });
if (allRendered) {
// we make top controls visible only after all selectors are rendered
$('.top_controls').css('visibility', 'visible');
$('.top_controls').css('opacity', '1');
}
var header = $('#header_message.isPiwikDemo'); var header = $('#header_message.isPiwikDemo');
if (header.length) { if (header.length) {
// make sure isPiwikDemo message is always fully visible, move it to the right if needed // make sure isPiwikDemo message is always fully visible, move it to the right if needed
......
...@@ -49,7 +49,8 @@ ...@@ -49,7 +49,8 @@
"ClickRowToExpandOrContract": "Click this row to expand or contract the subtable.", "ClickRowToExpandOrContract": "Click this row to expand or contract the subtable.",
"UndoPivotBySubtable": "This report has been pivoted %s Undo pivot", "UndoPivotBySubtable": "This report has been pivoted %s Undo pivot",
"PivotBySubtable": "This report is not pivoted %s Pivot by %s", "PivotBySubtable": "This report is not pivoted %s Pivot by %s",
"QuickAccessTitle": "Search for menu entries, segments and websites. Shortcut: Press 'f' to search.", "QuickAccessTitle": "Search for %s. Shortcut: Press 'f' to search.",
"MenuEntries": "Menu entries",
"Segments": "Segments", "Segments": "Segments",
"AdblockIsMaybeUsed": "In case you are using an ad blocker, please disable it for this site to make sure Piwik works without any issues." "AdblockIsMaybeUsed": "In case you are using an ad blocker, please disable it for this site to make sure Piwik works without any issues."
} }
......
...@@ -352,6 +352,8 @@ ...@@ -352,6 +352,8 @@
#root { #root {
.top_controls { .top_controls {
visibility: hidden;
opacity: 0;
.piwikTopControl { .piwikTopControl {
margin-top: 8px; margin-top: 8px;
margin-bottom: 8px; margin-bottom: 8px;
......
...@@ -41,24 +41,37 @@ ...@@ -41,24 +41,37 @@
</div> </div>
<ul class="navbar"> <ul class="navbar">
{% for level1,level2 in menu %} {% for level1,level2 in menu %}
<li id="{% if level2._url is defined and level2._url is not empty %}{{ _self.getId(level2._url) }}{% endif %}" class="menuTab"> {% set hasMainCategoryUrl = level2._url is defined and level2._url is not empty %}
<a class="item" {% if level2._url is defined and level2._url is not empty %}href="{% if anchorlink %}#{% else %}index.php?{% endif %}{{ _self.getFirstUrl(level2._url) }}"{% endif %}> {% set hasSubmenuItem = false %}
<span class="menu-icon {{ level2._icon|default('icon-arrow-right') }}"></span>{{ level1|translate }} {% for name,urlParameters in level2 %}
<span class="hidden"> {% if urlParameters._url is defined and urlParameters._url is not iterable %}
{{ 'CoreHome_Menu'|translate }} {% set hasSubmenuItem = true %}
</span> {% elseif name|slice(0,1) != '_' %}
</a> {% set hasSubmenuItem = true %}
<ul> {% endif %}
{% for name,urlParameters in level2 %} {% endfor %}
{% if urlParameters._url is defined and urlParameters._url is not iterable %}
{{ _self.groupedItem(name,urlParameters._url, anchorlink) }} {% if hasMainCategoryUrl or hasSubmenuItem %}
{% elseif name|slice(0,1) != '_' %} <li id="{% if level2._url is defined and level2._url is not empty %}{{ _self.getId(level2._url) }}{% endif %}" class="menuTab">
{{ _self.submenuItem(name,urlParameters._url, anchorlink) }}
{% endif %} <a class="item" {% if hasMainCategoryUrl %}href="{% if anchorlink %}#{% else %}index.php?{% endif %}{{ _self.getFirstUrl(level2._url) }}"{% endif %}>
{% endfor %} <span class="menu-icon {{ level2._icon|default('icon-arrow-right') }}"></span>{{ level1|translate }}
</ul> <span class="hidden">
</li> {{ 'CoreHome_Menu'|translate }}
</span>
</a>
<ul>
{% for name,urlParameters in level2 %}
{% if urlParameters._url is defined and urlParameters._url is not iterable %}
{{ _self.groupedItem(name,urlParameters._url, anchorlink) }}
{% elseif name|slice(0,1) != '_' %}
{{ _self.submenuItem(name,urlParameters._url, anchorlink) }}
{% endif %}
{% endfor %}
</ul>
</li>
{% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
......
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