Commit dd4c0193 authored by Sli's avatar Sli
Browse files

On essaye de faire un timer joli (c'est pas encore ça) et on tente une...

On essaye de faire un timer joli (c'est pas encore ça) et on tente une faiblarde barre de navigation
parent eae04ab4
<div class="row">
<div class="row">
<div class="col-md-offset-2 col-md-8 col-md-offset-2">
<div class="chronoBloc chrono">
<div align="center" class="row">
<i>J - <span id="days">0</span></i>
\ No newline at end of file
<a href="{{nav.path}}"> Home</a>
{% for page in nav.pages %}
{% load set_var %}
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#gala-navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<a class="navbar-brand" href="{{nav.index}}">Home</a>
<div class="container">
<div class="collapse navbar-collapse" id="gala-navbar">
<ul class='nav navbar-nav'>
<a href="{{page.get_absolute_url}}">{{page.title}}</a>
{% for page in nav.pages %}
{% endfor %}
{% set active = "" %}
{% if nav.path == page.get_absolute_url %}
{% set active = "active" %}
{% endif %}
<li class="{{active}}"><a href="{{page.get_absolute_url}}">{{page.title}}</a></li>
{% endfor %}
\ No newline at end of file
from django import template
register = template.Library()
class SetVarNode(template.Node):
def __init__(self, var_name, var_value):
self.var_name = var_name
self.var_value = var_value
def render(self, context):
value = template.Variable(self.var_value).resolve(context)
except template.VariableDoesNotExist:
value = ""
context[self.var_name] = value
return u""
def set_var(parser, token):
{% set <var_name> = <var_value> %}
parts = token.split_contents()
if len(parts) < 4:
raise template.TemplateSyntaxError("'set' tag must be of the form: {% set <var_name> = <var_value> %}")
return SetVarNode(parts[1], parts[3])
register.tag('set', set_var)
\ No newline at end of file
......@@ -7,28 +7,32 @@ from blog.models import Article, Page
def blog(request):
articles = Article.objects.exclude(published=False).order_by('-date')
return render(request, 'blog/blog.html', {'articles': articles, 'nav': get_nav()})
return render(request, 'blog/blog.html',
{'articles': articles, 'nav': get_nav(request)})
def article(request, slug):
article = get_object_or_404(Article, slug=slug, published=True)
return render(request, 'blog/article.html', {'article': article, 'nav': get_nav()})
return render(request, 'blog/article.html',
{'article': article, 'nav': get_nav(request)})
def page(request, slug):
content = get_object_or_404(Page, slug=slug, published=True)
return render(request, 'blog/page.html', {'content': content, 'nav': get_nav()})
return render(request, 'blog/page.html',
{'content': content, 'nav': get_nav(request)})
def get_nav():
def get_nav(request):
nav = {
'pages': Page.objects.exclude(published=False).order_by('order'),
'path': reverse('blog')
'index': reverse('blog'),
'path': request.path
return nav
{% load staticfiles %}
{% load set_var %}
<!DOCTYPE html>
<html lang="fr">
......@@ -8,6 +9,7 @@
<link rel="stylesheet" href="" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link href="{% static "blog/css/base.css" %}" rel="stylesheet">
<link href="{% static "blog/css/nav.css" %}" rel="stylesheet">
<script src=""></script>
......@@ -20,14 +22,12 @@
<img class="img-responsive" src="">
{# Décompte #}
<div class="col-md-2">
<div class="chrono">
<span id="days">0</span> jours restants
<div class="col-sm-2 col-xs-10">
{% include "blog/chrono.html" %}
<div class="row">
......@@ -45,7 +45,7 @@
<div class="col-sm-8 col-xs-10">
<div class="container-fluid content">
<div class="row-fluid">
<div class="row">
{% include "blog/nav.html" %}
......@@ -82,6 +82,11 @@
<script src="" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous">
<script src="{% static "blog/js/chrono.js" %}"></script>
SetChrono("{% static "blog/json/chrono.json" %}");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment