Commit 03bc0973 authored by Skia's avatar Skia
Browse files

WIP: Move to Jinja2

parent abb8dc0c
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block content %}
......
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block content %}
......
{% load staticfiles %}
<!DOCTYPE html>
<html lang="fr">
<head>
{% block head %}
<title>{% block title %}Bienvenue sur le Sith de l'AE!{% endblock %}</title>
<link rel="stylesheet" href="{% static 'core/style.css' %}">
<script src="{% static 'core/script.js' %}"></script>
<link rel="stylesheet" href="{{ static('core/style.css') }}">
<script src="{{ static('core/script.js') }}"></script>
<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
{% endblock %}
</head>
......@@ -13,20 +12,20 @@
<body>
<header>
{% block header %}
{% if user.is_authenticated %}Hello, {{ user.username }}!{% endif %}
{% if user.is_authenticated() %}Hello, {{ user.username }}!{% endif %}
<ul>
{% if not user.is_authenticated %}
<li><a href="{% url 'core:register' %}">Register</a></li>
<li><a href="{% url 'core:login' %}">Login</a></li>
{% if not user.is_authenticated() %}
<li><a href="{{ url('core:register') }}">Register</a></li>
<li><a href="{{ url('core:login') }}">Login</a></li>
{% else %}
<li><a href="{% url 'core:logout' %}">Logout</a></li>
<li><a href="{{ url('core:logout') }}">Logout</a></li>
{% endif %}
</ul>
{% if user.is_authenticated %}
{% if user.is_authenticated() %}
<ul>
<li><a href="{% url 'core:user_profile' user.id %}">Profile</a></li>
<li><a href="{% url 'core:user_list' %}">Users</a></li>
<li><a href="{% url 'core:page_list' %}">Pages</a></li>
<li><a href="{{ url('core:user_profile', user_id=user.id) }}">Profile</a></li>
<li><a href="{{ url('core:user_list') }}">Users</a></li>
<li><a href="{{ url('core:page_list') }}">Pages</a></li>
</ul>
{% endif %}
{% endblock %}
......@@ -44,10 +43,5 @@
Site réalisé par des gens biens
{% endblock %}
</footer>
<!--
{% block tests %}
{{ tests }}
{% endblock %}
-->
</body>
</html>
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block title %}
{% if profile %}
......
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block content %}
<p><a href="{% url 'core:group_list' %}">Back to list</a></p>
<p><a href="{{ url('core:group_list') }}">Back to list</a></p>
<h2>Edit group</h2>
<form action="" method="post">
{% csrf_token %}
{{ form.as_p }}
{{ csrf_input }}
{{ form.as_p() }}
<p><input type="submit" value="Update" /></p>
</form>
{% endblock %}
......
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block title %}
Group list
......@@ -8,7 +8,7 @@ Group list
<h3>Group list</h3>
<ul>
{% for g in group_list %}
<li><a href="{% url 'core:group_edit' g.id %}">{{ g.name }}</a></li>
<li><a href="{{ url('core:group_edit', kwargs={'group_id': g.id} }}">{{ g.name }}</a></li>
{% endfor %}
</ul>
{% endblock %}
......
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
Hello, world. You're at the core index.
Hello, world. You're at the core index using Jinja2.
{% endblock %}
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block content %}
......@@ -7,7 +7,7 @@
{% endif %}
{% if next %}
{% if user.is_authenticated %}
{% if user.is_authenticated() %}
<p>Your account doesn't have access to this page. To proceed,
please login with an account that has access.</p>
{% else %}
......@@ -15,15 +15,15 @@
{% endif %}
{% endif %}
<form method="post" action="{% url 'core:login' %}">
<form method="post" action="{{ url('core:login') }}">
{% csrf_token %}
<table>
<tr>
<td>{{ form.username.label_tag }}</td>
<td>{{ form.username.label_tag() }}</td>
<td>{{ form.username }}</td>
</tr>
<tr>
<td>{{ form.password.label_tag }}</td>
<td>{{ form.password.label_tag() }}</td>
<td>{{ form.password }}</td>
</tr>
</table>
......@@ -33,6 +33,6 @@
</form>
{# Assumes you setup the password_reset view in your URLconf #}
<p><a href="{% url 'core:password_reset' %}">Lost password?</a></p>
<p><a href="{{ url('core:password_reset') }}">Lost password?</a></p>
{% endblock %}
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block title %}
{% if page %}
{{ page.get_display_name }}
{{ page.get_display_name() }}
{% elif page_list %}
Page list
{% else %}
......@@ -16,6 +16,6 @@
{% endblock %}
{% else %}
<h2>Page does not exist</h2>
<p><a href="{% url 'core:page_prop' new_page %}">Create it?</a></p>
<p><a href="{{ url('core:page_prop', page_name=new_page) }}">Create it?</a></p>
{% endif %}
{% endblock %}
{% extends "core/page.html" %}
{% load renderer %}
{% extends "core/page.jinja" %}
{% block page %}
<h3>Page</h3>
<p><a href="{% url 'core:page_list' %}">Back to list</a></p>
<p><a href="{{ url('core:page_list') }}">Back to list</a></p>
{% if can_edit %}
<p><a href="{% url 'core:page_edit' page.get_full_name %}">Edit</a></p>
<p><a href="{{ url('core:page_edit', page_name=page.get_full_name()) }}">Edit</a></p>
{% endif %}
{% if can_edit_prop %}
<p><a href="{% url 'core:page_prop' page.get_full_name %}">Prop</a></p>
<p><a href="{{ url('core:page_prop', page_name=page.get_full_name()) }}">Prop</a></p>
{% endif %}
<p>You're seeing the page <strong>{{ page.get_display_name }}</strong> -
<a href="{% url 'core:page_hist' page.get_full_name %}">History</a></p>
<p>You're seeing the page <strong>{{ page.get_display_name() }}</strong> -
<a href="{{ url('core:page_hist', page_name=page.get_full_name()) }}">History</a></p>
{% if rev %}
<h4>This may not be the last update, you are seeing revision {{ rev.id }}!</h4>
<h3>{{ rev.title }}</h3>
<p>{{ rev.content|markdown }}</p>
{% else %}
<h3>{{ page.revisions.last.title }}</h3>
<p>{{ page.revisions.last.content|markdown }}</p>
<h3>{{ page.revisions.last().title }}</h3>
<p>{{ page.revisions.last().content|markdown }}</p>
{% endif %}
{% endblock %}
......
{% extends "core/page.html" %}
{% block page %}
<h3>Page history</h3>
<p><a href="{% url 'core:page' page.get_full_name %}">Back to page</a></p>
<p>You're seeing the history of page <strong>{{ page.get_display_name }}</strong></p>
<ul>
<li><a href="{% url 'core:page' page_name=page.get_full_name %}">
last - {{ page.revisions.last.author }} - {{ page.revisions.last.date }}</a></li>
{% for r in page.revisions.all|dictsortreversed:'date'|slice:'1:' %}
<li><a href="{% url 'core:page_rev' page_name=page.get_full_name rev=r.id %}">
{{ r.author }} - {{ r.date }}</a></li>
{% endfor %}
</ul>
{% endblock %}
{% extends "core/page.jinja" %}
{% block page %}
<h3>Page history</h3>
<p><a href="{{ url('core:page', page.get_full_name()) }}">Back to page</a></p>
<p>You're seeing the history of page <strong>{{ page.get_display_name() }}</strong></p>
<ul>
<li><a href="{{ url('core:page', page_name=page.get_full_name()) }}">
last - {{ page.revisions.last().author }} - {{ page.revisions.last().date|date('Y-m-d H:i') }}</a></li>
{% for r in (page.revisions.all()|sort(attribute='date', reverse=True))[1:] %}
<li><a href="{{ url('core:page_rev', page_name=page.get_full_name(), rev=r['id']) }}">
{{ r['author'] }} - {{ r['date']|date('Y-m-d H:i') }}</a></li>
{% endfor %}
</ul>
{% endblock %}
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block title %}
Page list
......@@ -9,7 +9,7 @@
<h3>Page list</h3>
<ul>
{% for p in page_list %}
<li><a href="{% url 'core:page' p.get_full_name %}">{{ p.get_display_name }}</a></li>
<li><a href="{{ url('core:page', page_name=p.get_full_name()) }}">{{ p.get_display_name() }}</a></li>
{% endfor %}
</ul>
{% else %}
......
{% extends "core/page.html" %}
{% extends "core/page.jinja" %}
{% block content %}
<h2>Page properties</h2>
<form action="" method="post">
{% csrf_token %}
{{ form.as_p }}
{{ form.as_p() }}
<p><input type="submit" value="Save!" /></p>
</form>
{% endblock %}
......
{% extends "core/page.html" %}
{% extends "core/page.jinja" %}
{% block head %}
{{ block.super }}
{{ super() }}
<script>
function make_preview() {
$.ajax({
url: "{% url 'core:api_markdown' %}",
url: "{{ url('core:api_markdown') }}",
method: "GET",
data: { text: $("#id_content").val() }
}).done(function (msg) {
......@@ -17,9 +17,9 @@ function make_preview() {
{% block page %}
<h2>Edit page</h2>
<form action="{% url 'core:page_edit' page_name=page.get_full_name %}" method="post">
<form action="{{ url('core:page_edit', page_name=page.get_full_name()) }}" method="post">
{% csrf_token %}
{{ form.as_p }}
{{ form.as_p() }}
<p><input type="button" value="Preview" onclick="javascript:make_preview();" /></p>
<p><input type="submit" value="Save!" /></p>
</form>
......
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block content %}
......
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block content %}
......
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block content %}
<form method="post" action="">
......
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block content %}
<p>You successfully reset your password!</p>
......
{% extends "core/base.html" %}
{% extends "core/base.jinja" %}
{% block content %}
<form method="post" action="">
......
Markdown is supported
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