Permalink
Browse files

Menu with submenu (#368)

* PR submenue: item group added

* PR submenue: css styles for submenue

* PR submenue: dynamic create submenue

* Move and rename function from index.php to function.php

* set $text to default ""

* Make it scrutinzer confirm

* Make it scrutinizer confirm

* Correct to right menue color crey
  • Loading branch information...
Student1978 authored and Obihoernchen committed Apr 23, 2018
1 parent ae48fe7 commit adf7596f821a02f227c5ee9373690a507acc9895
Showing with 154 additions and 39 deletions.
  1. +60 −3 core/css/style.css
  2. +27 −0 core/json/variables.examples.json
  3. +66 −0 functions.php
  4. +1 −36 index.php
View
63 core/css/style.css 100755 → 100644
@@ -79,12 +79,69 @@ Navigation
animation-iteration-count: 3;
}
.navbar-default .navbar-nav>li>a:focus, .navbar-default .navbar-nav>li>a:hover {
color:#174391;
.navbar-default .navbar-nav>li>a {
color: #777777 !important;
}
.navbar-default .navbar-nav>li>a:focus {
color: #777777;
}
.navbar-default .navbar-nav>li>a:hover {
color: #173491 !important;
}
.navbar-default .navbar-brand {
color:#174391;
color: #777777 !important;
}
.navbar-default .navbar-brand>li>a:hover {
color: #173491 !important;
}
.navbar-nav li .dropdown{
padding: 0 15px;
}
.navbar-nav li .dropdown li{
list-style-type: none;
list-style-image: none;
display: block;
width: 100%;
padding: 3px 12px;
text-decoration: none !important;
}
.navbar-nav li .dropdown li a{
display: block;
padding: 3px 12px;
color: #777777 !important;
}
.navbar-nav li .dropdown li a:hover{
text-decoration: none;
color: #173491 !important;
background-color: #fff;
}
@media (min-width: 768px) {
.navbar-nav li .dropdown{
position: absolute;
top: 50px;
background-color: #fff;
border: 1px solid #ccc;
border-top: none;
padding: 10px 0 15px;
min-width: 200px;
left: -20px;
display: none;
}
.navbar-nav li:hover .dropdown{
display: block;
}
}
/****************
@@ -66,6 +66,33 @@
"locale" : "RAIDS",
"icon" : "fa-bolt"
},
{
"type" : "group",
"text" : "Raids & more",
"icon" : "fa-bolt",
"members" : [
{
"type" : "link",
"href" : "raids",
"locale" : "RAIDS",
"text" : "Raids",
"icon" : "fa-bolt"
},
{
"type" : "link",
"href" : "gym",
"locale" : "GYMS",
"text" : "Arenen",
"icon" : "fa-shield"
},
{
"type" : "link",
"href" : "gymhistory",
"text" : "Gym Changes",
"icon" : "fa-history"
}
]
},
{
"type" : "link",
"href" : "pokestops",
View
@@ -275,3 +275,69 @@ function generation($id)
return [7, "Alola"];
}
}
########################################################################
// HTML output for Menu and Submenu
########################################################################
function printMenuitems($menu, $level, $locales)
{
if (isset($menu->locale)) {
$locale = $menu->locale;
$text = $locales->$locale;
} elseif (isset($menu->text)) {
$text = $menu->text;
} else {
$text = '';
}
switch ($menu->type) {
case 'group':
?>
<li>
<a class="menu-label"><i class="fa <?= $menu->icon ?>" aria-hidden="true"></i> <?= $text ?></a>
<ul class="dropdown">
<?php
foreach ($menu->members as $childmenu) {
printMenuitems($childmenu, $level + 1, $locales);
}
?>
</ul>
</li>
<?php
break;
case 'link':
?>
<li>
<a href="<?= $menu->href ?>" class="menu-label"><i class="fa <?= $menu->icon ?>" aria-hidden="true"></i> <?= $text ?></a>
</li>
<?php
break;
case 'link_external':
?>
<li>
<a href="<?= $menu->href ?>" target="_blank" class="menu-label"><i class="fa <?= $menu->icon ?>" aria-hidden="true"></i> <?= $menu->text ?></a>
</li>
<?php
break;
case 'html':
?>
<li> <?= $menu->value ?> </li>
<?php
break;
}
}
?>
View
@@ -57,42 +57,7 @@
}
foreach ($config->menu as $menu) {
if (isset($menu->locale)) {
$locale = $menu->locale;
$text = $locales->$locale;
} elseif (isset($menu->text)) {
$text = $menu->text;
}
switch ($menu->type) {
case 'link':
?>
<li>
<a href="<?= $menu->href ?>" class="menu-label"><i class="fa <?= $menu->icon ?>" aria-hidden="true"></i> <?= $text ?></a>
</li>
<?php
break;
case 'link_external':
?>
<li>
<a href="<?= $menu->href ?>" target="_blank" class="menu-label"><i class="fa <?= $menu->icon ?>" aria-hidden="true"></i> <?= $menu->text ?></a>
</li>
<?php
break;
case 'html':
?>
<li> <?= $menu->value ?> </li>
<?php
break;
}
printMenuitems($menu, 1, $locales);
}
?>

0 comments on commit adf7596

Please sign in to comment.