Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Menu now active the right page

  • Loading branch information...
commit 2b8c27928665003a3474bb3aa58cee4f5fa9025e 1 parent e1e7621
@rhaamo rhaamo authored
View
19 codular/templates/layout.jinja2
@@ -38,10 +38,21 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
- <li class="active"><a href="{{'home'|route_url}}"><i class="fa fa-home"></i> Home</a></li>
- <li><a href="{{'new_user'|route_url}}"><i class="fa fa-wrench"></i> Register</a></li>
- <li><a href="{{'home'|route_url}}"><i class="fa fa-user"></i> Login</a></li>
- <li><a href="{{'home'|route_url}}"><i class="fa fa-question"></i> About</a></li>
+ <li class="{{ 'active' if menu_active == 'home' else 'inactive' }}">
+ <a href="{{'home'|route_url}}"><i class="fa fa-home"></i> Home</a>
+ </li>
+
+ <li class="{{ 'active' if menu_active == 'new_user' else 'inactive' }}">
+ <a href="{{'new_user'|route_url}}"><i class="fa fa-wrench"></i> Register</a>
+ </li>
+
+ <li class="{{ 'active' if menu_active == 'login' else 'inactive' }}">
+ <a href="{{'home'|route_url}}"><i class="fa fa-user"></i> Login</a>
+ </li>
+
+ <li class="{{ 'active' if menu_active == 'about' else 'inactive' }}">
+ <a href="{{'home'|route_url}}"><i class="fa fa-question"></i> About</a>
+ </li>
</ul>
<ul class="nav navbar-nav navbar-right navbar-user">
View
3  codular/views/home.py
@@ -21,4 +21,5 @@ def __init__(self, request):
@view_config(route_name='home', renderer='home/home.jinja2')
def home_get(self):
- return {'one': "the one", 'project': 'codular'}
+ template_vars = {'menu_active': 'home', 'one': "the one", 'project': 'codular'}
+ return template_vars
View
18 codular/views/users.py
@@ -26,24 +26,30 @@ def __init__(self, request):
@view_config(route_name='users', renderer='json')
def users(self):
- return "users"
+ template_vars = {'menu_active': 'users'}
+ return template_vars
@view_config(route_name='user', renderer='json')
def user(self):
- return "user"
+ template_vars = {'menu_active': 'user'}
+ return template_vars
@view_config(route_name='update_user', renderer='json')
def update_user(self):
- return "update_user"
+ template_vars = {'menu_active': 'update_user'}
+ return template_vars
@view_config(route_name='delete_user', renderer='json')
def delete_user(self):
- return "delete_user"
+ template_vars = {'menu_active': 'delete_user'}
+ return template_vars
@view_config(route_name='new_user', renderer='users/new.jinja2')
def new_user(self):
- return {'one': "the one", 'project': 'codular'}
+ template_vars = {'menu_active': 'new_user'}
+ return template_vars
@view_config(route_name='edit_user', renderer='json')
def edit_user(self):
- return "edit_user"
+ template_vars = {'menu_active': 'edit_user'}
+ return template_vars
Please sign in to comment.
Something went wrong with that request. Please try again.