diff options
Diffstat (limited to 'pydis_site/templates/wiki/includes')
16 files changed, 398 insertions, 0 deletions
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> |