Add arrow under active menu item

This commit is contained in:
Gergely Polonkai 2013-10-15 09:29:03 +02:00
parent a621c3e206
commit 904cfc4750
6 changed files with 15 additions and 3 deletions

View File

@ -32,3 +32,8 @@ def tagcloud(request):
tagcloud.sort(key=itemgetter('name')) tagcloud.sort(key=itemgetter('name'))
return {'tagcloud': tagcloud} return {'tagcloud': tagcloud}
def viewname(request):
return {
'view_name': request.view_name,
}

View File

@ -0,0 +1,5 @@
class ViewNameMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
request.test = "TEST"
request.view_name = ".".join((view_func.__module__, view_func.__name__))

View File

@ -104,6 +104,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection: # Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware', # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'gergelypolonkaiweb.middleware.viewname.ViewNameMiddleware',
) )
ROOT_URLCONF = 'gergelypolonkaiweb.urls' ROOT_URLCONF = 'gergelypolonkaiweb.urls'
@ -173,6 +174,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.messages.context_processors.messages", "django.contrib.messages.context_processors.messages",
'gergelypolonkaiweb.helper.tagcloud', 'gergelypolonkaiweb.helper.tagcloud',
'gergelypolonkaiweb.helper.randomheader', 'gergelypolonkaiweb.helper.randomheader',
'gergelypolonkaiweb.helper.viewname',
) )
HEADER_DIR = SITE_ROOT + os.path.sep + "static" + os.path.sep + "images" + os.path.sep + "header" HEADER_DIR = SITE_ROOT + os.path.sep + "static" + os.path.sep + "images" + os.path.sep + "header"

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

View File

@ -43,9 +43,9 @@
<div id="menu"> <div id="menu">
<div id="tagcloud-button"><img alt="" src="{% static "images/tagcloud.png" %}" /></div> <div id="tagcloud-button"><img alt="" src="{% static "images/tagcloud.png" %}" /></div>
<ul> <ul>
<li {% if currentMenu == 'resume' %} class="active"{% endif %}><a href="{% url 'basics:resume' %}">Resume</a></li> <li {% if view_name|slice:"-7:" == ".resume" %} class="active"{% endif %}><a href="{% url 'basics:resume' %}">Resume</a></li>
<li {% if currentMenu == 'blog' %} class="active"{% endif %}><a href="{% url 'blog:index' %}">Blog</a></li> <li {% if view_name|slice:":5" == "blog." %} class="active"{% endif %}><a href="{% url 'blog:index' %}">Blog</a></li>
<li {% if currentMenu == 'about' %} class="active"{% endif %}><a href="{% url 'basics:about' %}">About me</a></li> <li {% if view_name|slice:"-6:" == ".about" %} class="active"{% endif %}><a href="{% url 'basics:about' %}">About me</a></li>
</ul> </ul>
<br class="clear" /> <br class="clear" />
</div> </div>