Browse Source

Use variables to determine selected

Marcelo Fornet 5 years ago
parent
commit
8617ba90d7

+ 11 - 11
layout/_base.html

@@ -26,21 +26,21 @@
 					<div class="vbox">
 					<div class="vbox">
 						<div class="hbox">
 						<div class="hbox">
 							<h1 class="header-title">
 							<h1 class="header-title">
-								<div><a href="/work" {% block work_selected %}{% endblock %}>{{ 'work' | lang }}</a></div> /
-								<div><a href="/news" {% block news_selected %}{% endblock %}>{{ 'news' | lang }}</a></div> /
-								<div><a href="/about"{% block about_selected %}{% endblock %}>{{ 'about' | lang }}</a></div> /
-								<div><a href="/contact" {% block contact_selected %}{% endblock %}>{{ 'contact' | lang }}</a></div> /
-								<div><a href="/shop"{% block shop_selected %}{% endblock %} >{{ 'shop' | lang }}</a></div>
+								<div><a href="/work" {% if work_selected %}class="selected"{% endif %}>{{ 'work' | lang }}</a></div> /
+								<div><a href="/news" {% if news_selected %}class="selected"{% endif %}>{{ 'news' | lang }}</a></div> /
+								<div><a href="/about"{% if about_selected %}class="selected"{% endif %}>{{ 'about' | lang }}</a></div> /
+								<div><a href="/contact" {% if contact_selected %}class="selected"{% endif %}>{{ 'contact' | lang }}</a></div> /
+								<div><a href="/shop"{% if shop_selected %}class="selected"{% endif %} >{{ 'shop' | lang }}</a></div>
 							</h1>
 							</h1>
 						</div>
 						</div>
 						<div class="hbox">
 						<div class="hbox">
 							<div class="header-subtitle">
 							<div class="header-subtitle">
-								<div><a href="/work/all" {% block all_selected %}{% endblock %}>{{ 'all' | lang }}</a></div> /
-								<div><a href="/work/poster" {% block poster_selected %}{% endblock %}>{{ 'poster' | lang }}</a></div> /
-								<div><a href="/work/illustration" {% block illustration_selected %}{% endblock %}>{{ 'illustration' | lang }}</a></div> /
-								<div><a href="/work/editorial" {% block editorial_selected %}{% endblock %}>{{ 'editorial' | lang }}</a></div> /
-								<div><a href="/work/branding" {% block branding_selected %}{% endblock %}>{{ 'branding' | lang }}</a></div> /
-								<div><a href="/work/other" {% block other_selected %}{% endblock %}>{{ 'other' | lang }}</a></div>
+								<div><a href="/work/all" {% if all_selected %}class="selected"{% endif %}>{{ 'all' | lang }}</a></div> /
+								<div><a href="/work/poster" {% if poster_selected %}class="selected"{% endif %}>{{ 'poster' | lang }}</a></div> /
+								<div><a href="/work/illustration" {% if illustration_selected %}class="selected"{% endif %}>{{ 'illustration' | lang }}</a></div> /
+								<div><a href="/work/editorial" {% if editorial_selected %}class="selected"{% endif %}>{{ 'editorial' | lang }}</a></div> /
+								<div><a href="/work/branding" {% if branding_selected %}class="selected"{% endif %}>{{ 'branding' | lang }}</a></div> /
+								<div><a href="/work/other" {% if other_selected %}class="selected"{% endif %}>{{ 'other' | lang }}</a></div>
 							</div>
 							</div>
 						</div>
 						</div>
 					</div>
 					</div>

+ 1 - 1
layout/_work_no_all.html

@@ -1,3 +1,3 @@
 {% extends "work.html"%}
 {% extends "work.html"%}
 
 
-{% block all_selected %}{% endblock %}
+{% set no_all_selected = True %}

+ 1 - 1
layout/about.html

@@ -1,6 +1,6 @@
 {% extends "_base.html"%}
 {% extends "_base.html"%}
 
 
-{% block about_selected %}class="selected"{% endblock %}
+{% set about_selected = True %}
 
 
 {% block main %}
 {% block main %}
 {{ "About Alejandro" | lang }}
 {{ "About Alejandro" | lang }}

+ 1 - 1
layout/contact.html

@@ -1,6 +1,6 @@
 {% extends "_base.html"%}
 {% extends "_base.html"%}
 
 
-{% block contact_selected %}class="selected"{% endblock %}
+{% set contact_selected = True %}
 
 
 {% block main %}
 {% block main %}
 {% endblock %}
 {% endblock %}

+ 1 - 1
layout/news.html

@@ -1,6 +1,6 @@
 {% extends "_base.html"%}
 {% extends "_base.html"%}
 
 
-{% block news_selected %}class="selected"{% endblock %}
+{% set news_selected = True %}
 
 
 {% block main %}
 {% block main %}
 {% endblock %}
 {% endblock %}

+ 1 - 1
layout/shop.html

@@ -1,6 +1,6 @@
 {% extends "_base.html"%}
 {% extends "_base.html"%}
 
 
-{% block shot_selected %}class="selected"{% endblock %}
+{% set shop_selected = True %}
 
 
 {% block main %}
 {% block main %}
 {% endblock %}
 {% endblock %}

+ 2 - 2
layout/work.html

@@ -1,7 +1,7 @@
 {% extends "_base.html"%}
 {% extends "_base.html"%}
 
 
-{% block work_selected %}class="selected"{% endblock %}
-{% block all_selected %}class="selected"{% endblock %}
+{% set work_selected = True %}
+{% set all_selected = False if no_all_selected else True %}
 
 
 {% block main %}
 {% block main %}
     <div class="sqr-item"><img src="{{ 'image/tile.jpg' | static }}" alt="Ejemplo"></div>
     <div class="sqr-item"><img src="{{ 'image/tile.jpg' | static }}" alt="Ejemplo"></div>

+ 0 - 2
layout/work/all.html

@@ -1,3 +1 @@
 {% extends "work.html"%}
 {% extends "work.html"%}
-
-{% block all_selected %}class="selected"{% endblock %}

+ 1 - 1
layout/work/branding.html

@@ -1,3 +1,3 @@
 {% extends "_work_no_all.html"%}
 {% extends "_work_no_all.html"%}
 
 
-{% block branding_selected %}class="selected"{% endblock %}
+{% set branding_selected = True %}

+ 1 - 1
layout/work/editorial.html

@@ -1,3 +1,3 @@
 {% extends "_work_no_all.html"%}
 {% extends "_work_no_all.html"%}
 
 
-{% block editorial_selected %}class="selected"{% endblock %}
+{% set editorial_selected = True %}

+ 1 - 1
layout/work/illustration.html

@@ -1,3 +1,3 @@
 {% extends "_work_no_all.html"%}
 {% extends "_work_no_all.html"%}
 
 
-{% block illustration_selected %}class="selected"{% endblock %}
+{% set illustration_selected = True %}

+ 1 - 1
layout/work/other.html

@@ -1,3 +1,3 @@
 {% extends "_work_no_all.html"%}
 {% extends "_work_no_all.html"%}
 
 
-{% block other_selected %}class="selected"{% endblock %}
+{% set other_selected = True %}

+ 1 - 1
layout/work/poster.html

@@ -1,3 +1,3 @@
 {% extends "_work_no_all.html"%}
 {% extends "_work_no_all.html"%}
 
 
-{% block poster_selected %}class="selected"{% endblock %}
+{% set poster_selected = True %}