diff options
author | 2019-04-15 11:45:46 +0100 | |
---|---|---|
committer | 2019-04-15 11:45:46 +0100 | |
commit | ab1b31e9091a173bf22712df9133328d0408ecee (patch) | |
tree | 43331a6d327e69e6dfa51329f9e55a5b76c12f8f | |
parent | Editor: TOC insert correctly places on previous line rather than next line (diff) |
Remove TOC, link headers, fix breadcrumb padding
Also removes some templates we don't care about
-rw-r--r-- | pydis_site/settings.py | 4 | ||||
-rw-r--r-- | pydis_site/static/css/wiki/style.css | 3 | ||||
-rw-r--r-- | pydis_site/static/js/wiki/load_editor.js | 21 | ||||
-rw-r--r-- | pydis_site/templates/wiki/accounts/account_settings.html | 14 | ||||
-rw-r--r-- | pydis_site/templates/wiki/accounts/login.html | 38 | ||||
-rw-r--r-- | pydis_site/templates/wiki/accounts/signup.html | 27 | ||||
-rw-r--r-- | pydis_site/templates/wiki/base.html | 3 | ||||
-rw-r--r-- | pydis_site/templates/wiki/includes/article_menu.html | 125 | ||||
-rw-r--r-- | pydis_site/templates/wiki/includes/breadcrumbs.html | 4 |
9 files changed, 73 insertions, 166 deletions
diff --git a/pydis_site/settings.py b/pydis_site/settings.py index 70ec0a84..c4a1bf7e 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -287,11 +287,13 @@ WIKI_ACCOUNT_HANDLING = False WIKI_ACCOUNT_SIGNUP_ALLOWED = False WIKI_ANONYMOUS = True +WIKI_ANONYMOUS_WRITE = False WIKI_MARKDOWN_KWARGS = { "extension_configs": { "wiki.plugins.macros.mdx.toc": { - "title": "Contents" + "anchorlink": True, + "baselevel": 2 } }, "extensions": [ "markdown.extensions.abbr", diff --git a/pydis_site/static/css/wiki/style.css b/pydis_site/static/css/wiki/style.css new file mode 100644 index 00000000..b4f233f7 --- /dev/null +++ b/pydis_site/static/css/wiki/style.css @@ -0,0 +1,3 @@ +.breadcrumb-section { + padding: 1rem; +} diff --git a/pydis_site/static/js/wiki/load_editor.js b/pydis_site/static/js/wiki/load_editor.js index 69730b14..dfa087d9 100644 --- a/pydis_site/static/js/wiki/load_editor.js +++ b/pydis_site/static/js/wiki/load_editor.js @@ -17,28 +17,8 @@ title: "Insert image", }; - const TOCAction = { - name: "toc", - action: insertTOC, - className: "fa fa-stream", - title: "Insert Table of Contents" - }; - let elements = document.getElementsByClassName("simple-mde"); - function insertTOC(editor) { - let doc = editor.codemirror.getDoc(), - cursor = doc.getCursor(), - line = doc.getLine(cursor.line), - position = {"line": cursor.line, "ch": 0}; - - if (line.length === 0) { - doc.replaceRange(TOCText, position); - } else { - doc.replaceRange(TOCText + "\n", position) - } - } - for (let element of elements) { window.editors[element.id] = new SimpleMDE({ "element": element, @@ -67,7 +47,6 @@ "bold", "italic", "strikethrough", headingAction, "|", "code", "quote", "unordered-list", "ordered-list", "|", "link", imageAction, "table", "horizontal-rule", "|", - TOCAction, "|", "preview", "side-by-side", "fullscreen", "|", "guide" ], diff --git a/pydis_site/templates/wiki/accounts/account_settings.html b/pydis_site/templates/wiki/accounts/account_settings.html deleted file mode 100644 index ecff4376..00000000 --- a/pydis_site/templates/wiki/accounts/account_settings.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "wiki/base.html" %} -{% load i18n wiki_tags sekizai_tags %} - -{% block wiki_pagetitle %}{% trans "Account Settings" %}{% endblock %} - -{% block wiki_contents %} -<h1 class="page-header">{% trans "Account Settings" %}</h1> -<form class="form-horizontal" action="" method="post">{% csrf_token %} - {% wiki_form form %} - <button type="submit" name="save_changes" class="btn btn-primary btn-lg"> - {% trans "Update" %} - </button> -</form> -{% endblock %} diff --git a/pydis_site/templates/wiki/accounts/login.html b/pydis_site/templates/wiki/accounts/login.html deleted file mode 100644 index 082d47bd..00000000 --- a/pydis_site/templates/wiki/accounts/login.html +++ /dev/null @@ -1,38 +0,0 @@ -{% extends "wiki/base.html" %} -{% load i18n wiki_tags sekizai_tags %} - -{% block wiki_pagetitle %}{% trans "Log in" %}{% endblock %} - -{% block wiki_contents %} -<div class="row"> - <div class="col-lg-3"></div> - <div class="col-lg-6"> - <h1 class="page-header">{% trans "Please log in" %}</h1> - <form method="POST" class="form-horizontal"> - {% wiki_form form %} - <div class="form-group form-actions"> - <div class="col-lg-2"></div> - <div class="col-lg-10"> - <button type="submit" name="save_changes" class="btn btn-primary btn-lg"> - <span class="fa fa-lock"></span> - {% trans "Log me in..." %} - </button> - </div> - </div> - </form> - - <p> - {% trans "Don't have an account?" %} <a href="{% url 'wiki:signup' %}">{% trans "Sign up" %} »</a> - </p> - - </div> - <div class="col-lg-3"></div> -</div> - -{% addtoblock "js" %} -<script type="text/javascript"> - $('#id_username').focus(); -</script> -{% endaddtoblock %} - -{% endblock %} diff --git a/pydis_site/templates/wiki/accounts/signup.html b/pydis_site/templates/wiki/accounts/signup.html deleted file mode 100644 index 6db65d3d..00000000 --- a/pydis_site/templates/wiki/accounts/signup.html +++ /dev/null @@ -1,27 +0,0 @@ -{% extends "wiki/base.html" %} -{% load i18n wiki_tags sekizai_tags %} -{% block wiki_pagetitle %}{% trans "Sign up" %}{% endblock %} - -{% block wiki_contents %} -<h1 class="page-header">{% trans "Sign up" %}</h1> -<form method="POST" class="form-horizontal"> -{% wiki_form form %} -<div class="form-group form-actions"> - <div class="col-lg-2"></div> - <div class="col-lg-10"> - <button type="submit" name="save_changes" class="btn btn-primary btn-lg"> - <span class="fa fa-plus"></span> - {% trans "Sign me up..." %} - </button> - </div> -</div> -</form> -{% addtoblock "js" %} -<script type="text/javascript"> - function {{ honeypot_jsfunction }}() { - $('.{{ honeypot_class }}').parent().parent().hide(); - } - $(document).ready({{ honeypot_jsfunction }}); -</script> -{% endaddtoblock %} -{% endblock %} diff --git a/pydis_site/templates/wiki/base.html b/pydis_site/templates/wiki/base.html index e1742657..112523cd 100644 --- a/pydis_site/templates/wiki/base.html +++ b/pydis_site/templates/wiki/base.html @@ -10,10 +10,11 @@ <script src="{% static "wiki/js/jquery-3.3.1.min.js" %}" type="text/javascript"></script> <script src="{% static "wiki/js/core.js" %}" type="text/javascript"></script> + <script src="{% static "js/wiki/simplemde.min.js" %}" type="text/javascript"></script> <link rel="stylesheet" href="{% static "css/wiki/simplemde.min.css" %}"> <link rel="stylesheet" href="{% static "css/wiki/simplemde-fixes.css" %}"> - <script src="{% static "js/wiki/simplemde.min.js" %}" type="text/javascript"></script> + <link rel="stylesheet" href="{% static "css/wiki/style.css" %}"> {% endblock %} {% block content %} diff --git a/pydis_site/templates/wiki/includes/article_menu.html b/pydis_site/templates/wiki/includes/article_menu.html index 56762420..c6cb6bf0 100644 --- a/pydis_site/templates/wiki/includes/article_menu.html +++ b/pydis_site/templates/wiki/includes/article_menu.html @@ -1,83 +1,84 @@ {% load i18n wiki_tags %} -{% with selected_tab as selected %} - <nav class="navbar is-light" role="navigation" aria-label="wiki navigation"> - <div class="container"> - <div class="navbar-brand"> - {% if not user.is_anonymous %} - <a class="navbar-item{% if selected == "settings" %} is-active{% endif %}" - href="{% url 'wiki:settings' article_id=article.id path=urlpath.path %}" - > - <span class="icon"> - <i class="fas fa-wrench"></i> - </span> +{% if not user.is_anonymous %} + {% with selected_tab as selected %} + <nav class="navbar is-light" role="navigation" aria-label="wiki navigation"> + <div class="container"> + <div class="navbar-brand"> + {% if not user.is_anonymous %} + <a class="navbar-item{% if selected == "settings" %} is-active{% endif %}" + href="{% url 'wiki:settings' article_id=article.id path=urlpath.path %}" + > + <span class="icon"> + <i class="fas fa-wrench"></i> + </span> - <span class="is-hidden-mobile"> Settings</span> - </a> - {% endif %} + <span class="is-hidden-mobile"> Settings</span> + </a> + {% endif %} - {% for plugin in article_tabs %} - <a class="navbar-item{% if selected == plugin.slug %} is-active{% endif %}" - href="{% url 'wiki:plugin' slug=plugin.slug article_id=article.id path=urlpath.path %}" + {% for plugin in article_tabs %} + <a class="navbar-item{% if selected == plugin.slug %} is-active{% endif %}" + href="{% url 'wiki:plugin' slug=plugin.slug article_id=article.id path=urlpath.path %}" + > + <span class="icon"> + <i class="{{ plugin.article_tab.1 }}"></i> + </span> + + <span class="is-hidden-mobile"> {{ plugin.article_tab.0 }}</span> + </a> + {% endfor %} + + <a class="navbar-item{% if selected == "history" %} is-active{% endif %}" + href="{% url 'wiki:history' article_id=article.id path=urlpath.path %}" > <span class="icon"> - <i class="{{ plugin.article_tab.1 }}"></i> + <i class="fas fa-clock"></i> </span> - <span class="is-hidden-mobile"> {{ plugin.article_tab.0 }}</span> + <span class="is-hidden-mobile"> Changes</span> </a> - {% endfor %} - <a class="navbar-item{% if selected == "history" %} is-active{% endif %}" - href="{% url 'wiki:history' article_id=article.id path=urlpath.path %}" - > - <span class="icon"> - <i class="fas fa-clock"></i> - </span> + {% if article|can_write:user and not article.current_revision.locked %} + <a class="navbar-item{% if selected == "edit" %} is-active{% endif %}" + href="{% url 'wiki:edit' article_id=article.id path=urlpath.path %}" + > + <span class="icon"> + <i class="fas fa-edit"></i> + </span> - <span class="is-hidden-mobile"> Changes</span> - </a> + <span class="is-hidden-mobile"> Edit</span> + </a> + {% else %} + <a class="navbar-item{% if selected == "source" %} is-active{% endif %}" + href="{% url 'wiki:source' article_id=article.id path=urlpath.path %}" + > + <span class="icon"> + <i class="fas fa-book-spells"></i> + </span> - {% if article|can_write:user and not article.current_revision.locked %} - <a class="navbar-item{% if selected == "edit" %} is-active{% endif %}" - href="{% url 'wiki:edit' article_id=article.id path=urlpath.path %}" - > - <span class="icon"> - <i class="fas fa-edit"></i> - </span> + <span class="is-hidden-mobile"> View Source</span> + </a> + {% endif %} - <span class="is-hidden-mobile"> Edit</span> - </a> - {% else %} - <a class="navbar-item{% if selected == "source" %} is-active{% endif %}" - href="{% url 'wiki:source' article_id=article.id path=urlpath.path %}" + <a class="navbar-item{% if selected == "view" %} is-active{% endif %}" + href="{% url 'wiki:get' article_id=article.id path=urlpath.path %}" > <span class="icon"> - <i class="fas fa-book-spells"></i> + <i class="fas fa-book-open"></i> </span> - <span class="is-hidden-mobile"> View Source</span> + <span class="is-hidden-mobile"> View</span> </a> - {% endif %} - - <a class="navbar-item{% if selected == "view" %} is-active{% endif %}" - href="{% url 'wiki:get' article_id=article.id path=urlpath.path %}" - > - <span class="icon"> - <i class="fas fa-book-open"></i> - </span> - <span class="is-hidden-mobile"> View</span> - </a> + <a role="button" class="navbar-burger" data-target="wiki-menu" aria-label="menu" aria-expanded="false"> + <span aria-hidden="true"></span> + <span aria-hidden="true"></span> + <span aria-hidden="true"></span> + </a> + </div> - <a role="button" class="navbar-burger" data-target="wiki-menu" aria-label="menu" aria-expanded="false"> - <span aria-hidden="true"></span> - <span aria-hidden="true"></span> - <span aria-hidden="true"></span> - </a> </div> - - </div> - </nav> - -{% endwith %} + </nav> + {% endwith %} +{% endif %} diff --git a/pydis_site/templates/wiki/includes/breadcrumbs.html b/pydis_site/templates/wiki/includes/breadcrumbs.html index 708edb19..a2359f39 100644 --- a/pydis_site/templates/wiki/includes/breadcrumbs.html +++ b/pydis_site/templates/wiki/includes/breadcrumbs.html @@ -1,5 +1,5 @@ -{% if urlpath and article %} - <section class="section"> +{% if urlpath and article and not user.is_anonymous %} + <section class="breadcrumb-section section"> <div class="container"> <nav class="breadcrumb is-pulled-left" aria-label="breadcrumbs"> <ul> |