diff options
Diffstat (limited to 'pydis_site/templates')
44 files changed, 1710 insertions, 0 deletions
| diff --git a/pydis_site/templates/wiki/accounts/account_settings.html b/pydis_site/templates/wiki/accounts/account_settings.html new file mode 100644 index 00000000..ecff4376 --- /dev/null +++ b/pydis_site/templates/wiki/accounts/account_settings.html @@ -0,0 +1,14 @@ +{% 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 new file mode 100644 index 00000000..082d47bd --- /dev/null +++ b/pydis_site/templates/wiki/accounts/login.html @@ -0,0 +1,38 @@ +{% 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 new file mode 100644 index 00000000..6db65d3d --- /dev/null +++ b/pydis_site/templates/wiki/accounts/signup.html @@ -0,0 +1,27 @@ +{% 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/article.html b/pydis_site/templates/wiki/article.html new file mode 100644 index 00000000..65877068 --- /dev/null +++ b/pydis_site/templates/wiki/article.html @@ -0,0 +1,40 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n sekizai_tags %} + + +{% block wiki_pagetitle %}{{ article.current_revision.title }}{% endblock %} + +{% block wiki_breadcrumbs %} +{% include "wiki/includes/breadcrumbs.html" %} +{% endblock %} + +{% block wiki_contents %} + +  <div id="article-container"> +    <ul class="nav nav-pills" id="article-menu"> +      <li class="pull-left" id="article-title-li"> +        <h1 id="article-title"> +          {{ article.current_revision.title }} +          <small style="font-size: 14px;"> +            {% if urlpath.parent %} +            <a href="{% url 'wiki:get' path=urlpath.path %}"><span class="fa fa-bookmark"></span> {{ urlpath.slug }}</a> +            {% endif %} +            {% if article.current_revision.locked %} +              <span class="fa fa-lock"></span> {% trans "locked" %} +            {% endif %} +          </small> +        </h1> +      </li> +      {% include "wiki/includes/article_menu.html" %} +    </ul> +    <div> +      {% block wiki_contents_tab %} +      {% endblock %} +    </div> +  </div> + +{% endblock %} + +{% block wiki_footer_prepend %} +  <p style="margin-bottom: 10px;"><em>{% trans "This article was last modified:" %} {{ article.current_revision.modified }}</em></p> +{% endblock %} diff --git a/pydis_site/templates/wiki/base.html b/pydis_site/templates/wiki/base.html new file mode 100644 index 00000000..5260bfcd --- /dev/null +++ b/pydis_site/templates/wiki/base.html @@ -0,0 +1,3 @@ +{% extends "wiki/base_site.html" %} + +{# Intentionally empty, to allow easy customization with no copy-paste #} diff --git a/pydis_site/templates/wiki/base_site.html b/pydis_site/templates/wiki/base_site.html new file mode 100644 index 00000000..d025e53c --- /dev/null +++ b/pydis_site/templates/wiki/base_site.html @@ -0,0 +1,164 @@ +{% load sekizai_tags i18n wiki_tags static %}<!DOCTYPE html> +<html lang="en"> +  <head> +    <meta charset="utf-8"> +    <title>{% block wiki_pagetitle %}{% endblock %}{% block wiki_site_title %} - django-\/\/  i K |{% endblock %}</title> +    <meta name="viewport" content="width=device-width, initial-scale=1.0"> +    <meta http-equiv="X-UA-Compatible" content="IE=edge"> +    <meta name="description" content=""> +    <meta name="author" content="www.django-wiki.org"> + +    <!-- Le styles --> +    <link href="{% static "wiki/bootstrap/css/wiki-bootstrap.min.css" %}" rel="stylesheet"> + +    {% render_block "css" %} + +    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> +    <!--[if lt IE 9]> +      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> +    <![endif]--> + +  </head> + +  <body> + +    {% block wiki_body %} + +    {% block wiki_navbar %} +    <div class="navbar navbar-fixed-top navbar-inverse"> +      <div class="container"> +        <div class="navbar-header"> +          <!-- .navbar-toggle is used as the toggle for collapsed navbar content --> +          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> +            <span class="icon-bar"></span> +            <span class="icon-bar"></span> +            <span class="icon-bar"></span> +          </button> +          {% block wiki_header_branding %} +          <a class="navbar-brand" href="{% url 'wiki:root' %}">django-\/\/ i K |</a> +          {% endblock %} +        </div> +        <div class="navbar-collapse collapse"> +          <form class="navbar-form navbar-right" id="wiki-search-form" method="GET" action="{% spaceless %} +              {% if article or urlpath %} +                {% url 'wiki:search' article_id=article.id path=urlpath.path %} +              {% else %} +                {% url 'wiki:search' %} +              {% endif %} +            {% endspaceless %}" +          > +            <div class="input-group"> +              <input type="search" class="form-control search-query" name="q" placeholder="{% spaceless %} +                {% if article or urlpath %} +                   {% trans "Search from current article..." %} +                {% else %} +                  {% trans "Search whole wiki..." %} +                {% endif %} +              {% endspaceless %}" /> +              <span class="input-group-btn"> +                <button class="btn btn-default" type="submit"> +                  <span class="fa fa-search"></span> +                </button> +              </span> +            </div><!-- /input-group --> +          </form> +          <div class="navbar-right"> +            {% if user.is_authenticated %} +            <ul class="nav navbar-nav"> +              <li class="dropdown"> +                <a href="#" class="dropdown-toggle" data-toggle="dropdown"> +                  <span class="badge notification-cnt">0</span> +                  {{ user }} +                  <b class="caret"></b> +                </a> +                <ul class="dropdown-menu"> +                  {% if "ACCOUNT_HANDLING"|wiki_settings %} +                  <li> +                    <a href="{% url 'wiki:profile_update' %}"> +                      <i class="fa fa-gear"></i> +                      {% trans "Account Settings" %} +                    </a> +                  </li> +                  {% endif %} +                  <li> +                    <a href="{{ "LOGOUT_URL"|wiki_settings }}"> +                      <i class="fa fa-power-off"></i> +                      {% trans "Log out" %} +                    </a> +                  </li> +                  {% if user.is_superuser %} +                  <li> +                    <a href="{% url 'wiki:deleted_list' %}"> +                      <i class="fa fa-trash-o"></i> +                      {% trans "Deleted articles" %} +                    </a> +                  </li> +                  {% endif %} +                  {% if "wiki.plugins.notifications"|plugin_enabled %} +                    {% include "wiki/plugins/notifications/menubaritem.html" %} +                  {% endif %} +                  {% if "wiki.plugins.globalhistory"|plugin_enabled %} +                    {% include "wiki/plugins/globalhistory/menubaritem.html" %} +                  {% endif %} +                </ul> +              </li> +            </ul> +            {% else %} +            <ul class="nav navbar-nav"> +              <li> +                <a href="{% login_url as wiki_login_url %}{{ wiki_login_url }}">{% trans "Log in" %}</a> +              </li> +              {% if "ACCOUNT_HANDLING"|wiki_settings %} +              <li> +                <a href="{% url 'wiki:signup' %}">{% trans "Sign up" %}</a> +              </li> +              {% endif %} +            </ul> +            {% endif %} +          </div> +          {% block wiki_header_navlinks %} +          <ul class="nav navbar-nav"> +            <li class="active"><a href="/">{% trans "Home" %}</a></li> +            <li><a href="https://github.com/django-wiki/django-wiki" target="_blank">{% trans "About" %}</a></li> +          </ul> +          {% endblock %} +        </div> +      </div> +    </div> +    {% endblock %} + +    <div class="container" style="margin-top: 60px;"> + +      {% wiki_messages %} + +      <!-- Reserved for breadcrumbs --> +      {% block wiki_breadcrumbs %}{% endblock %} + +      <!-- Main page contents go here --> +      {% block wiki_contents %}{% endblock %} + +      <footer id="wiki-footer"> +        <hr /> +        {% block wiki_footer_logo %} +        <a href="https://github.com/django-wiki/django-wiki" class="pull-right"><img src="{% static "wiki/img/github_icon.png" %}" /></a> +        {% endblock %} +        {% block wiki_footer_prepend %} +        {% endblock %} +        <p>{% blocktrans %}Powered by <a href="http://www.django-wiki.org">django-wiki</a>, an open source application under the <a href="http://www.gnu.org/licenses/quick-guide-gplv3.html">GPLv3</a> license. Let knowledge be the cure.{% endblocktrans %}</p> +        <div style="clear: both"></div> +      </footer> +      </div> + +    </div> <!-- /container --> + +    {% endblock %} + +    <script src="{% static "wiki/js/jquery-3.3.1.min.js" %}"></script> +    <script src="{% static "wiki/js/core.js" %}"></script> +    <script src="{% static "wiki/bootstrap/js/bootstrap.min.js" %}"></script> +    <!-- Optionally enable responsive features in IE8 --> +    <script src="{% static "wiki/js/respond.min.js" %}"></script> +    {% render_block "js" %} + +  </body> +</html> diff --git a/pydis_site/templates/wiki/create.html b/pydis_site/templates/wiki/create.html new file mode 100644 index 00000000..669a5ac4 --- /dev/null +++ b/pydis_site/templates/wiki/create.html @@ -0,0 +1,50 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n sekizai_tags static %} + + +{% block wiki_pagetitle %}{% trans "Add new article" %}{% endblock %} + +{% block wiki_contents %} + +  {% addtoblock "js" %} +  <script type="text/javascript" src="{% static "admin/js/urlify.js" %}"></script> +  <script type="text/javascript"> +  {% if not create_form.slug.value %} +  //<![CDATA[ +  (function($) { +	  $(document).ready(function (){ +		  $("#id_title").keyup(function () { +			  var e = $("#id_slug")[0]; +			  if(!e._changed) { +			    slug = URLify(this.value, 50); +				  e.value = slug; +			  } +	      }); +	  }); +  })(jQuery); +  //]]> +  {% endif %} +  </script> +  {% endaddtoblock %} + +  {% include "wiki/includes/editormedia.html" %} +  <h1 class="page-header">{% trans "Add new article" %}</h1> + +  <form method="POST" class="form-horizontal"> +    {% wiki_form create_form %} +    <div class="form-group form-actions"> +      <div class="col-lg-2"></div> +      <div class="col-lg-10"> +        <a href="{% url 'wiki:get' path=parent_urlpath.path %}" class="btn btn-default"> +          <span class="fa fa-arrow-left"></span> +          {% trans "Go back" %} +        </a> +        <button type="submit" name="save_changes" class="btn btn-primary"> +          <span class="fa fa-plus"></span> +          {% trans "Create article" %} +        </button> +      </div> +    </div> +  </form> + +{% endblock %} diff --git a/pydis_site/templates/wiki/create_root.html b/pydis_site/templates/wiki/create_root.html new file mode 100644 index 00000000..73a14ae0 --- /dev/null +++ b/pydis_site/templates/wiki/create_root.html @@ -0,0 +1,40 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n sekizai_tags static %} + +{% block wiki_pagetitle %}{% trans "Create root article" %}{% endblock %} + +{% block wiki_contents %} + +  {% addtoblock "js" %} +  {% for js in editor.Media.js %} +  <script type="text/javascript" src="{% static js %}"></script> +  {% endfor %} +  {% endaddtoblock %} + +  {% addtoblock "css" %} +  {% for media, srcs in editor.Media.css.items %} +    {% for src in srcs %} +      <link rel="stylesheet" media="{{ media }}" href="{% static src %}" /> +    {% endfor %} +  {% endfor %} +  {% endaddtoblock %} + +  <h1>{% trans "Congratulations!" %}</h1> +  <p class="lead"> +    {% trans "You have django-wiki installed... but there are no articles. So it's time to create the first one, the root article." %} +    {% trans "In the beginning, it will only be editable by administrators, but you can define permissions after." %} +  </p> + +  <h2 class="page-header">{% trans "Root article" %}</h2> + +  <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"> +        <input type="submit" name="save_changes" value="{% trans "Create root" %} »" class="btn btn-primary btn-lg" /> +      </div> +    </div> +  </form> + +{% endblock %} diff --git a/pydis_site/templates/wiki/delete.html b/pydis_site/templates/wiki/delete.html new file mode 100644 index 00000000..afb4140d --- /dev/null +++ b/pydis_site/templates/wiki/delete.html @@ -0,0 +1,67 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n sekizai_tags %} + + +{% block wiki_pagetitle %}{% trans "Delete article" %}{% endblock %} + +{% block wiki_contents %} +  <h1 class="page-header">{% trans "Delete" %} "{{ article.current_revision.title }}"</h1> + +  {% if cannot_delete_root %} +    <p class="lead">{% trans "You cannot delete a root article." %}</p> +    <p><a href="{% url 'wiki:get' path=urlpath.path article_id=article.id %}">{% trans "Go back" %}</a></p> +  {% else %} + +    {% if cannot_delete_children %} + +      <p class="alert alert-danger"><strong>{% trans "You cannot delete this article because you do not have permission to delete articles with children. Try to remove the children manually one-by-one." %}</strong></p> + +    {% endif %} + +    {% if delete_children %} + +      <p class="lead">{% trans "You are deleting an article. This means that its children will be deleted as well. If you choose to purge, children will also be purged!" %}</p> + +      <h2>{% trans "Articles that will be deleted" %}</h2> + +      <ul> +        {% for child in delete_children %} +        <li><a href="{% url 'wiki:get' article_id=child.article.id %}" target="_blank">{{ child.article }}</a></li> +        {% if delete_children_more %} +        <li><em>{% trans "...and more!" %}</em></li> +        {% endif %} +        {% endfor %} +      </ul> + +    {% endif %} + +    {% if not cannot_delete_children %} +    <p class="lead">{% trans "You are deleting an article. Please confirm." %}</p> + +    <form method="POST" class="form-horizontal"> +      {% wiki_form delete_form %} +      <div class="form-group form-actions"> +        <div class="col-lg-2"></div> +        <div class="col-lg-10"> +          <a href="{% url 'wiki:get' path=urlpath.path article_id=article.id %}" class="btn btn-default"> +            <span class="fa fa-arrow-left"></span> +            {% trans "Go back" %} +          </a> +          <button type="submit" name="save_changes" class="btn btn-danger"> +            <span class="fa fa-trash-o"></span> +            {% trans "Delete article" %} +          </button> +        </div> +      </div> +    </form> +    {% endif %} + +  {% endif %} + +{% addtoblock "js" %} +<script type="text/javascript"> +  $('#id_revision').val('{{ article.current_revision.id }}'); +</script> +{% endaddtoblock %} + +{% endblock %} diff --git a/pydis_site/templates/wiki/deleted.html b/pydis_site/templates/wiki/deleted.html new file mode 100644 index 00000000..55ce2b46 --- /dev/null +++ b/pydis_site/templates/wiki/deleted.html @@ -0,0 +1,56 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n sekizai_tags %} + + +{% block wiki_pagetitle %}{% trans "Article deleted" %}{% endblock %} + +{% block wiki_contents %} +  <style type="text/css"> +    label[for=id_confirm] { +      float: left; +      margin-right: 10px; +    } +  </style> +  <h1 class="page-header">{% trans "Article deleted" %}</h1> + +  <p class="lead"> +  {% trans "The article you were looking for has been deleted." %} +  </p> + +  <div class="row"> + +  {% if not article.current_revision.locked or article|can_delete:user %} +    <div class="col-lg-6"> +      <div class="well"> +        <h2>{% trans "Restore" %}</h2> +        <p>{% trans "You may restore this article and its children by clicking restore." %}</p> +        <p> +          <a href="?restore=1" class="btn btn-default"> +            <span class="fa fa-repeat"></span> +            {% trans "Restore" %} +          </a> +        </p> +      </div> +    </div> +  {% endif %} + +  {% if article|can_moderate:user %} +    <div class="col-lg-6"> +      <div class="well"> +        <h2>{% trans "Purge deletion" %}</h2> +        <p>{% trans "You may remove this article and any children permanently and free their slugs by clicking the below button. This action cannot be undone." %}</p> +        <form method="POST" class="form form-inline"> +          {% csrf_token %} +          {% wiki_form purge_form %} +            <button class="btn btn-default"> +              <span class="fa fa-remove"></span> +              {% trans "Purge" %} +            </button> +        </form> +      </div> +    </div> +  {% endif %} + +  </div> + +{% endblock %} diff --git a/pydis_site/templates/wiki/deleted_list.html b/pydis_site/templates/wiki/deleted_list.html new file mode 100644 index 00000000..d0d72824 --- /dev/null +++ b/pydis_site/templates/wiki/deleted_list.html @@ -0,0 +1,33 @@ +{% extends "wiki/base.html" %} +{% load i18n wiki_tags sekizai_tags %} + +{% block wiki_pagetitle %}{% trans "Admin Panel" %}{% endblock %} + +{% block wiki_contents %} + +<h1 class="page-header">{% trans "Deleted Articles" %}</h1> +{% if deleted_articles %} +  <table class="table table-striped"> +    <thead> +      <tr> +        <th>{% trans "Page Title" %}</th> +        <th>{% trans "Date Deleted" %}</th> +        <th>{% trans "Restore Article" %}</th> +      </tr> +    </thead> +    <tbody> +    {% for article in deleted_articles %} +      <tr> +        <td><a href="{{article.get_absolute_url}}">{{ article }}</a></td> +        <td> {{article.modified}} </td> +        <td><a href="{% url 'wiki:deleted' article_id=article.id %}?restore=1" class="btn btn-default"><span class="fa fa-repeat"></span> +            {% trans "Restore" %}</a></td> +      </tr> +    {% endfor %} +    </tbody> +  </table> +{% else %} +  <b> {% trans "No deleted articles to display" %} </b> +{% endif %} + +{% endblock %} diff --git a/pydis_site/templates/wiki/dir.html b/pydis_site/templates/wiki/dir.html new file mode 100644 index 00000000..86b04c85 --- /dev/null +++ b/pydis_site/templates/wiki/dir.html @@ -0,0 +1,82 @@ +{% extends "wiki/article.html" %} +{% load wiki_tags i18n humanize %} + + +{% block wiki_pagetitle %}{% trans "Listing articles in" %} {{ article.current_revision.title }}{% endblock %} + +{% block wiki_contents_tab %} + +{% url 'wiki:dir' urlpath.path as self_url %} + +<form class="form-search directory-toolbar"> +<div class="well well-small"> +  <div class="btn-group pull-left"> +    {% if urlpath.parent %} +    <a href="{% url 'wiki:dir' path=urlpath.parent.path %}" class="btn btn-default"> +      <span class="fa fa-arrow-up"></span> +      {% trans "Up one level" %} +    </a> +    {% endif %} +    <a href="{% url 'wiki:create' path=urlpath.path %}" class="btn btn-default"> +      <span class="fa fa-plus"></span> +      {% trans "Add article" %} +    </a> +  </div> +  <div class="pull-right"> +    {{ filter_form.query }} +  </div> +  {% if filter_query %} +    <div class="pull-right filter-clear"> +      <a href="{{ self_url }}">({% trans "clear" %})</a> +    </div> +  {% endif %} + +  <div class="clearfix"></div> +</div> +</form> + +<p> +  {% with paginator.object_list.count as cnt %} +    {% blocktrans with urlpath.path as path and cnt|pluralize:_("article,articles") as articles_plur and cnt|pluralize:_("is,are") as articles_plur_verb trimmed %} +      Browsing <strong><a href="{{ self_url }}">/{{ path }}</a></strong>. There {{ articles_plur_verb }} <strong>{{ cnt }} {{ articles_plur }}</strong> in this level. +    {% endblocktrans %} +  {% endwith %} +</p> + +<table class="table table-striped"> +  <tr> +    <th>{% trans "Title" %}</th> +    <th>{% trans "Slug" %}</th> +    <th>{% trans "Last modified" %}</th> +  </tr> +  {% for urlpath in directory %} +    <tr> +      <td> +        <a href="{% url 'wiki:get' path=urlpath.path %}"> {{ urlpath.article.current_revision.title }} </a> +        <a href="{% url 'wiki:dir' path=urlpath.path %}" class="list-children"> › </a> +        {% if urlpath.article.current_revision.deleted %} +          <span class="fa fa-trash"></span> +        {% endif %} +        {% if urlpath.article.current_revision.locked %} +          <span class="fa fa-lock"></span> +        {% endif %} +      </td> +      <td> +        {{ urlpath.slug }} +      </td> +      <td> +        {{ urlpath.article.current_revision.created|naturaltime }} +      </td> +    </tr> +    {% empty%} +    <tr> +      <td colspan="100"> +        <em>{% trans "There are no articles in this level" %}</em> +      </td> +    </tr> +  {% endfor %} +</table> + +{% include "wiki/includes/pagination.html" %} + +{% endblock %} diff --git a/pydis_site/templates/wiki/edit.html b/pydis_site/templates/wiki/edit.html new file mode 100644 index 00000000..aa9ee032 --- /dev/null +++ b/pydis_site/templates/wiki/edit.html @@ -0,0 +1,139 @@ +{% extends "wiki/article.html" %} +{% load wiki_tags i18n sekizai_tags %} + + +{% block wiki_pagetitle %}{% trans "Edit" %}: {{ article.current_revision.title }}{% endblock %} + +{% block wiki_contents_tab %} + +{% if not user.is_authenticated %} +<p class="alert alert-warning"> +{% trans "<strong>Warning:</strong> You are not logged in. Your IP address will be logged." %} +<a href="{% url 'wiki:login' %}?next={% url 'wiki:edit' article_id=article.id path=urlpath.path %}">{% trans "Click here to log in" %} »</a> +</p> +{% endif %} + +<div class="row"> + +  <div class="col-lg-8"> +    <form method="POST" class="form-horizontal" id="article_edit_form"> +      {% with edit_form as form %} +        {% include "wiki/includes/editor.html" %} +      {% endwith %} + +      <div class="form-group form-actions"> +        <div class="col-lg-12"> +          <div class="col-lg-offset-2"> +            <button class="btn btn-default" type="submit" name="preview" value="1" id="id_preview" +                    formaction="{% url 'wiki:preview' path=urlpath.path article_id=article.id %}" +                    formtarget="previewWindow" +                    > +              <span class="fa fa-eye"></span> +              {% trans "Preview" %} +            </button> +            <button class="btn btn-primary" type="submit" name="save" value="1" id="id_save"> +              <span class="fa fa-check"></span> +              {% trans "Save changes" %} +            </button> + +            <div class="btn-toolbar pull-right"> +              {% if user.is_authenticated and urlpath.path %} +              <a href="{% url 'wiki:move' path=urlpath.path article_id=article.id %}" class="btn btn-warning "> +                <span class="fa fa-random"></span> +                {% trans "Move article" %} +              </a> +              {% endif %} +              {% if article|can_delete:user %} +              <a href="{% url 'wiki:delete' path=urlpath.path article_id=article.id %}" class="btn btn-danger"> +                <span class="fa fa-trash-o"></span> +                {% trans "Delete article" %} +              </a> +              {% endif %} +            </div> +          </div> +        </div> +      </div> + +    </form> +  </div> + +  <div class="col-lg-4" id="wiki-edit-sidebar"> +    {% include "wiki/includes/editor_sidebar.html" %} +  </div> + +</div> + +<div style="clear: both"></div> + +{% include "wiki/includes/modals.html" %} + +<div class="modal fade wiki-modal" id="previewModal"> +  <div class="modal-dialog"> +    <div class="modal-content"> +      <div class="modal-body"> +        <iframe name="previewWindow" frameborder="0"></iframe> +      </div> +      <div class="modal-footer"> +        <a href="#" class="btn btn-default btn-lg" data-dismiss="modal"> +          <span class="fa fa-arrow-circle-left"></span> +          {% trans "Back to editor" %} +        </a> +        <a class="btn btn-lg btn-primary" id="id_preview_save_changes" href="#"> +          <span class="fa fa-check"></span> +          {% trans "Save changes" %} +        </a> +      </div> +    </div> +  </div> +</div> + +{% addtoblock "js" %} +<script language="javascript"> +  $(document).ready(function() { +    $("#article_edit_form :input").change(function() { +       $("#article_edit_form").data("changed",true); +    }); +    if ($("#article_edit_form").find(".alert-danger").length > 0 || $("#article_edit_form").find(".has-error").length > 0 ) { +      // Set the forms status as "changed" if there was a submission error +      $("#article_edit_form").data("changed",true); +    } +    window.onbeforeunload = confirmOnPageExit; +    var click_time = 0; +    $("#article_edit_form").on("submit", function (ev) { +        now = Date.now(); +        elapsed = now-click_time; +        click_time = now; +        if (elapsed < 3000) +            ev.preventDefault(); +        window.onbeforeunload = null; +        return true; +    }); +    $("#id_preview").on("click", function () { +        $("#previewModal").modal("show"); +        return true; +    }); +    $("#id_preview_save_changes").on("click", function (ev) { +        ev.preventDefault(); +        $("#id_save").trigger("click"); +    }); +  }); + +var confirmOnPageExit = function (e) { +  if ($("#article_edit_form").data("changed")) { +    e = e || window.event; +    var message = "You have unsaved changes!"; +    // For IE6-8 and Firefox prior to version 4 +    if (e) { +        e.returnValue = message; +    } +    // For Chrome, Safari, IE8+ and Opera 12+ +    return message; +  } else { +    // If the form hasn't been changed, don't display the pop-up +    return; +  } +}; +</script> +{% endaddtoblock %} + +{% endblock %} diff --git a/pydis_site/templates/wiki/error.html b/pydis_site/templates/wiki/error.html new file mode 100644 index 00000000..b54c8cff --- /dev/null +++ b/pydis_site/templates/wiki/error.html @@ -0,0 +1,45 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n %} + + +{% block wiki_pagetitle %}{% if article %}{{ article.current_revision.title }}{% else %}{% trans "Error" %}{% endif %}{% endblock %} + +{% block wiki_breadcrumbs %} +{% include "wiki/includes/breadcrumbs.html" %} +{% endblock %} + +{% block wiki_contents %} + +{% if error_type == "ancestors_missing" %} + +  <h1 class="page-header">{% trans "Not found" %}</h1> + +  <div class="missing"> +    <p>{% trans "This article was not found, and neither was its parent article." %}</p> +    <p> +      <a href="{% url 'wiki:get' path='' %}" class="btn btn-default"><i class="fa fa-arrow-left"></i> {% trans "Start page" %}</a> +    </p> +  </div> + +{% else %} + +  <h1 class="page-header">{% trans "Error" %}</h1> + +  <div class="error"> +    {% if not error_msg %} +    <p>{% trans "There was some sort of error accessing this page. Sorry!" %}</p> +    {% else %} +    <p>{{ error_msg }}</p> +    {% endif %} +  </div> + +  {% if article %} +  <p> +    <a href="{% url 'wiki:get' path=urlpath.path article_id=article.id %}" class="btn btn-default"><i class="fa fa-arrow-left"></i> {% trans "Back to" %} {{ article.current_revision.title }}</a> +  </p> +  {% endif %} + + +{% endif %} + +{% endblock %} diff --git a/pydis_site/templates/wiki/forms/markitup-admin.html b/pydis_site/templates/wiki/forms/markitup-admin.html new file mode 100644 index 00000000..d35bedb5 --- /dev/null +++ b/pydis_site/templates/wiki/forms/markitup-admin.html @@ -0,0 +1 @@ +<textarea name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% if widget.value %}{{ widget.value }}{% endif %}</textarea> diff --git a/pydis_site/templates/wiki/forms/markitup.html b/pydis_site/templates/wiki/forms/markitup.html new file mode 100644 index 00000000..87337e67 --- /dev/null +++ b/pydis_site/templates/wiki/forms/markitup.html @@ -0,0 +1 @@ +<div><textarea name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% if widget.value %}{{ widget.value }}{% endif %}</textarea></div> diff --git a/pydis_site/templates/wiki/forms/select.html b/pydis_site/templates/wiki/forms/select.html new file mode 100644 index 00000000..95bb06ed --- /dev/null +++ b/pydis_site/templates/wiki/forms/select.html @@ -0,0 +1,15 @@ +<div{% include "django/forms/widgets/attrs.html" %}> +  <button class="btn btn-group-label{{ disabled }}" type="button">{{ label }}</button> +  <button class="btn btn-default dropdown-toggle{{ disabled }}" type="button" data-toggle="dropdown"> +        <span class="caret"></span> +    </button> +    <ul class="dropdown-menu">{% for group_name, group_choices, group_index in widget.optgroups %} +      {% if group_name %}<li class="divider" label="{{ group_name }}"></li>{% endif %} +      {% for option in group_choices %} +      {% include option.template_name with widget=option %} +      {% endfor %} +      {% endfor %} +    </ul> +    <input type="hidden" name="{{ widget.name }}" value="" class="btn-group-value" /> +</div> +<noscript>{{ noscript }}</noscript> diff --git a/pydis_site/templates/wiki/forms/select_option.html b/pydis_site/templates/wiki/forms/select_option.html new file mode 100644 index 00000000..30ff9787 --- /dev/null +++ b/pydis_site/templates/wiki/forms/select_option.html @@ -0,0 +1 @@ +<li><a href="javascript:void(0)" data-value="{{ widget.value|stringformat:'s' }}"{% include "django/forms/widgets/attrs.html" %}>{{ widget.label }}</a></li> diff --git a/pydis_site/templates/wiki/forms/text.html b/pydis_site/templates/wiki/forms/text.html new file mode 100644 index 00000000..23246aa8 --- /dev/null +++ b/pydis_site/templates/wiki/forms/text.html @@ -0,0 +1 @@ +<div class="input-group"><span class="input-group-addon">{{ prepend }}</span>{% include "django/forms/widgets/input.html" %}</div> diff --git a/pydis_site/templates/wiki/history.html b/pydis_site/templates/wiki/history.html new file mode 100644 index 00000000..d7a3a4da --- /dev/null +++ b/pydis_site/templates/wiki/history.html @@ -0,0 +1,202 @@ +{% extends "wiki/article.html" %} +{% load wiki_tags i18n sekizai_tags static %} + + +{% block wiki_pagetitle %}{% trans "History" %}: {{ article.current_revision.title }}{% endblock %} + +{% block wiki_contents_tab %} + +{% include "wiki/includes/modals.html" %} + +{% addtoblock "js" %} +<script type="text/javascript" src="{% static "wiki/js/diffview.js" %}"></script> +<script type="text/javascript" src="{% static "wiki/js/diff.js" %}"></script> +{% endaddtoblock %} +{% addtoblock "css" %} +<style type="text/css"> +  td.linenumber { +    width: 20px; +  } +  tr.insert td { +    background-color: #DFC; +  } +  tr.delete td { +    background-color: #FDC; +  } +  tr.equal td { +    background-color: #F2F2F2; +  } + +  .diff-container td { +    white-space: pre; font-family: monospace; +  } +  .diff-container td, +  .diff-container th { +    padding: 2px 7px; +    border-right: 1px solid #DDD; +  } +  .diff-container td:last-child, +  .diff-container th:last-child { +    border-right: none; +  } +  .diff-container table { +    border-top: 1px solid #DDD; +  } +</style> +{% endaddtoblock %} + +<p class="lead"> +  {% trans "Click each revision to see a list of edited lines. Click the Preview button to see how the article looked at this stage. At the bottom of this page, you can change to a particular revision or merge an old revision with the current one." %} +</p> + +<form method="GET"> +  <div class="tab-content" style="overflow: visible;"> +    {% for revision in revisions %} +      <div class="panel-group" id="accordion{{ revision.revision_number }}"> +        <div class="panel panel-default"> +          <div class="panel-heading"> +            <a class="panel-toggle" style="float: left;" href="#collapse{{ revision.revision_number }}" onclick="get_diff_json('{% url 'wiki:diff' revision.id %}', $('#collapse{{ revision.revision_number }}'))"> +              {% if revision == article.current_revision %} +                <i class="fa fa-flag"></i> +              {% else %} +                <i class="fa fa-plus"></i> +              {% endif %} +              {% include "wiki/includes/revision_info.html" with current_revision=article.current_revision %} +              <div class="text-muted"> +                <small> +                {% if revision.user_message %} +                  {{ revision.user_message }} +                {% elif revision.automatic_log %} +                  {{ revision.automatic_log }} +                {% else %} +                  ({% trans "no log message" %}) +                {% endif %} +                </small> +              </div> +            </a> +            <div class="progress progress-striped active" style="display: none; width: 40px; float: left; margin-top: 7px; margin-bottom: -7px;"> +              <div class="bar" style="width: 100%;"></div> +            </div> +            <div class="pull-right" style="vertical-align: middle; margin: 8px 8px;"> +              {% if revision == article.current_revision %} +              <a href="#" class="btn btn-default disabled"> +                <span class="fa fa-lock fa-fw"></span> +                {% trans "Preview this revision" %} +              </a> +              {% else %} +              <button type="submit" class="btn btn-default" onclick="$('#previewModal').modal('show'); this.form.target='previewWindow'; this.form.r.value='{{ revision.id }}'; this.form.action='{% url 'wiki:preview_revision' article.id %}'; $('#previewModal .switch-to-revision').attr('href', '{% url 'wiki:change_revision' path=urlpath.path article_id=article.id revision_id=revision.id %}')"> +                <span class="fa fa-eye fa-fw"></span> +                {% trans "Preview this revision" %} +              </button> +              {% endif %} + +              {% if article|can_write:user and not article.current_revision.locked %} +              <input type="radio"{% if revision == article.current_revision %} disabled="true"{% endif %} style="margin: 0 10px;" value="{{ revision.id }}" name="revision_id" switch-button-href="{% url 'wiki:change_revision' path=urlpath.path revision_id=revision.id %}" merge-button-href="{% url 'wiki:merge_revision_preview' article_id=article.id revision_id=revision.id %}" merge-button-commit-href="{% url 'wiki:merge_revision' path=urlpath.path article_id=article.id revision_id=revision.id %}" /> +              {% endif %} + +            </div> +            <div style="clear: both"></div> +          </div> +          <div id="collapse{{ revision.revision_number }}" class="panel-collapse collapse"> +            <div class="panel-body diff-container" style="padding: 0;"> +              <dl class="dl-horizontal"> +                <dt>{% trans "Auto log:" %}</dt> +                <dd>{{ revision.automatic_log|default:"-"|linebreaksbr }}</dd> +              </dl> +              <table class="table table-condensed" style="margin: 0; border-collapse: collapse;"> +                <thead> +                  <tr> +                    <th class="linenumber">{% if revision.previous_revision %}#{{revision.previous_revision.revision_number}}{% endif %}</th> +                    <th class="linenumber">#{{revision.revision_number}}</th> +                    <th>{% trans "Change" %}</th> +                  </tr> +                </thead> +              </table> +            </div> +          </div> +        </div> +      </div> +    {% endfor %} + +    {% include "wiki/includes/pagination.html" %} + +    {% if revisions.count > 1 and article|can_write:user and not article.current_revision.locked %} + +    <div class="form-group form-actions"> +      <div class="pull-right"> +        <button type="submit" name="preview" value="1" class="btn btn-default" onclick="$('#mergeModal').modal('show'); this.form.target='mergeWindow'; this.form.action=$('input[type=radio]:checked').attr('merge-button-href'); $('.merge-revision-commit').attr('href', $('input[type=radio]:checked').attr('merge-button-commit-href'))"> +          <span class="fa fa-random"></span> +          {% trans "Merge selected with current..." %} +        </button> +        <button type="submit" name="save" value="1" class="btn btn-primary" onclick="this.form.target='_self'; this.form.action=$('input[type=radio]:checked').attr('switch-button-href')"> +          <span class="fa fa-flag"></span> +          {% trans "Switch to selected version" %} +        </button> +      </div> +      <div style="clear:both"></div> +    </div> + +    {% endif %} + +  </div> +  <input type="hidden" name="r" value="" /> +  <div class="modal fade wiki-modal" id="previewModal"> +    <div class="modal-dialog"> +      <div class="modal-content"> +        <div class="modal-body"> +          <iframe name="previewWindow" frameborder="0"></iframe> +        </div> +        <div class="modal-footer"> +          <a href="#" class="btn btn-default btn-lg" data-dismiss="modal"> +            <span class="fa fa-arrow-circle-left"></span> +            {% trans "Back to history view" %} +          </a> +          {% if article|can_write:user %} +          <a href="#" class="btn btn-lg btn-primary switch-to-revision"> +            <span class="fa fa-flag"></span> +            {% trans "Switch to this version" %} +          </a> +          {% else %} +            <a href="#" class="btn btn-lg btn-primary disabled"> +              <span class="fa fa-lock"></span> +              {% trans "Switch to this version" %} +            </a> +          {% endif %} +        </div> +      </div> +    </div> +  </div> + +  <div class="modal fade wiki-modal" id="mergeModal"> +    <div class="modal-dialog"> +      <div class="modal-content"> +        <div class="modal-header"> +          <h1>{% trans "Merge with current" %}</h1> +          <p class="lead"><span class="fa fa-info-circle"></span> {% trans "When you merge a revision with the current, all data will be retained from both versions and merged at its approximate location from each revision." %} <strong>{% trans "After this, it's important to do a manual review." %}</strong></p> +        </div> +        <div class="modal-body"> +          <iframe name="mergeWindow" frameborder="0" style="min-height: 0;"></iframe> +        </div> +        <div class="modal-footer"> +          <a href="#" class="btn btn-default btn-lg" data-dismiss="modal"> +            <span class="fa fa-arrow-circle-left"></span> +            {% trans "Back to history view" %} +          </a> +          {% if article|can_write:user %} +          <a href="#" class="btn btn-lg btn-primary merge-revision-commit"> +            <span class="fa fa-file"></span> +            {% trans "Create new merged version" %} +          </a> +          {% else %} +            <a href="#" class="btn btn-lg btn-primary disabled"> +              <span class="fa fa-lock"></span> +              {% trans "Create new merged version" %} +            </a> +          {% endif %} +        </div> +      </div> +    </div> +  </div> +</form> + +{% endblock %} diff --git a/pydis_site/templates/wiki/includes/anonymous_blocked.html b/pydis_site/templates/wiki/includes/anonymous_blocked.html new file mode 100644 index 00000000..5e1d3dac --- /dev/null +++ b/pydis_site/templates/wiki/includes/anonymous_blocked.html @@ -0,0 +1,13 @@ +{% load i18n %} + +<em> +{% url 'wiki:signup' as signup_url %} +{% url 'wiki:login' as login_url %} +{% if login_url and signup_url %} +  {% blocktrans trimmed %} +  You need to <a href="{{ login_url }}">log in</a> or <a href="{{ signup_url }}">sign up</a> to use this function. +  {% endblocktrans %} +{% else %} +  {% trans "You need to log in or sign up to use this function." %} +{% endif %} +</em> diff --git a/pydis_site/templates/wiki/includes/article_menu.html b/pydis_site/templates/wiki/includes/article_menu.html new file mode 100644 index 00000000..9a83327b --- /dev/null +++ b/pydis_site/templates/wiki/includes/article_menu.html @@ -0,0 +1,53 @@ +{% load i18n wiki_tags %} + +{% with selected_tab as selected %} + +<li class="pull-right{% if selected == "settings" %} active{% endif %}"> +  {% if not user.is_anonymous %} +  <a href="{% url 'wiki:settings' article_id=article.id path=urlpath.path %}"> +    <span class="fa fa-wrench"></span> +    <span class="hidden-xs">{% trans "Settings" %}</span> +  </a> +  {% endif %} +</li> + +{% for plugin in article_tabs %} +  <li class="pull-right{% if selected == plugin.slug %} active{% endif %}"> +    <a href="{% url 'wiki:plugin' slug=plugin.slug article_id=article.id path=urlpath.path %}"> +      <span class="{{ plugin.article_tab.1 }}"></span> +      <span class="hidden-xs">{{ plugin.article_tab.0 }}</span> +    </a> +  </li> +{% endfor %} + +<li class="pull-right{% if selected == "history" %} active{% endif %}"> +  <a href="{% url 'wiki:history' article_id=article.id path=urlpath.path %}"> +    <span class="fa fa-clock-o"></span> +    <span class="hidden-xs">{% trans "Changes" %}</span> +  </a> +</li> + +{% if article|can_write:user and not article.current_revision.locked %} +<li class="pull-right{% if selected == "edit" %} active{% endif %}"> +  <a href="{% url 'wiki:edit' article_id=article.id path=urlpath.path %}"> +    <span class="fa fa-edit"></span> +    <span class="hidden-xs">{% trans "Edit" %}</span> +  </a> +</li> +{% else %} +<li class="pull-right{% if selected == "source" %} active{% endif %}"> +  <a href="{% url 'wiki:source' article_id=article.id path=urlpath.path %}"> +    <span class="fa fa-lock"></span> +    <span class="hidden-xs">{% trans "View Source" %}</span> +  </a> +</li> +{% endif %} + +<li class="pull-right{% if selected == "view" %} active{% endif %}"> +  <a href="{% url 'wiki:get' article_id=article.id path=urlpath.path %}"> +    <span class="fa fa-home"></span> +    <span class="hidden-xs">{% trans "View" %}</span> +  </a> +</li> + +{% endwith %} diff --git a/pydis_site/templates/wiki/includes/breadcrumbs.html b/pydis_site/templates/wiki/includes/breadcrumbs.html new file mode 100644 index 00000000..b7a8aeae --- /dev/null +++ b/pydis_site/templates/wiki/includes/breadcrumbs.html @@ -0,0 +1,61 @@ +{% load i18n %} +{% if urlpath %} +<div id="article-breadcrumbs"> + +<ul class="breadcrumb pull-left"> +  {% for ancestor in urlpath.cached_ancestors %} +    <li><a href="{% url 'wiki:get' path=ancestor.path %}">{{ ancestor.article.current_revision.title|truncatechars:25 }}</a></li> +  {% endfor %} +  <li class="active">{{ article.current_revision.title|truncatechars:25 }}</li> +</ul> +<div class="pull-left" style="margin-left: 10px;"> +  <div class="btn-group"> +    <a class="btn btn-info dropdown-toggle" data-toggle="dropdown" href="#" style="padding: 7px;" title="{% trans "Sub-articles for" %} {{ article.current_revision.title }}"> +      <span class="fa fa-sitemap"></span> +      <span class="caret"></span> +    </a> +    <ul class="dropdown-menu"> +      {% for child in children_slice %} +        <li> +          <a href="{% url 'wiki:get' path=child.path %}"> +            {{ child.article.current_revision.title }} +          </a> +        </li> +        {% empty %} +        <li><a href="#"><em>{% trans "No sub-articles" %}</em></a></li> +      {% endfor %} +      {% if children_slice_more %} +      <li><a href="#"><em>{% trans "...and more" %}</em></a></li> +      {% endif %} +      <li class="divider"></li> +      <li> +        <a href="{% url 'wiki:dir' path=urlpath.path %}">{% trans "Browse articles in this level" %} »</a> +      </li> +    </ul> +  </div> +</div> +<div class="pull-left" style="margin-left: 10px;"> +  <div class="btn-group"> +    <a class="btn btn-info dropdown-toggle" data-toggle="dropdown" href="#" style="padding: 7px;" title="{% trans "Sub-articles for" %} {{ article.current_revision.title }}"> +      <span class="fa fa-file"></span> +      <span class="caret"></span> +    </a> +    <ul class="dropdown-menu"> +      <li> +        {% if urlpath.parent %} +        <a href="{% url 'wiki:create' path=urlpath.parent.path %}" style="padding: 7px;"> +          <span class="fa fa-arrow-right"></span> +          {% blocktrans with article.current_revision.title as title %}New article next to {{ title }}{% endblocktrans %} +        </a> +        {% endif %} +        <a href="{% url 'wiki:create' path=urlpath.path %}" style="padding: 7px;"> +          <span class="fa fa-arrow-down"></span> +          {% blocktrans with article.current_revision.title as title %}New article below {{ title }}{% endblocktrans %} +        </a> +      </li> +    </ul> +  </div> +</div> +<div style="clear: both"></div> +</div> +{% endif %} diff --git a/pydis_site/templates/wiki/includes/editor.html b/pydis_site/templates/wiki/includes/editor.html new file mode 100644 index 00000000..6686d8dd --- /dev/null +++ b/pydis_site/templates/wiki/includes/editor.html @@ -0,0 +1,11 @@ +{% load wiki_tags i18n sekizai_tags %} +{% include "wiki/includes/editormedia.html" %} + +{% wiki_form form %} +{% addtoblock "js" %} +<script language="javascript"> +  $(document).ready(function() { +    $("#id_revision").val('{{ article.current_revision.id }}'); +  }); +</script> +{% endaddtoblock %} diff --git a/pydis_site/templates/wiki/includes/editor_sidebar.html b/pydis_site/templates/wiki/includes/editor_sidebar.html new file mode 100644 index 00000000..480dc239 --- /dev/null +++ b/pydis_site/templates/wiki/includes/editor_sidebar.html @@ -0,0 +1,42 @@ +{% load i18n sekizai_tags %} +{% addtoblock "js" %} +<script type="text/javascript"> +  $(document).ready( function() { +    $('.sidebar-form').each(function () { +      $(this).submit( function() { +        this.unsaved_article_title.value = $('#id_title').val(); +        this.unsaved_article_content.value = $('#id_content').val(); +      }); +    }); +  }); +</script> +{% endaddtoblock %} + +<div class="panel-group" id="accordion_{{ plugin.slug }}"> + +{% for plugin, plugin_form in sidebar %} + +  <div class="panel panel-default"> + +    <div class="panel-heading"> +      <a class="panel-toggle" href="#collapse_{{ plugin.slug }}" data-toggle="collapse"> +        <h3 class="panel-title"><span class="fa fa-fw {{ plugin.sidebar.icon_class }}"></span> {{ plugin.sidebar.headline }}</h3> +      </a> +    </div> + +    <div id="collapse_{{ plugin.slug }}" class="panel-collapse collapse{% if plugin_form.errors %} in{% endif %}"> +      <div class="panel-body form-vertical"> +        {% if plugin.sidebar.template %} +          {% with plugin_form as form and plugin as plugin %} +            <form method="POST" class="form-horizontal sidebar-form" action="?f={{ plugin_form.form_id }}" enctype="multipart/form-data"> +              {% csrf_token %} +              {% include plugin.sidebar.template %} +            </form> +          {% endwith %} +        {% endif %} +      </div> +    </div> + +  </div> +{% endfor %} +</div> diff --git a/pydis_site/templates/wiki/includes/editormedia.html b/pydis_site/templates/wiki/includes/editormedia.html new file mode 100644 index 00000000..307a3078 --- /dev/null +++ b/pydis_site/templates/wiki/includes/editormedia.html @@ -0,0 +1,15 @@ +{% load sekizai_tags static %} +{% addtoblock "js" %} +<script type="text/javascript" src="{% static "wiki/js/editor.js" %}"></script> +{% for js in editor.Media.js %} +<script type="text/javascript" src="{% static js %}"></script> +{% endfor %} +{% endaddtoblock %} + +{% addtoblock "css" %} +{% for media, srcs in editor.Media.css.items %} +  {% for src in srcs %} +    <link rel="stylesheet" media="{{ media }}" href="{% static src %}" /> +  {% endfor %} +{% endfor %} +{% endaddtoblock %} diff --git a/pydis_site/templates/wiki/includes/form.html b/pydis_site/templates/wiki/includes/form.html new file mode 100644 index 00000000..3e1abb67 --- /dev/null +++ b/pydis_site/templates/wiki/includes/form.html @@ -0,0 +1,17 @@ +{% csrf_token %}{% load sekizai_tags %} + +{% include "wiki/includes/formerrors.html" %} + +{% addtoblock "js" %} +{{ form.media.js }} +{% endaddtoblock %} + +{% addtoblock "css" %} +{{ form.media.css }} +{% endaddtoblock %} + +{% for field in form %} + +  {% include "wiki/includes/formfield.html" %} + +{% endfor %} diff --git a/pydis_site/templates/wiki/includes/formerrors.html b/pydis_site/templates/wiki/includes/formerrors.html new file mode 100644 index 00000000..72d3c539 --- /dev/null +++ b/pydis_site/templates/wiki/includes/formerrors.html @@ -0,0 +1,8 @@ +{% if form.non_field_errors %} +  {% if form_error_title %}<h4 class="alert-heading">{{ form_error_title }}</h4>{% endif %} +  {% for error_message in form.non_field_errors %} +    <div class="alert alert-block alert-danger"> +      {{ error_message }} +    </div> +  {% endfor %} +{% endif %} diff --git a/pydis_site/templates/wiki/includes/formfield.html b/pydis_site/templates/wiki/includes/formfield.html new file mode 100644 index 00000000..db6725a9 --- /dev/null +++ b/pydis_site/templates/wiki/includes/formfield.html @@ -0,0 +1,25 @@ +{% if field.is_hidden %} +  {{ field }} +{% else %} + +<div id="div_{{ field.auto_id }}" class="form-group{% if field.errors %} has-error{% endif %}"> +  <div class="wiki-label col-xs-3 col-lg-2"> +  {% if field.label %} +    <label for="{{ field.id_for_label }}" class="control-label {% if field.field.required %}requiredField{% endif %}"> +    {{ field.label|safe }} +    </label> +  {% endif %} +  </div> +  <div class="wiki-control col-xs-9 col-lg-10"> +    {{ field }} {% if field.field.required %}<span class="asteriskField">*</span>{% endif %} +    {% if field.errors %} +      {% for error in field.errors %} +        <div id="error_{{ forloop.counter }}_{{ field.auto_id }}" class="help-block"><strong>{{ error }}</strong></div> +      {% endfor %} +    {% endif %} +    {% if field.help_text %} +      <p id="hint_{{ field.auto_id }}" class="help-block">{{ field.help_text|safe }}</p> +    {% endif %} +  </div> +</div> +{% endif %} diff --git a/pydis_site/templates/wiki/includes/messages.html b/pydis_site/templates/wiki/includes/messages.html new file mode 100644 index 00000000..f8362829 --- /dev/null +++ b/pydis_site/templates/wiki/includes/messages.html @@ -0,0 +1,9 @@ +{% if messages %} +  <!-- Messages for this instance --> +  {% for message in messages %} +    <div class="{{ message.css_class }}"> +      <a class="close" data-dismiss="alert" href="#">×</a> +      {{ message }} +    </div> +  {% endfor %} +{% endif %} diff --git a/pydis_site/templates/wiki/includes/modals.html b/pydis_site/templates/wiki/includes/modals.html new file mode 100644 index 00000000..b86d4f65 --- /dev/null +++ b/pydis_site/templates/wiki/includes/modals.html @@ -0,0 +1,31 @@ +{% load sekizai_tags static %} +{% addtoblock "js" %} +<script type="text/javascript" src="{% static "wiki/js/jquery-ui-1.12.1.custom/jquery-ui.min.js" %}"></script> +<script type="text/javascript"> +$(document).ready(function() { +  $(".modal-content").on("resizestart", function(event, ui) { +    $(ui.element).find(".modal-body, iframe").each(function() { +      elem = $(this); +      elem.data("resizeoriginalheight", elem.height()); +    }); +  }); + +  $(".modal-content").on("resize", function(event, ui) { +      ui.element.parents('.modal-dialog').css("margin-left", -ui.size.width/2); +      ui.element.parents('.modal-dialog').css("margin-top", -ui.size.height/2); +      ui.element.parents('.modal-dialog').css("top", "50%"); +      ui.element.parents('.modal-dialog').css("left", "50%"); + +      $(ui.element).find(".modal-body,iframe").each(function() { +        elem = $(this); +        $(this).css("min-height", elem.data("resizeoriginalheight") + ui.size.height - ui.originalSize.height); +      }); +  }); + +  $(".modal-content").resizable(); +}); +</script> +{% endaddtoblock %} +{% addtoblock "css" %} +<link rel="stylesheet" href="{% static "wiki/js/jquery-ui-1.12.1.custom/jquery-ui.min.css" %}" type="text/css" /> +{% endaddtoblock %} diff --git a/pydis_site/templates/wiki/includes/move_tree.html b/pydis_site/templates/wiki/includes/move_tree.html new file mode 100644 index 00000000..af7e422b --- /dev/null +++ b/pydis_site/templates/wiki/includes/move_tree.html @@ -0,0 +1,16 @@ +{% load wiki_tags %} + +<li class="{% if current_path.path|starts_with:urlpath.path %}disabled{% endif%} {% if current_path.children.count %}dropdown-submenu{% endif %}"> +  <a tabindex="-1" href="#" +    {% if not current_path.path|starts_with:urlpath.path %} +        onclick="select_path('{{current_path.pk}}', '{{current_path.path|escapejs}}');" {% endif %}> +    {{current_path.article}} +  </a> +  {% if current_path.children.count %} +    <ul class="dropdown-menu"> +      {% for current_path in current_path.get_ordered_children %} +        {% with template_name="wiki/includes/move_tree.html" %}{% include template_name %}{% endwith %} +      {% endfor %} +    </ul> +  {% endif %} +</li> diff --git a/pydis_site/templates/wiki/includes/pagination.html b/pydis_site/templates/wiki/includes/pagination.html new file mode 100644 index 00000000..6e7ec608 --- /dev/null +++ b/pydis_site/templates/wiki/includes/pagination.html @@ -0,0 +1,24 @@ +{% load i18n %} +{% if is_paginated %} +<ul class="pagination"> +    {% if page_obj.has_previous %} +        <li><a class="prev btn btn-info" href="?{% if search_query %}q={{ search_query  }}&{% endif %}page={{ page_obj.previous_page_number }}{% if appended_key %}&{{ appended_key }}={{ appended_value }}{% endif %}">«</a></li> +    {% else %} +        <li class="disabled"><span>«</span></li> +    {% endif %} + +    {% for pc in paginator.page_range %} +        {% if pc == 0 %} +            <li class="disabled"><span>...</span></li> +        {% else %} +            <li class="{% if pc == page_obj.number %} active{% endif %}"><a href="?{% if search_query %}q={{ search_query  }}&{% endif %}page={{ pc }}{% if appended_key %}&{{ appended_key }}={{ appended_value }}{% endif %}">{{ pc }}</a></li> +        {% endif %} +    {% endfor %} + +    {% if page_obj.has_next %} +        <li><a class="next btn btn-info" href="?{% if search_query %}q={{ search_query  }}&{% endif %}page={{ page_obj.next_page_number }}{% if appended_key %}&{{ appended_key }}={{ appended_value }}{% endif %}">»</a></li> +    {% else %} +        <li class="disabled"><span>»</span></li> +    {% endif %} +</ul> +{% endif %} diff --git a/pydis_site/templates/wiki/includes/render.html b/pydis_site/templates/wiki/includes/render.html new file mode 100644 index 00000000..28ab76c9 --- /dev/null +++ b/pydis_site/templates/wiki/includes/render.html @@ -0,0 +1,26 @@ +{% load wiki_tags i18n cache sekizai_tags static %} + +{% addtoblock "js" %} +  <script type="text/javascript" src="{% static "wiki/js/article.js" %}"></script> +{% endaddtoblock %} + +<div class="wiki-article"> +  {{ content|default:"" }} +</div> + +{% for plugin in plugins %} +  {% if plugin.RenderMedia.css %} +    {% addtoblock "css" %} +      {% for media, url in plugin.RenderMedia.css.items %} +        <link rel="stylesheet" href="{% static url %}" /> +      {% endfor %} +    {% endaddtoblock %} +  {% endif %} +  {% if plugin.RenderMedia.js %} +    {% addtoblock "js" %} +      {% for url in plugin.RenderMedia.js %} +        <script type="text/javascript" src="{% static url %}"></script> +      {% endfor %} +    {% endaddtoblock %} +  {% endif %} +{% endfor %} diff --git a/pydis_site/templates/wiki/includes/revision_info.html b/pydis_site/templates/wiki/includes/revision_info.html new file mode 100644 index 00000000..95b01baf --- /dev/null +++ b/pydis_site/templates/wiki/includes/revision_info.html @@ -0,0 +1,25 @@ +{% comment %} + +  This reusable code is shared between different templates and different inheritors of +  BaseRevision. + +{% endcomment %} + + +{% load wiki_tags i18n %} +{% if not hidedate %}{{ revision.created }}{% endif %} {% if not hidenumber %}(#{{ revision.revision_number }}) {% trans "by" %}{% endif %} {% if revision.user %}{{ revision.user }}{% else %}{% if article|can_moderate:user %}{{ revision.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %} +{% if revision == current_revision %} +  <strong>*</strong> +{% endif %} +{% if revision.deleted %} +<span class="badge badge-important">{% trans "deleted" %}</span> +{% endif %} +{% if revision.previous_revision.deleted and not revision.deleted %} +<span class="badge badge-success">{% trans "restored" %}</span> +{% endif %} +{% if revision.locked %} +<span class="badge">{% trans "locked" %}</span> +{% endif %} +{% if revision.previous_revision.locked and not revision.locked %} +<span class="badge">{% trans "unlocked" %}</span> +{% endif %} diff --git a/pydis_site/templates/wiki/includes/searchresult.html b/pydis_site/templates/wiki/includes/searchresult.html new file mode 100644 index 00000000..f6dd7a09 --- /dev/null +++ b/pydis_site/templates/wiki/includes/searchresult.html @@ -0,0 +1,22 @@ +{% load wiki_tags i18n humanize %} + + +<tr> +  <td> +    {% for urlpath in article.urlpath_set.all %} +      <a href="{% url 'wiki:get' path=urlpath.path %}">{{ article.current_revision.title }}<br /><small class="muted">/{{ urlpath.path }}</small></a> +    {% empty %} +      <a href="{% url 'wiki:get' article_id=article.id %}">{{ article.current_revision.title }}</a> +    {% endfor %} +    {% if article.current_revision.deleted %} +      <span class="fa fa-trash"></span> +    {% endif %} +    {% if article.current_revision.locked %} +      <span class="fa fa-lock"></span> +    {% endif %} +    <p class="muted"><small>{{ article.render|get_content_snippet:search_query }}</small></p> +  </td> +  <td style="white-space: nowrap"> +    {{ article.current_revision.created|naturaltime }} +  </td> +</tr> diff --git a/pydis_site/templates/wiki/move.html b/pydis_site/templates/wiki/move.html new file mode 100644 index 00000000..d93a3675 --- /dev/null +++ b/pydis_site/templates/wiki/move.html @@ -0,0 +1,66 @@ +{% extends "wiki/article.html" %} +{% load wiki_tags i18n sekizai_tags %} + +{% block wiki_pagetitle %}{% trans "Move" %}: {{ article.current_revision.title }}{% endblock %} + +{% block wiki_contents_tab %} + +<div class="row"> +  <div class="col-lg-10"> +    <form method="POST" class="form-horizontal" id="article_move_form"> +      {% wiki_form form %} + +      <div class="btn-group" id="dest_selector"> +        <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#"> +          <span class="dest_selector_title"></span> +          <span class="caret"></span> +        </a> +        <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> +            {% with current_path=root_path %}{% include "wiki/includes/move_tree.html" %}{% endwith %} +        </ul> +      </div> +      <p class="col-lg-offset-2"> +        {% blocktrans count cnt=urlpath.get_descendants.count trimmed %} +          {{ cnt }} nested article will also be moved.<br> +          Be careful, links to this article and {{ cnt }} article nested +          in this hierarchy will not be updated. +          {% plural %} +          {{ cnt }} nested articles will also be moved.<br> +          Be careful, links to this article and {{ cnt }} articles nested +          in this hierarchy will not be updated. +        {% endblocktrans %} +      </p> +      <div class="form-group form-actions"> +        <div class="col-lg-12 col-lg-offset-2"> +          <a href="{% url 'wiki:get' path=urlpath.path article_id=article.id %}" class="btn btn-default"> +            <span class="fa fa-arrow-left"></span> +            {% trans "Go back" %} +          </a> +          <button class="btn btn-large btn-primary" type="submit" name="move" id="id_move"> +            <span class="fa fa-random"></span> +            {% trans "Move article" %} +          </button> +        </div> +      </div> +    </form> +  </div> +</div> + +{% addtoblock "js" %} + +  <script type="text/javascript"> +    $('#id_destination').after($('#dest_selector').remove()); +    $('#id_destination').attr('type', 'hidden'); +    $('#id_slug').val('{{ urlpath.slug }}'); +    select_path('{{urlpath.parent.pk}}', '{{urlpath.parent}}'); + +    function select_path(path, title) { +      $('#id_destination').val(path); +      if (title == "(root)") title = ""; +      $('#dest_selector .dest_selector_title').html(title ? title : "  /  "); +    } +  </script> + +{% endaddtoblock %} + +{% endblock %} diff --git a/pydis_site/templates/wiki/permission_denied.html b/pydis_site/templates/wiki/permission_denied.html new file mode 100644 index 00000000..06afbbda --- /dev/null +++ b/pydis_site/templates/wiki/permission_denied.html @@ -0,0 +1,32 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n %} + + +{% block wiki_pagetitle %}Permission Denied{% endblock %} + +{% block wiki_contents %} +  <h1 class="page-header">{% trans "Permission Denied" %}</h1> +  <p class="alert denied alert-danger"> +    <i class="fa fa-minus-circle"></i> +    {% trans "Sorry, you don't have permission to access this page." %} +  </p> +  {% if article.current_revision.locked %} +  <p class="alert alert-warning"> +    <i class="fa fa-lock"></i> +    {% trans "This article is locked for editing." %} +  </p> +  {% endif %} + +  <p> +  {% if not read_denied %} +    <a href="{% url 'wiki:get' article_id=article.id path=urlpath.path %}" class="btn btn-default"> +      {% trans "Back to article" %} +    </a> +  {% elif urlpath.parent %} +    <a href="{% url 'wiki:get' path=urlpath.parent.path %}" class="btn btn-default"> +      {% trans "Back to article" %} +    </a> +  {% endif %} +  </p> + +{% endblock %} diff --git a/pydis_site/templates/wiki/preview_inline.html b/pydis_site/templates/wiki/preview_inline.html new file mode 100644 index 00000000..77232753 --- /dev/null +++ b/pydis_site/templates/wiki/preview_inline.html @@ -0,0 +1,55 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n sekizai_tags static %} + +{% block wiki_body %} + +  {% if revision %} +    <div class="alert alert-info"> +      <strong>{% trans "Previewing revision" %}:</strong> +      {% include "wiki/includes/revision_info.html" %} +    </div> +  {% endif %} + +  {% if merge %} +    <div class="alert alert-info"> +      <strong>{% trans "Previewing merge between" %}:</strong> +      {% include "wiki/includes/revision_info.html" with revision=merge1 %} +      <strong>{% trans "and" %}</strong> +      {% include "wiki/includes/revision_info.html" with revision=merge2 %} +    </div> +    {% if merge1.deleted %} +    <div class="alert alert-danger"> +      <strong>{% trans "You cannot merge with a deleted revision" %}</strong> +    </div> +    {% endif %} +  {% endif %} + +  <h1 class="page-header">{{ title }}</h1> + +  {% if revision and revision.deleted %} +    <div class="warning"> +      <strong>{% trans "This revision has been deleted." %}</strong> +      <p>{% trans "Restoring to this revision will mark the article as deleted." %}</p> +    </div> +  {% else %} + +    {% wiki_render article content %} +    {% for plugin in plugins %} +      {% if plugin.RenderMedia.css %} +        {% addtoblock "css" %} +          {% for media, url in plugin.RenderMedia.css.items %} +            <link rel="stylesheet" href="{% static url %}" /> +          {% endfor %} +        {% endaddtoblock %} +      {% endif %} +      {% if plugin.RenderMedia.js %} +        {% addtoblock "js" %} +          {% for url in plugin.RenderMedia.js %} +            <script type="text/javascript" src="{% static url %}"></script> +          {% endfor %} +        {% endaddtoblock %} +      {% endif %} +    {% endfor %} +  {% endif %} + +{% endblock %} diff --git a/pydis_site/templates/wiki/root_missing.html b/pydis_site/templates/wiki/root_missing.html new file mode 100644 index 00000000..0fb610ad --- /dev/null +++ b/pydis_site/templates/wiki/root_missing.html @@ -0,0 +1,37 @@ +{% extends "wiki/create_root.html" %} +{% load i18n wiki_tags %} + +{% block wiki_contents %} + +<div class="row"> +  <div class="col-lg-2"></div> +  <div class="col-lg-8"> + +    <h1>{% trans "Congratulations!" %}</h1> +    <p class="lead"> +      {% trans "You have django-wiki installed and it seems to be working. But there are no articles yet." %} +    </p> + +    {% if not user.is_superuser %} +      <p class="lead"> +        {% trans "Not to worry! You simply have to login with a superuser account and create the first article in the root of the URL hierarchy." %} +      </p> +      {% login_url as wiki_login_url %} +      {% if wiki_login_url %} +        <a href="{{ wiki_login_url }}" class="btn btn-primary btn-lg">{% trans "Click here to login" %}</a> +      {% endif %} + +    {% else %} + +      <p class="lead"> +        {% trans "But since you're logged in as a superuser, we should really get started..." %} +      </p> +      <a href="{% url 'wiki:root_create' %}" class="btn btn-primary btn-lg">{% trans "Yes, I'll go and create the first article" %}</a> +      <a href="http://django-wiki.readthedocs.org/" class="btn btn-default">{% trans "No thanks, I'd rather read the documentation" %}</a> + +      {% endif %} +  </div> +  <div class="col-lg-2"></div> +</div> + +{% endblock %} diff --git a/pydis_site/templates/wiki/search.html b/pydis_site/templates/wiki/search.html new file mode 100644 index 00000000..080cf40d --- /dev/null +++ b/pydis_site/templates/wiki/search.html @@ -0,0 +1,53 @@ +{% extends "wiki/base.html" %} +{% load wiki_tags i18n humanize %} + + +{% block wiki_pagetitle %}{% trans "Search results for:" %} {{ search_query }}{% endblock %} + +{% block wiki_contents %} + +<h1 class="page-header">{% trans "Search results for:" %} {{ search_query }}</h1> + +<form class="form-search directory-toolbar"> +<p class="lead"> +  <div class="pull-right"> +    {% if urlpath %} +      {% trans "Searching in" %} {{ urlpath.article }} +    {% else %} +      {% trans "Searching whole wiki" %} +    {% endif %} +    <div class="input-group"> +      <input type="search" class="form-control search-query" name="q" value="{{ search_query }}" /> +      <span class="input-group-btn"> +        <button class="btn btn-default" type="submit"> +          <span class="fa fa-search"></span> +        </button> +      </span> +    </div> +  </div> +  <p>{% blocktrans with paginator.object_list.count as cnt %}Your search returned <strong>{{ cnt }}</strong> results.{% endblocktrans %}</p> +  <div class="clearfix"></div> +</p> +</form> + +<table class="table table-striped"> +  <tr> +    <th style="width: 75%">{% trans "Title" %}</th> +    <th>{% trans "Last modified" %}</th> +  </tr> +  {% for article in articles %} +    {% block wiki_search_loop %} +    {% include "wiki/includes/searchresult.html" %} +    {% endblock %} +    {% empty%} +    <tr> +      <td colspan="100"> +        <em>{% trans "There are no articles in this level" %}</em> +      </td> +    </tr> +  {% endfor %} +</table> + +{% include "wiki/includes/pagination.html" %} + +{% endblock %} diff --git a/pydis_site/templates/wiki/settings.html b/pydis_site/templates/wiki/settings.html new file mode 100644 index 00000000..6d6c0f49 --- /dev/null +++ b/pydis_site/templates/wiki/settings.html @@ -0,0 +1,24 @@ +{% extends "wiki/article.html" %} +{% load wiki_tags i18n %} + + +{% block wiki_pagetitle %}{% trans "Settings" %}: {{ article.current_revision.title }}{% endblock %} + +{% block wiki_contents_tab %} + +  {% for form in forms %} +  <form method="POST" class="form-horizontal settings-form" action="?f={{form.action}}"> +    <h3 class="page-header">{{ form.settings_form_headline }}</h3> +    {% wiki_form form %} +    <div class="form-group form-actions"> +      <div class="col-lg-10 col-lg-2-offset"> +        <button type="submit" name="save" value="1" class="btn btn-primary"> +          <span class="fa fa-check"></span> +          {% trans "Save changes" %} +        </button> +      </div> +    </div> +  </form> +  {% endfor %} + +{% endblock %} diff --git a/pydis_site/templates/wiki/source.html b/pydis_site/templates/wiki/source.html new file mode 100644 index 00000000..0c610208 --- /dev/null +++ b/pydis_site/templates/wiki/source.html @@ -0,0 +1,17 @@ +{% extends "wiki/article.html" %} +{% load wiki_tags i18n humanize %} + + +{% block wiki_pagetitle %}{% trans "Source of" %} {{ article.current_revision.title }}{% endblock %} + +{% block wiki_contents_tab %} + +{% if article.current_revision.locked %} +<p class="lead">{% trans "This article is currently locked for editing." %}</p> +{% endif %} + +<pre class="pre-scrollable"> +  {{ article.current_revision.content }} +</pre> + +{% endblock %} diff --git a/pydis_site/templates/wiki/view.html b/pydis_site/templates/wiki/view.html new file mode 100644 index 00000000..2becdaae --- /dev/null +++ b/pydis_site/templates/wiki/view.html @@ -0,0 +1,9 @@ +{% extends "wiki/article.html" %} +{% load wiki_tags i18n sekizai_tags %} + + +{% block wiki_contents_tab %} + +  {% wiki_render article %} + +{% endblock %} | 
