mirror of
https://git.cmoser.eu/tinytools/django-tinywiki.git
synced 2026-02-04 14:16:32 +01:00
2025.09.17-19:07:57
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
{% load i18n %}
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>TinyWiki</title>
|
||||
{% block extra_css %}{% endblock %}
|
||||
{% block scripts %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<span style="font-size:2.5rem;">TinyWiki</span>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="{% url 'tinywiki:home' %}">{% translate "HOME" %}</a></li>
|
||||
{% if user_can_create_wiki_pages %}
|
||||
<li><a href="{% url 'tinywiki:page-create' %}">{% translate "Create Page" %}</a></li>
|
||||
{% endif %}
|
||||
<li><a href="{% url 'tinywiki:toc' %}">{% translate "Wiki content" %}</a>
|
||||
</ul>
|
||||
</nav>
|
||||
<main class="content">
|
||||
{% block content %}
|
||||
<h1>It Works!</h1>
|
||||
{% endblock %}
|
||||
</main>
|
||||
{% block extra_scripts %}{% endblock extra_scripts %}
|
||||
</body>
|
||||
</html>
|
||||
44
tinywiki/templates/tinywiki/home/bs-wiki-content.html
Normal file
44
tinywiki/templates/tinywiki/home/bs-wiki-content.html
Normal file
@@ -0,0 +1,44 @@
|
||||
{% extends base_template %}
|
||||
{% load i18n static %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{% translate "Table of Contents" %}</h1>
|
||||
|
||||
{% for toc_section,pages_1,pages_2 in toc %}
|
||||
<h2>{{ toc_section }}</h2>
|
||||
<div class="row gx-4 mb-2">
|
||||
<div class="col-lg-6">
|
||||
<ul style="list-style-type:none;" class="mb-0 ps-0">
|
||||
{% for page in pages_1 %}
|
||||
<li>
|
||||
<a class="icon-link icon-link-hover" href="{% url 'tinywiki:page' page.slug %}">
|
||||
{{ page.title }}
|
||||
{% if page.is_system %}
|
||||
<svg class="bi"><use xlink:href="{% static 'icons/bootstrap-icons.svg' %}#journal" ></use></svg>
|
||||
{% else %}
|
||||
<svg class="bi"><use xlink:href="{% static 'icons/bootstrap-icons.svg' %}#book" ></use></svg>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<ul style="list-style-type:none;" class="mt-0 ps-0">
|
||||
{% for page in pages_2 %}
|
||||
<li>
|
||||
<a class="icon-link icon-link-hover" href="{% url 'tinywiki:page' page.slug %}">
|
||||
{{ page.title }}
|
||||
{% if page.is_system %}
|
||||
<svg class="bi"><use xlink:href="{% static 'icons/bootstrap-icons.svg' %}#journal" ></use></svg>
|
||||
{% else %}
|
||||
<svg class="bi"><use xlink:href="{% static 'icons/bootstrap-icons.svg' %}#book" ></use></svg>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor%}
|
||||
{% endblock %}
|
||||
32
tinywiki/templates/tinywiki/home/home.html
Normal file
32
tinywiki/templates/tinywiki/home/home.html
Normal file
@@ -0,0 +1,32 @@
|
||||
{% extends base_template %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/styles/default.min.css">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if page %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
{{ page.html_content }}
|
||||
{% else %}
|
||||
<h1>Welcome to TinyWiki</h1>
|
||||
|
||||
<p>{% blocktranslate %}You are seeing this welcome page because there is no Welcome page
|
||||
configured for your Wiki. To configure a welcome page create a new page with the
|
||||
slug <i>tw-home</i> and put the content for your welcome-page there.{% endblocktranslate %}</p>
|
||||
<p>{% blocktranslate %}You can use Markdown or BBCode to write your pages. If you don't know
|
||||
Markdown read the <a href="#">Guide for Markdown used by TinyWiki</a>. Or if you want to use
|
||||
BBCode there is a <a href="#">Guide for BBCode used by TinyWiki</a> too.{% endblocktranslate %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
||||
|
||||
{% block scripts %}
|
||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/highlight.min.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
<script>hljs.highlightAll();</script>
|
||||
{% endblock %}
|
||||
18
tinywiki/templates/tinywiki/home/wiki-content.html
Normal file
18
tinywiki/templates/tinywiki/home/wiki-content.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% extends base_template %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{% translate "Table of contents" %}</h1>
|
||||
|
||||
{% for toc_section,pages_1,pages_2 in toc %}
|
||||
<h2>{{ toc_section }}</h2>
|
||||
<ul>
|
||||
{% for page in pages_1 %}
|
||||
<li><a href="{% url 'tinywiki:page' page.slug %}">{{ page.title }}</a></li>
|
||||
{% endfor %}
|
||||
{% for page in pages_2 %}
|
||||
<li><a href="{% url 'tinywiki:page' page.slug %}">{{ page.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endfor%}
|
||||
{% endblock %}
|
||||
3
tinywiki/templates/tinywiki/icons/book.svg
Normal file
3
tinywiki/templates/tinywiki/icons/book.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-book" viewBox="0 0 16 16">
|
||||
<path d="M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 772 B |
4
tinywiki/templates/tinywiki/icons/box-arrow-up-right.svg
Normal file
4
tinywiki/templates/tinywiki/icons/box-arrow-up-right.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-box-arrow-up-right\" viewBox=\"0 0 16 16\">
|
||||
<path fill-rule=\"evenodd\" d=\"M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5\"/>
|
||||
<path fill-rule=\"evenodd\" d=\"M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0z\"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 552 B |
4
tinywiki/templates/tinywiki/icons/file-earmark-x.svg
Normal file
4
tinywiki/templates/tinywiki/icons/file-earmark-x.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-file-earmark-x" viewBox="0 0 16 16">
|
||||
<path d="M6.854 7.146a.5.5 0 1 0-.708.708L7.293 9l-1.147 1.146a.5.5 0 0 0 .708.708L8 9.707l1.146 1.147a.5.5 0 0 0 .708-.708L8.707 9l1.147-1.146a.5.5 0 0 0-.708-.708L8 8.293z"/>
|
||||
<path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2M9.5 3A1.5 1.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 485 B |
3
tinywiki/templates/tinywiki/icons/house.svg
Normal file
3
tinywiki/templates/tinywiki/icons/house.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-house" viewBox="0 0 16 16">
|
||||
<path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 415 B |
4
tinywiki/templates/tinywiki/icons/journal.svg
Normal file
4
tinywiki/templates/tinywiki/icons/journal.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-journal" viewBox="0 0 16 16">
|
||||
<path d="M3 0h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-1h1v1a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v1H1V2a2 2 0 0 1 2-2"/>
|
||||
<path d="M1 5v -.5a.5.5 0 0 1 1 0V5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1zm0 3v-.5a.5.5 0 0 1 1 0V8h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1zm0 3v-.5a.5.5 0 0 1 1 0v.5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 498 B |
26
tinywiki/templates/tinywiki/page/bs-view.html
Normal file
26
tinywiki/templates/tinywiki/page/bs-view.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% extends base_template %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/styles/default.min.css">
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/highlight.min.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
<script>hljs.highlightAll();</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="text-end">
|
||||
{% if user_can_edit_wiki_page %}
|
||||
<a class="btn btn-primary" href="{% url 'tinywiki:page-edit' slug=page.slug %}">{% translate "Edit Page" %}</a>
|
||||
{% endif %}
|
||||
{% if user_can_delete_wiki_page %}
|
||||
<button class="btn btn-danger" type="button">Delete Page</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
<h1>{{ page.title }}</h1>
|
||||
{{ page.html_content }}
|
||||
{% endblock content %}
|
||||
16
tinywiki/templates/tinywiki/page/create.html
Normal file
16
tinywiki/templates/tinywiki/page/create.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% extends "tinywiki/page/model-base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% translate "Create a new Wiki page" %}{% endblock title%}
|
||||
|
||||
{% block form_buttons %}
|
||||
{% if use_bootstrap %}
|
||||
<div class="text-end">
|
||||
<button class="btn btn-primary">{% translate "Create Page" %}</button>
|
||||
<a class="btn btn-secondary" href="{% url 'tinywiki:home' %}">{% translate "Cancel" %}</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<button type="submit">{% translate "Create Page" %}</button>
|
||||
<a class="button button-secondary" href="{% url 'tinywiki:home' %}">{% translate "Cancel" %}</a>
|
||||
{% endif %}
|
||||
{% endblock form_buttons %}
|
||||
0
tinywiki/templates/tinywiki/page/delete-view.html
Normal file
0
tinywiki/templates/tinywiki/page/delete-view.html
Normal file
16
tinywiki/templates/tinywiki/page/edit.html
Normal file
16
tinywiki/templates/tinywiki/page/edit.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% extends "tinywiki/page/model-base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% translate "Edit Wiki Page" %}{% endblock title%}
|
||||
|
||||
{% block form_buttons %}
|
||||
{% if use_bootstrap %}
|
||||
<div class="text-end">
|
||||
<button type="submit" class="btn btn-primary">{% translate "Save Changes" %}</button>
|
||||
<a class="btn btn-secondary" href="{% url "tinywiki:page" form.instance.slug %}">{% translate "Cancel" %}</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<button type="submit">{% translate "Save Changes" %}</button>
|
||||
<a class="button button-secondary" href="{% url "tinywiki:page" form.instance.slug %}">{% translate "Cancel" %}</a>
|
||||
{% endif %}
|
||||
{% endblock form_buttons %}
|
||||
0
tinywiki/templates/tinywiki/page/hx-delete.html
Normal file
0
tinywiki/templates/tinywiki/page/hx-delete.html
Normal file
107
tinywiki/templates/tinywiki/page/model-base.html
Normal file
107
tinywiki/templates/tinywiki/page/model-base.html
Normal file
@@ -0,0 +1,107 @@
|
||||
{% extends base_template %}
|
||||
{% load i18n widget_tweaks %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{% block title %}{% endblock title%}</h1>
|
||||
<form method="POST"
|
||||
id="wiki-page-form"
|
||||
action="{% if create %}{% url "tinywiki:page-create" %}{% else %}{% url "tinywiki:page-edit" slug=form.instance.slug|default:"1" %}{% endif %}">
|
||||
{% csrf_token %}
|
||||
{% if use_bootstrap %}
|
||||
<div class="form-floating mb-2">
|
||||
{% with "form-control form-control-lg "|add:title_extra as title_class %}
|
||||
{% render_field form.title class=title_class placeholder="{{ form.title.label }}" %}
|
||||
{% endwith %}
|
||||
<label for="{{ form.title.auto_id }}">{{ form.title.label }}</label>
|
||||
</div>
|
||||
<div class="form-floating mb-2">
|
||||
{% with "form-control form-control-sm "|add:slug_extra as slug_class%}
|
||||
{% render_field form.slug class=slug_class placeholder="{{ form.slug.label }}" %}
|
||||
{% endwith %}
|
||||
<label for="{{ form.slug.auto_id }}">{{ form.slug.label }}</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-2">
|
||||
<div class="form-floating mb-2">
|
||||
{% with "form-select form-select-sm "|add:content_type_extra as content_type_class %}
|
||||
{% render_field form.content_type_data class=content_type_class %}
|
||||
{% endwith %}
|
||||
<label for="{{ for.content_type_data.auto_id }}">{{ form.content_type_data.label }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-2">
|
||||
{% with "form-select form-select-sm "|add:status_extra as status_class %}
|
||||
{% render_field form.status_data class=status_class %}
|
||||
{% endwith %}
|
||||
<label for="{{ for.status_data.auto_id }}">{{ form.status_data.label }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
{% with "form-control h-100 "|add:content_extra as content_class %}
|
||||
{% render_field form.content class=content_class rows="25"%}
|
||||
{% endwith %}
|
||||
<label for="{{ form.content.auto_id }}">{{ form.content.label }}</label>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
|
||||
</div>
|
||||
{% else %}
|
||||
<p>
|
||||
{% with title_extra|default:"" as title_class %}
|
||||
{{ form.title.label_tag }}{% render_field form.title class=Title_class %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
<p>
|
||||
{% with slug_extra|default:"" as slug_class %}
|
||||
{{ form.slug.label_tag }}{% render_field form.slug class=slug_class %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
<p>
|
||||
{% with content_type_extra|default:"" as content_type_class %}
|
||||
{{ form.content_type_data.label_tag }}{% render_field form.content_type_data class=content_type_class %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
<p>
|
||||
{% with status_extra|default:"" as status_class %}
|
||||
{{ form.status_data.label_tag }}{% render_field form.status_data class=status_class %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
<p>
|
||||
{% with content_extra|default:"" as content_class %}
|
||||
{{ form.content.label_tag }}{% render_field form.content class=content_class cols=80 rows=30 %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% block form_buttons %}{% endblock form_buttons %}
|
||||
</form>
|
||||
{% endblock content%}
|
||||
|
||||
{% block extra_scripts %}
|
||||
<script>
|
||||
document.getElementById("id_content").addEventListener('keydown',function(e) {
|
||||
if (e.key == "Tab") {
|
||||
e.preventDefault();
|
||||
var start = this.selectionStart;
|
||||
var end = this.selectionEnd;
|
||||
|
||||
console.log(this.value);
|
||||
// set textarea value to: text before caret + 4 spaces + text after caret
|
||||
this.value = this.value.substring(0,start) + " " + this.value.substring(end);
|
||||
this.selectionStart = this.selectionEnd = start + 4;
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown',function(e) {
|
||||
if (e.ctrlKey && e.key == "s") {
|
||||
e.preventDefault();
|
||||
|
||||
var form = document.getElementById('wiki-page-form');
|
||||
form.action = form.action + "?save=1";
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock extra_scripts %}
|
||||
24
tinywiki/templates/tinywiki/page/view.html
Normal file
24
tinywiki/templates/tinywiki/page/view.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends base_template %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/styles/default.min.css">
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/highlight.min.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
<script>hljs.highlightAll();</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if user_can_edit_wiki_page %}
|
||||
<a href="{% url 'tinywiki:page-edit' slug=page.slug %}">{% translate "Edit Page" %}</a>
|
||||
{% endif %}
|
||||
{% if user_can_delete_wiki_page %}
|
||||
<a href="#">Delete Page</a>
|
||||
{% endif %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
{{ page.html_content }}
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user