mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 03:49:24 +00:00
WIP: Move to Jinja2
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
{% 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>
|
||||
<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
{% block header %}
|
||||
{% 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>
|
||||
{% else %}
|
||||
<li><a href="{% url 'core:logout' %}">Logout</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% 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>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</header>
|
||||
|
||||
<div id="content">
|
||||
{% if error %}
|
||||
{{ error }}
|
||||
{% endif %}
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
{% block footer %}
|
||||
Site réalisé par des gens biens
|
||||
{% endblock %}
|
||||
</footer>
|
||||
<!--
|
||||
{% block tests %}
|
||||
{{ tests }}
|
||||
{% endblock %}
|
||||
-->
|
||||
</body>
|
||||
</html>
|
47
core/templates/core/base.jinja
Normal file
47
core/templates/core/base.jinja
Normal file
@ -0,0 +1,47 @@
|
||||
<!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>
|
||||
<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
{% block header %}
|
||||
{% 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>
|
||||
{% else %}
|
||||
<li><a href="{{ url('core:logout') }}">Logout</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% if user.is_authenticated() %}
|
||||
<ul>
|
||||
<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 %}
|
||||
</header>
|
||||
|
||||
<div id="content">
|
||||
{% if error %}
|
||||
{{ error }}
|
||||
{% endif %}
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
{% block footer %}
|
||||
Site réalisé par des gens biens
|
||||
{% endblock %}
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% if profile %}
|
||||
|
@ -1,11 +1,11 @@
|
||||
{% 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 %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% 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 %}
|
||||
|
@ -1,7 +0,0 @@
|
||||
{% extends "core/base.html" %}
|
||||
|
||||
{% block title %}{{ title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Hello, world. You're at the core index.
|
||||
{% endblock %}
|
7
core/templates/core/index.jinja
Normal file
7
core/templates/core/index.jinja
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}{{ title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Hello, world. You're at the core index using Jinja2.
|
||||
{% endblock %}
|
@ -1,4 +1,4 @@
|
||||
{% 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 %}
|
@ -1,8 +1,8 @@
|
||||
{% 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 %}
|
@ -1,26 +0,0 @@
|
||||
{% extends "core/page.html" %}
|
||||
{% load renderer %}
|
||||
|
||||
{% block page %}
|
||||
<h3>Page</h3>
|
||||
<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>
|
||||
{% endif %}
|
||||
{% if can_edit_prop %}
|
||||
<p><a href="{% url 'core:page_prop' 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>
|
||||
{% 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>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
25
core/templates/core/page_detail.jinja
Normal file
25
core/templates/core/page_detail.jinja
Normal file
@ -0,0 +1,25 @@
|
||||
{% extends "core/page.jinja" %}
|
||||
|
||||
{% block page %}
|
||||
<h3>Page</h3>
|
||||
<p><a href="{{ url('core:page_list') }}">Back to list</a></p>
|
||||
{% if can_edit %}
|
||||
<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_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_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>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
{% 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 %}
|
||||
|
||||
|
||||
|
||||
|
19
core/templates/core/page_hist.jinja
Normal file
19
core/templates/core/page_hist.jinja
Normal file
@ -0,0 +1,19 @@
|
||||
{% 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 %}
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% 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 %}
|
@ -1,10 +1,10 @@
|
||||
{% 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 %}
|
@ -1,11 +1,11 @@
|
||||
{% 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>
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post" action="">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<p>You successfully reset your password!</p>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post" action="">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Password reset sent</h2>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}{{ title }}{% endblock %}
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
{% extends "core/base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{{ profile.get_display_name }}'s profile
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>User Profile</h3>
|
||||
<p><a href="{% url 'core:user_list' %}">Back to list</a></p>
|
||||
|
||||
<ul>
|
||||
{% if user.id == profile.id %}
|
||||
<li><a href="{% url 'core:user_tools' %}">Tools</a></li>
|
||||
{% endif %}
|
||||
{% if perms.core.change_user or user.id == profile.id %}
|
||||
<li><a href="{% url 'core:user_edit' profile.id %}">Edit</a></li>
|
||||
{% endif %}
|
||||
{% if perms.core.change_prop_user %}
|
||||
<li><a href="{% url 'core:user_prop' profile.id %}">Props</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
You're seeing the profile of <strong>{{ profile.get_full_name }}</strong><br/>
|
||||
<strong>{{ profile.nick_name }}</strong><br/>
|
||||
<em>{{ profile.date_of_birth|date:"d/m/Y" }}</em>
|
||||
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
|
31
core/templates/core/user_detail.jinja
Normal file
31
core/templates/core/user_detail.jinja
Normal file
@ -0,0 +1,31 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{{ profile.get_display_name() }}'s profile
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>User Profile</h3>
|
||||
<p><a href="{{ url('core:user_list') }}">Back to list</a></p>
|
||||
|
||||
<ul>
|
||||
{% if request.user.id == profile.id %}
|
||||
<li><a href="{{ url('core:user_tools') }}">Tools</a></li>
|
||||
{% endif %}
|
||||
{% if user.has_perms('core.change_user') or user.id == profile.id %}
|
||||
<li><a href="{{ url('core:user_edit', user_id=profile.id) }}">Edit</a></li>
|
||||
{% endif %}
|
||||
{% if user.has_perms('core.change_prop_user') %}
|
||||
<li><a href="{{ url('core:user_prop', user_id=profile.id) }}">Props</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
You're seeing the profile of <strong>{{ profile.get_full_name() }}</strong><br/>
|
||||
<strong>{{ profile.nick_name }}</strong><br/>
|
||||
<em>{{ profile.date_of_birth|date("d/m/Y") }}</em>
|
||||
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Edit user profile</h2>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form.as_p() }}
|
||||
<p><input type="submit" value="Update" /></p>
|
||||
</form>
|
||||
{% endblock %}
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
User list
|
||||
@ -8,7 +8,7 @@ User list
|
||||
<h3>User list</h3>
|
||||
<ul>
|
||||
{% for u in user_list %}
|
||||
<li><a href="{% url 'core:user_profile' u.id %}">{{ u.get_display_name }}</a></li>
|
||||
<li><a href="{{ url('core:user_profile', user_id=u.id) }}">{{ u.get_display_name() }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
@ -1,10 +1,10 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Edit user groups</h2>
|
||||
<h2>Edit user groups for {{ profile.get_full_name() }}</h2>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form.as_p() }}
|
||||
<p><input type="submit" value="Update" /></p>
|
||||
</form>
|
||||
{% endblock %}
|
@ -1,20 +0,0 @@
|
||||
{% extends "core/base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{{ user.get_display_name }}'s tools
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>User Tools</h3>
|
||||
<p><a href="{% url 'core:user_profile' user.id %}">Back to profile</a></p>
|
||||
|
||||
<ul>
|
||||
{% if perms.core.add_group %}
|
||||
<li><a href="{% url 'core:group_list' %}">Groups</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
20
core/templates/core/user_tools.jinja
Normal file
20
core/templates/core/user_tools.jinja
Normal file
@ -0,0 +1,20 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{{ user.get_display_name() }}'s tools
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>User Tools</h3>
|
||||
<p><a href="{{ url('core:user_profile', user_id=request.user.id) }}">Back to profile</a></p>
|
||||
|
||||
<ul>
|
||||
{% if user.has_perms('core.add_group') %}
|
||||
<li><a href="{{ url('core:group_list') }}">Groups</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user