diff options
author | 2018-05-02 14:50:09 +0100 | |
---|---|---|
committer | 2018-05-02 14:50:09 +0100 | |
commit | 9dc05b5324b478ab84276f6f0ac993c56cc13c3a (patch) | |
tree | 8fdeb978e5529d4f631e72bf6e752e594762b6bb /templates | |
parent | [All Pages] Fix links (diff) |
[Wiki] Implement page deletions and improve sidebar construction
Diffstat (limited to 'templates')
-rw-r--r-- | templates/wiki/base.html | 87 | ||||
-rw-r--r-- | templates/wiki/page_delete.html | 26 | ||||
-rw-r--r-- | templates/wiki/page_edit.html | 2 |
3 files changed, 79 insertions, 36 deletions
diff --git a/templates/wiki/base.html b/templates/wiki/base.html index 28431324..eec0ecb8 100644 --- a/templates/wiki/base.html +++ b/templates/wiki/base.html @@ -70,24 +70,47 @@ <i class="uk-icon fas fa-fw fa-cube"></i> Minecraft </a></li> - <li class="uk-nav-divider"></li> + {% set ACTIONABLE_PAGES = ["page", "edit", "history.show", "history.compare", "source", "delete"] %} + {% set actionable = current_page in ACTIONABLE_PAGES %} - {% if (can_edit or debug) and current_page != "edit" %} - <li> - <a href="{{ url_for("wiki.edit", page=page) }}"> - <i class="uk-icon fas fa-fw fa-pencil-alt"></i> Edit - </a> - </li> - {% elif current_page == "edit" %} - <li> - <a href="{{ url_for("wiki.page", page=page) }}"> - <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back - </a> - </li> - {% endif %} + {% if actionable %} + <li class="uk-nav-divider"></li> + + {% if current_page == "edit" %} + <li> + <a href="{{ url_for("wiki.page", page=page) }}"> + <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back + </a> + </li> + {% else %} + <li> + <a href="{{ url_for("wiki.edit", page=page) }}"> + <i class="uk-icon fas fa-fw fa-pencil-alt"></i> Edit + </a> + </li> + {% endif %} + + {% if current_page == "delete" %} + <li> + <a href="{{ url_for("wiki.page", page=page) }}"> + <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back + </a> + </li> + {% else %} + <li> + <a href="{{ url_for("wiki.delete", page=page) }}"> + <i class="uk-icon fas fa-fw fa-trash"></i> Delete + </a> + </li> + {% endif %} - {% if current_page != "history.show" %} - {% if current_page == "history.compare" %} + {% if current_page == "history.show" %} + <li> + <a href="{{ url_for("wiki.page", page=page) }}"> + <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back + </a> + </li> + {% elif current_page == "history.compare" %} <li> <a href="{{ url_for("wiki.history.show", page=slug) }}"> <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back @@ -100,26 +123,20 @@ </a> </li> {% endif %} - {% else %} - <li> - <a href="{{ url_for("wiki.page", page=page) }}"> - <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back - </a> - </li> - {% endif %} - {% if current_page != "source" %} - <li> - <a href="{{ url_for("wiki.source", page=page) }}"> - <i class="uk-icon fas fa-fw fa-code"></i> Source - </a> - </li> - {% else %} - <li> - <a href="{{ url_for("wiki.page", page=page) }}"> - <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back - </a> - </li> + {% if current_page == "source" %} + <li> + <a href="{{ url_for("wiki.page", page=page) }}"> + <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back + </a> + </li> + {% else %} + <li> + <a href="{{ url_for("wiki.source", page=page) }}"> + <i class="uk-icon fas fa-fw fa-code"></i> Source + </a> + </li> + {% endif %} {% endif %} <li class="uk-nav-divider"></li> diff --git a/templates/wiki/page_delete.html b/templates/wiki/page_delete.html new file mode 100644 index 00000000..f4d52653 --- /dev/null +++ b/templates/wiki/page_delete.html @@ -0,0 +1,26 @@ +{% extends "wiki/base.html" %} +{% block title %}Wiki | Delete: {{ page }}{% endblock %} +{% block og_title %}Wiki | Delete: {{ page }}{% endblock %} +{% block og_description %}{% endblock %} +{% block extra_head %} +<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.3/ace.js" type="application/javascript"></script> +{% endblock %} +{% block content %} + <div uk-alert class="uk-alert-danger"> + <h3>Delete Page: {{ page }}</h3> + <p> + Are you sure you want to delete this page? + </p> + + <form uk-grid class="uk-grid-small" action="{{ url_for("wiki.delete", page=page) }}" method="post"> + <div class="uk-width-1-2"> + <a href="{{ url_for("wiki.page", page=page) }}" class="uk-button uk-button-primary uk-width-1-1" type="button" value="Cancel" id="cancel">Cancel</a> + </div> + <div class="uk-width-1-2"> + <input class="uk-button uk-button-secondary uk-width-1-1" type="submit" id="delete" value="Delete" /> + </div> + + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> + </form> + </div> +{% endblock %} diff --git a/templates/wiki/page_edit.html b/templates/wiki/page_edit.html index a2d709e2..51ce70db 100644 --- a/templates/wiki/page_edit.html +++ b/templates/wiki/page_edit.html @@ -1,7 +1,7 @@ {% extends "wiki/base.html" %} {% block title %}Wiki | Edit: {{ page }}{% endblock %} {% block og_title %}Wiki | Edit: {{ page }}{% endblock %} -{% block og_description %}Landing page for the wiki{% endblock %} +{% block og_description %}{% endblock %} {% block extra_head %} <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.3/ace.js" type="application/javascript"></script> {% endblock %} |