From 0b75f27188489d52a1a753a244b5343dd8eac78d Mon Sep 17 00:00:00 2001 From: Gergely POLONKAI Date: Sat, 6 Oct 2012 19:34:15 +0200 Subject: [PATCH] Added current menu indicator to menu bar --- .../Resources/public/css/front.css | 28 ++++++++- .../Resources/public/images/arrow-up.png | Bin 0 -> 228 bytes .../views/Default/front_base.html.twig | 25 ++++---- .../FrontBundle/Twig/CurrentMenu.php | 55 ++++++++++++++++++ 4 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 src/GergelyPolonkai/FrontBundle/Resources/public/images/arrow-up.png create mode 100644 src/GergelyPolonkai/FrontBundle/Twig/CurrentMenu.php diff --git a/src/GergelyPolonkai/FrontBundle/Resources/public/css/front.css b/src/GergelyPolonkai/FrontBundle/Resources/public/css/front.css index 9204958..c13deac 100644 --- a/src/GergelyPolonkai/FrontBundle/Resources/public/css/front.css +++ b/src/GergelyPolonkai/FrontBundle/Resources/public/css/front.css @@ -71,18 +71,37 @@ body { } #menu { + background-color: #b5b5b5; + height: 39px; } #menu ul { - margin: 0; + margin: 8px; padding: 0; list-style-type: none; text-align: right; + vertical-align: middle; } #menu ul li { - display: inline; + float: right; + margin-top: 10px; + margin-bottom: 10px; margin-left: 1em; + height: 30px; +} + +#menu ul li.active { + background-image: url('../images/arrow-up.png'); + background-repeat: no-repeat; + background-position: center bottom; +} + +#menu ul li a { + color: white; + font-weight: bold; + text-decoration: none; + font-size: 12px; } #content { @@ -170,6 +189,7 @@ dd p { #tag-cloud a { color: #b3b3b3; text-decoration: none; + padding: 8px; } #tag-cloud .size0 { @@ -194,4 +214,8 @@ dd p { #tag-cloud .size5 { font-size: 150%; +} + +.clear { + clear: both; } \ No newline at end of file diff --git a/src/GergelyPolonkai/FrontBundle/Resources/public/images/arrow-up.png b/src/GergelyPolonkai/FrontBundle/Resources/public/images/arrow-up.png new file mode 100644 index 0000000000000000000000000000000000000000..7341693ff7c91ff44c074df9b14489222749598f GIT binary patch literal 228 zcmeAS@N?(olHy`uVBq!ia0vp^B0$W}!3HEbPUl(xDYhhUcNd2LAh=-f^2tCE&H|6f zVxW%eAk65bF}nh!r^M6OmHiGEn;;v%>?fz2K%qiU7sn8d^GnZcP@xClsWE`?n=8={fp{8 SUS|ljoWax8&t;ucLK6UGXi)$F literal 0 HcmV?d00001 diff --git a/src/GergelyPolonkai/FrontBundle/Resources/views/Default/front_base.html.twig b/src/GergelyPolonkai/FrontBundle/Resources/views/Default/front_base.html.twig index ba1aefb..30e9fb6 100644 --- a/src/GergelyPolonkai/FrontBundle/Resources/views/Default/front_base.html.twig +++ b/src/GergelyPolonkai/FrontBundle/Resources/views/Default/front_base.html.twig @@ -32,22 +32,23 @@ RSS Feed -
-
+
{% if tagCloud|length > 0 %} -
+
{% for cloudItem in tagCloud %} - {{ cloudItem.name }}{% if not loop.last %} | {% endif %} + {{ cloudItem.name }}{% if not loop.last %} | {% endif %} {% endfor %} -
+
{% endif %} - + +
{% block content %}{% endblock content %}
diff --git a/src/GergelyPolonkai/FrontBundle/Twig/CurrentMenu.php b/src/GergelyPolonkai/FrontBundle/Twig/CurrentMenu.php new file mode 100644 index 0000000..ffff079 --- /dev/null +++ b/src/GergelyPolonkai/FrontBundle/Twig/CurrentMenu.php @@ -0,0 +1,55 @@ +container = $container; + } + + public function getGlobals() + { + $controller = $this->container->get('request')->get('_controller'); + $route = $this->container->get('request')->get('_route'); + + $currentMenu = 'none'; + if (preg_match('/BlogController/', $controller)) { + $currentMenu = 'blog'; + } elseif (preg_match('/_homepage$/', $route)) { + $currentMenu = 'blog'; + } elseif (preg_match('/_resume$/', $route)) { + $currentMenu = 'resume'; + } elseif (preg_match('/_about$/', $route)) { + $currentMenu = 'about'; + } + return array( + 'currentMenu' => $currentMenu, + ); + } + public function getName() + { + return 'gergelypolonkaifront_currentmenu'; + } +}