Hightlight active menu
authorPeter Koppatz <peter@koppatz.com>
Wed, 27 Nov 2013 13:09:28 +0100
changeset 3c07ffbab8647
parent 1 3aa6f55df039
child 4 b8924c3cf376
Hightlight active menu
pymove3d.py
static/css/pymove3d.css
templates/theme.html
     1.1 --- a/pymove3d.py	Wed Nov 27 12:40:37 2013 +0100
     1.2 +++ b/pymove3d.py	Wed Nov 27 13:09:28 2013 +0100
     1.3 @@ -21,7 +21,7 @@
     1.4  
     1.5  @app.route("/index")
     1.6  def index():
     1.7 -    return render_template("index.html", act="index")
     1.8 +    return render_template("index.html")
     1.9  
    1.10  @app.route("/competition")
    1.11  def competition():
     2.1 --- a/static/css/pymove3d.css	Wed Nov 27 12:40:37 2013 +0100
     2.2 +++ b/static/css/pymove3d.css	Wed Nov 27 13:09:28 2013 +0100
     2.3 @@ -1,1 +1,1 @@
     2.4 -h1 {text-align: center;}
     2.5 \ No newline at end of file
     2.6 +h1 {text-align: center;}
     3.1 --- a/templates/theme.html	Wed Nov 27 12:40:37 2013 +0100
     3.2 +++ b/templates/theme.html	Wed Nov 27 13:09:28 2013 +0100
     3.3 @@ -43,7 +43,7 @@
     3.4              <span class="icon-bar"></span>
     3.5              <span class="icon-bar"></span>
     3.6            </button>
     3.7 -          <a class="navbar-brand" href="#">PyMove3D -- 2014</a>
     3.8 +          <a class="navbar-brand" href="/">PyMove3D -- 2014</a>
     3.9          </div>
    3.10          <div class="navbar-collapse collapse">
    3.11            <!--ul class="nav navbar-nav">
    3.12 @@ -64,10 +64,15 @@
    3.13              </li>
    3.14            </ul-->
    3.15            <ul class="nav navbar-nav navbar-right">
    3.16 -            <li class="active"><a href="/competition">Competition</a></li>
    3.17 -            <li><a href="/task">Task</a></li>
    3.18 -            <li><a href="/submission">Submission</a></li>
    3.19 -            <li><a href="/coursematerial">Course material</a></li>
    3.20 +             {% for href, caption in [('/competition', 'Competition'),
    3.21 +	                          ('/task', 'Task'),
    3.22 +                                  ('/submission', 'Submission'),
    3.23 +	                          ('/coursematerial', 'Coursematerial'),
    3.24 +	  ]:
    3.25 +	  %}
    3.26 +          {%- if href[1:] == act -%} 
    3.27 +          <li class="active">{% else %} <li>{% endif %}<a href="{{ href }}" >{{ caption }}</a></li>
    3.28 +          {% endfor %}
    3.29            </ul>
    3.30          </div><!--/.nav-collapse -->
    3.31        </div>
Impressum Datenschutzerklärung