mirror of
https://github.com/ae-utbm/sith.git
synced 2025-11-22 20:56:59 +00:00
Custom 404 for Page
This commit is contained in:
@@ -1,27 +1,15 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% if page %}
|
||||
{{ page.get_display_name() }}
|
||||
{% elif page_list %}
|
||||
{% trans %}Page list{% endtrans %}
|
||||
{% elif new_page %}
|
||||
{% trans %}Create page{% endtrans %}
|
||||
{% else %}
|
||||
{% trans %}Not found{% endtrans %}
|
||||
{% endif %}
|
||||
{{ page.get_display_name() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block metatags %}
|
||||
{% if page %}
|
||||
<meta property="og:url" content="{{ request.build_absolute_uri(page.get_absolute_url()) }}" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="article:section" content="{% trans %}Page{% endtrans %}" />
|
||||
<meta property="og:title" content="{{ page.get_display_name() }}" />
|
||||
<meta property="og:image" content="{{ request.build_absolute_uri(static("core/img/logo_no_text.png")) }}" />
|
||||
{% else %}
|
||||
{{ super() }}
|
||||
{% endif %}
|
||||
<meta property="og:url" content="{{ request.build_absolute_uri(page.get_absolute_url()) }}" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="article:section" content="{% trans %}Page{% endtrans %}" />
|
||||
<meta property="og:title" content="{{ page.get_display_name() }}" />
|
||||
<meta property="og:image" content="{{ request.build_absolute_uri(static("core/img/logo_no_text.png")) }}" />
|
||||
{% endblock %}
|
||||
|
||||
{%- macro print_page_name(page) -%}
|
||||
@@ -35,30 +23,22 @@
|
||||
{{ print_page_name(page) }}
|
||||
<div class="tool_bar">
|
||||
<div class="tools">
|
||||
{% if page %}
|
||||
{% if page.club %}
|
||||
<a href="{{ url('club:club_view', club_id=page.club.id) }}">{% trans %}Return to club management{% endtrans %}</a>
|
||||
{% else %}
|
||||
<a href="{{ url('core:page', page.get_full_name()) }}">{% trans %}View{% endtrans %}</a>
|
||||
{% endif %}
|
||||
<a href="{{ url('core:page_hist', page_name=page.get_full_name()) }}">{% trans %}History{% endtrans %}</a>
|
||||
{% if can_edit(page, user) %}
|
||||
<a href="{{ url('core:page_edit', page_name=page.get_full_name()) }}">{% trans %}Edit{% endtrans %}</a>
|
||||
{% endif %}
|
||||
{% if can_edit_prop(page, user) and not page.is_club_page %}
|
||||
<a href="{{ url('core:page_prop', page_name=page.get_full_name()) }}">{% trans %}Prop{% endtrans %}</a>
|
||||
{% endif %}
|
||||
{% if page.club %}
|
||||
<a href="{{ url('club:club_view', club_id=page.club.id) }}">{% trans %}Return to club management{% endtrans %}</a>
|
||||
{% else %}
|
||||
<a href="{{ url('core:page', page.get_full_name()) }}">{% trans %}View{% endtrans %}</a>
|
||||
{% endif %}
|
||||
<a href="{{ url('core:page_hist', page_name=page.get_full_name()) }}">{% trans %}History{% endtrans %}</a>
|
||||
{% if can_edit(page, user) %}
|
||||
<a href="{{ url('core:page_edit', page_name=page.get_full_name()) }}">{% trans %}Edit{% endtrans %}</a>
|
||||
{% endif %}
|
||||
{% if can_edit_prop(page, user) and not page.is_club_page %}
|
||||
<a href="{{ url('core:page_prop', page_name=page.get_full_name()) }}">{% trans %}Prop{% endtrans %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
{% if page %}
|
||||
{% block page %}
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
<h2>{% trans %}Page does not exist{% endtrans %}</h2>
|
||||
<p><a href="{{ url('core:page_new') }}?page={{ request.resolver_match.kwargs['page_name'] }}">
|
||||
{% trans %}Create it?{% endtrans %}</a></p>
|
||||
{% endif %}
|
||||
{% block page %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{% extends "core/page/base.jinja" %}
|
||||
|
||||
{% block page %}
|
||||
{% if rev %}
|
||||
<h4>{% trans rev_id=rev.revision %}This may not be the last update, you are seeing revision {{ rev_id }}!{% endtrans %}</h4>
|
||||
<h3>{{ rev.title }}</h3>
|
||||
<div class="page_content">{{ rev.content|markdown }}</div>
|
||||
{% else %}
|
||||
{% if page.revisions.last() %}
|
||||
<h3>{{ page.revisions.last().title }}</h3>
|
||||
<div class="page_content">{{ page.revisions.last().content|markdown }}</div>
|
||||
{% endif %}
|
||||
{% if revision and revision.id != last_revision.id %}
|
||||
<h4>
|
||||
{% trans trimmed rev_id=revision.revision %}
|
||||
This may not be the last update, you are seeing revision {{ rev_id }}!
|
||||
{% endtrans %}
|
||||
</h4>
|
||||
{% endif %}
|
||||
{% set current_revision = revision or last_revision %}
|
||||
<h3>{{ current_revision.title }}</h3>
|
||||
<div class="page_content">{{ current_revision.content|markdown }}</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
12
core/templates/core/page/not_found.jinja
Normal file
12
core/templates/core/page/not_found.jinja
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% trans %}Page does not exist{% endtrans %}</h2>
|
||||
<p>
|
||||
{# This template is rendered when a PageNotFound error is raised,
|
||||
so the `exception` context variable should always have a page_name attribute #}
|
||||
<a href="{{ url('core:page_new') }}?page={{ exception.page_name }}">
|
||||
{% trans %}Create it?{% endtrans %}
|
||||
</a>
|
||||
</p>
|
||||
{% endblock %}
|
||||
@@ -1,18 +1,13 @@
|
||||
{% extends "core/page/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
{% if page %}
|
||||
{{ super() }}
|
||||
{% endif %}
|
||||
{% block page %}
|
||||
<h2>{% trans %}Page properties{% endtrans %}</h2>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p() }}
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
</form>
|
||||
{% if page %}
|
||||
<a href="{{ url('core:page_delete', page_id=page.id)}}">{% trans %}Delete{% endtrans %}</a>
|
||||
{% endif %}
|
||||
<a href="{{ url('core:page_delete', page_id=page.id)}}">{% trans %}Delete{% endtrans %}</a>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user