summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Haertl <jus@bitgrid.net>2017-03-01 23:04:27 +0100
committerJulius Härtl <jus@bitgrid.net>2017-03-16 11:55:09 +0100
commita630e4629f2489e9d7678fbe6833cf926e2b968e (patch)
treebdca715c7274eb4323eabc9e2fda8fa535f8eaf8
parente3e4cb3e67fb4d1399b4a9cf229633144008fdcf (diff)
downloadnextcloud-server-a630e4629f2489e9d7678fbe6833cf926e2b968e.tar.gz
nextcloud-server-a630e4629f2489e9d7678fbe6833cf926e2b968e.zip
Generate seperate menu list for header bar
Signed-off-by: Julius Haertl <jus@bitgrid.net>
-rw-r--r--core/css/header.scss13
-rw-r--r--core/templates/layout.user.php36
-rw-r--r--lib/private/TemplateLayout.php2
-rw-r--r--lib/private/legacy/app.php44
4 files changed, 73 insertions, 22 deletions
diff --git a/core/css/header.scss b/core/css/header.scss
index c67df9ba17b..99329ccd631 100644
--- a/core/css/header.scss
+++ b/core/css/header.scss
@@ -349,6 +349,9 @@
#apps {
max-height: calc(100vh - 100px);
overflow: auto;
+ .in-header {
+ display: none;
+ }
}
/* USER MENU -----------------------------------------------------------------*/
@@ -553,9 +556,15 @@
position: absolute;
pointer-events: none;
border-bottom-color: white;
- border-width: 8px;
+ border-width: 10px;
transform: translateX(-50%);
left: 50%;
- top: 17px;
+ top: 14px;
z-index: 100;
+ display: block;
+}
+
+// do not show active indicator when hovering other icons
+#appmenu:hover li:not(:hover) a:before {
+ display:none;
}
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index 84e3690c91e..fb7ceb408c5 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -61,8 +61,7 @@
<div id="appmenu">
<ul>
- <?php $navigation = array_slice($_['navigation'], 0, 3); ?>
- <?php foreach($navigation as $entry): ?>
+ <?php foreach($_['headernavigation'] as $entry): ?>
<li data-id="<?php p($entry['id']); ?>">
<a href="<?php print_unescaped($entry['href']); ?>" tabindex="3"
<?php if( $entry['active'] ): ?> class="active"<?php endif; ?>>
@@ -74,7 +73,7 @@
</a>
</li>
<?php endforeach; ?>
- <?php if (count($_['navigation'])>3): ?>
+ <?php if (count($_['navigation'])>4): ?>
<li id="more-apps" class="menutoggle">
<a href="#">
<div class="icon-more-white"></div>
@@ -83,7 +82,7 @@
</a>
</li>
<?php endif; ?>
- <?php if (count($_['navigation'])<=3): ?>
+ <?php if (count($_['navigation'])<=4): ?>
<?php
/* show "More apps" link to app administration directly in app navigation, as last entry */
if(OC_User::isAdminUser(OC_User::getUser())):
@@ -156,21 +155,24 @@
<nav role="navigation"><div id="navigation">
<div id="apps">
<ul>
- <?php $navigation = array_slice($_['navigation'], 3); ?>
- <?php foreach($navigation as $entry): ?>
- <li data-id="<?php p($entry['id']); ?>">
- <a href="<?php print_unescaped($entry['href']); ?>" tabindex="3"
- <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>>
- <svg width="32" height="32" viewBox="0 0 32 32">
- <defs><filter id="invert"><feColorMatrix in="SourceGraphic" type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0"></feColorMatrix></filter></defs>
- <image x="0" y="0" width="32" height="32" preserveAspectRatio="xMinYMin meet" filter="url(#invert)" xlink:href="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>" class="app-icon"></image>
- </svg>
- <div class="icon-loading-dark" style="display:none;"></div>
- <span>
+ <?php foreach($_['navigation'] as $entry): ?>
+ <?php if($entry['showInHeader']): ?>
+ <li data-id="<?php p($entry['id']); ?>" class="in-header">
+ <?php else: ?>
+ <li data-id="<?php p($entry['id']); ?>">
+ <?php endif; ?>
+ <a href="<?php print_unescaped($entry['href']); ?>" tabindex="3"
+ <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>>
+ <svg width="32" height="32" viewBox="0 0 32 32">
+ <defs><filter id="invert"><feColorMatrix in="SourceGraphic" type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0"></feColorMatrix></filter></defs>
+ <image x="0" y="0" width="32" height="32" preserveAspectRatio="xMinYMin meet" filter="url(#invert)" xlink:href="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>" class="app-icon"></image>
+ </svg>
+ <div class="icon-loading-dark" style="display:none;"></div>
+ <span>
<?php p($entry['name']); ?>
</span>
- </a>
- </li>
+ </a>
+ </li>
<?php endforeach; ?>
<?php
/* show "More apps" link to app administration directly in app navigation, as last entry */
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index ccd53c9cafa..3f8c75adc84 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -76,6 +76,8 @@ class TemplateLayout extends \OC_Template {
$this->assign( 'appid', $appId );
$navigation = \OC_App::getNavigation();
$this->assign( 'navigation', $navigation);
+ $navigation = \OC_App::getHeaderNavigation();
+ $this->assign( 'headernavigation', $navigation);
$settingsNavigation = \OC_App::getSettingsNavigation();
$this->assign( 'settingsnavigation', $settingsNavigation);
foreach($navigation as $entry) {
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index 264e8f5fc60..1cc83888734 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -530,7 +530,6 @@ class OC_App {
// This is private as well. It simply works, so don't ask for more details
private static function proceedNavigation($list) {
-
usort($list, function($a, $b) {
if (isset($a['order']) && isset($b['order'])) {
return ($a['order'] < $b['order']) ? -1 : 1;
@@ -552,13 +551,36 @@ class OC_App {
}
unset($navEntry);
- // Move active app to the first position
+
+ foreach ($list as $index => &$navEntry) {
+ $navEntry['showInHeader'] = false;
+ if($index < 4) {
+ $navEntry['showInHeader'] = true;
+ }
+ }
+
+ return $list;
+ }
+
+ public static function proceedAppNavigation($entries) {
+ $list = self::proceedNavigation($entries);
+
+ $activeApp = OC::$server->getNavigationManager()->getActiveEntry();
+ foreach ($list as $index => &$navEntry) {
+ if ($navEntry['id'] == $activeApp) {
+ $navEntry['active'] = true;
+ $activeAppIndex = $index;
+ } else {
+ $navEntry['active'] = false;
+ }
+ }
+ $list = array_slice($list, 0, 4);
+ // move active item to last position
if($activeAppIndex > 2) {
$active = $list[$activeAppIndex];
unset($list[$activeAppIndex]);
array_unshift($list, $active);
}
-
return $list;
}
@@ -752,6 +774,22 @@ class OC_App {
}
/**
+ * Returns the navigation inside the header bar
+ *
+ * @return array
+ *
+ * This function returns an array containing all entries added. The
+ * entries are sorted by the key 'order' ascending. Additional to the keys
+ * given for each app the following keys exist:
+ * - active: boolean, signals if the user is on this navigation entry
+ */
+ public static function getHeaderNavigation() {
+ $entries = OC::$server->getNavigationManager()->getAll();
+ $navigation = self::proceedAppNavigation($entries);
+ return $navigation;
+ }
+
+ /**
* get the id of loaded app
*
* @return string