Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
03bc0973
Commit
03bc0973
authored
Feb 01, 2016
by
Skia
Browse files
WIP: Move to Jinja2
parent
abb8dc0c
Changes
34
Hide whitespace changes
Inline
Side-by-side
core/templates/core/403.
html
→
core/templates/core/403.
jinja
View file @
03bc0973
{% extends "core/base.
html
" %}
{%
extends
"core/base.
jinja
"
%}
{%
block
content
%}
...
...
core/templates/core/404.html
View file @
03bc0973
{% extends "core/base.
html
" %}
{% extends "core/base.
jinja
" %}
{% block content %}
...
...
core/templates/core/base.
html
→
core/templates/core/base.
jinja
View file @
03bc0973
{% 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>
core/templates/core/edit_user.html
View file @
03bc0973
{% extends "core/base.
html
" %}
{% extends "core/base.
jinja
" %}
{% block title %}
{% if profile %}
...
...
core/templates/core/group_edit.html
View file @
03bc0973
{% 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 %}
...
...
core/templates/core/group_list.html
View file @
03bc0973
{% 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 %}
...
...
core/templates/core/index.
html
→
core/templates/core/index.
jinja
View file @
03bc0973
{% 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
%}
core/templates/core/login.
html
→
core/templates/core/login.
jinja
View file @
03bc0973
{% 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
%}
core/templates/core/page.
html
→
core/templates/core/page.
jinja
View file @
03bc0973
{% 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
%}
core/templates/core/page_detail.
html
→
core/templates/core/page_detail.
jinja
View file @
03bc0973
{% 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
%}
...
...
core/templates/core/page_hist.html
deleted
100644 → 0
View file @
abb8dc0c
{% 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 %}
core/templates/core/page_hist.jinja
0 → 100644
View file @
03bc0973
{%
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
%}
core/templates/core/page_list.
html
→
core/templates/core/page_list.
jinja
View file @
03bc0973
{% 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
%}
...
...
core/templates/core/page_prop.
html
→
core/templates/core/page_prop.
jinja
View file @
03bc0973
{% 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
%}
...
...
core/templates/core/pagerev_edit.
html
→
core/templates/core/pagerev_edit.
jinja
View file @
03bc0973
{% 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>
...
...
core/templates/core/password_change.html
View file @
03bc0973
{% extends "core/base.
html
" %}
{% extends "core/base.
jinja
" %}
{% block content %}
...
...
core/templates/core/password_change_done.html
View file @
03bc0973
{% extends "core/base.
html
" %}
{% extends "core/base.
jinja
" %}
{% block content %}
...
...
core/templates/core/password_reset.html
View file @
03bc0973
{% extends "core/base.
html
" %}
{% extends "core/base.
jinja
" %}
{% block content %}
<form
method=
"post"
action=
""
>
...
...
core/templates/core/password_reset_complete.html
View file @
03bc0973
{% extends "core/base.
html
" %}
{% extends "core/base.
jinja
" %}
{% block content %}
<p>
You successfully reset your password!
</p>
...
...
core/templates/core/password_reset_confirm.html
View file @
03bc0973
{% extends "core/base.
html
" %}
{% extends "core/base.
jinja
" %}
{% block content %}
<form
method=
"post"
action=
""
>
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment