diff options
author | 2019-04-15 14:56:50 +0100 | |
---|---|---|
committer | 2019-04-15 14:56:50 +0100 | |
commit | f27987070e40fcf4b017f91c23c4747373e85c9d (patch) | |
tree | 7dac1a67b2709f73add6d8ac7c15ec04c30a2b3a /pydis_site/templates/wiki/plugins | |
parent | Small styling fixes (diff) |
Images sidebar work, and allow fields to be rendered without labels
Diffstat (limited to 'pydis_site/templates/wiki/plugins')
3 files changed, 33 insertions, 89 deletions
diff --git a/pydis_site/templates/wiki/plugins/images/sidebar.html b/pydis_site/templates/wiki/plugins/images/sidebar.html index 909bf6c9..d25fe48e 100644 --- a/pydis_site/templates/wiki/plugins/images/sidebar.html +++ b/pydis_site/templates/wiki/plugins/images/sidebar.html @@ -40,6 +40,39 @@ function add_image(form) { <style type="text/css"> #image-list tr:first-child td {border:0;} </style> + + <h4>Add image</h4> + + {% if article|images_can_add:user %} + {% include "wiki/includes/formerrors.html" %} + + {# Include the hidden fields #} + {% for hidden in form.hidden_fields %} + {{ hidden }} + {% endfor %} + + <p> + {% for field in form.visible_fields %} + {% include "wiki/includes/formfield.html" with render_labels=False %} + {% endfor %} + + <p> + <button type="button" onClick="add_image(this.form)" name="{{ plugin.slug }}_save" value="1" class="button is-primary"> + <span class="icon"> + <i class="fas fa-upload"></i> + </span> + <span>Upload</span> + </button> + </p> + {% else %} + + {% if user.is_anonymous %} + {% include "wiki/includes/anonymous_blocked.html" %} + {% else %} + <p><em>{% trans "You do not have permissions to add images." %}</em></p> + {% endif %} + {% endif %} + <div style="max-height: 300px; overflow: auto;"> <table class="table table-responsive table-bordered" id="image-list"> {% for image in images %} @@ -78,61 +111,6 @@ function add_image(form) { </p> <hr /> -<h4>{% trans "Add new image" %}</h4> - -{% if article|images_can_add:user %} - {% 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 %} - - {# Include the hidden fields #} - {% for hidden in form.hidden_fields %} - {{ hidden }} - {% endfor %} - - <p> - {% for field in form.visible_fields %} - <fieldset id="div_{{ field.auto_id }}" class="control-group fields {% if field.errors %} error{% endif %}"> - {% if field.label %} - <!--<label for="{{ field.id_for_label }}" class="{% if field.field.required %}requiredField{% endif %}"> - {{ field.label|safe }} - </label>--> - {% endif %} - {{ field }} - {% if field.errors %} - <div id="error_{{ forloop.counter }}_{{ field.auto_id }}" class="help-block"> - {% for error in field.errors %} - <div>{{ error }}</div> - {% endfor %} - </div> - {% endif %} - </fieldset> - {% if field.help_text %} - <p id="hint_{{ field.auto_id }}" class="help-block">{{ field.help_text|safe }}</p> - {% endif %} - {% endfor %} - </p> - - <p> - <button type="button" onClick="add_image(this.form)" name="{{ plugin.slug }}_save" value="1" class="btn btn-default btn-md"> - <span class="fa fa-upload"></span> - {% trans "Add image" %} - </button> - </p> -{% else %} - - {% if user.is_anonymous %} - {% include "wiki/includes/anonymous_blocked.html" %} - {% else %} - <p><em>{% trans "You do not have permissions to add images." %}</em></p> - {% endif %} -{% endif %} - <hr /> <h4> diff --git a/pydis_site/templates/wiki/plugins/macros/article_list.html b/pydis_site/templates/wiki/plugins/macros/article_list.html deleted file mode 100644 index c9261f1e..00000000 --- a/pydis_site/templates/wiki/plugins/macros/article_list.html +++ /dev/null @@ -1,14 +0,0 @@ -{% load i18n wiki_macro_tags %} - -{% if article_children %} - <div class="article-list"> - <ul> - <li class="nav-header">{% trans "Article index" %} <i class="fa fa-list"></i></li> - {% for child in article_children %} - {% article_list child depth %} - {% empty %} - <i>{% trans "Nothing below this level" %}</i> - {% endfor %} - </ul> - </div> -{% endif %} diff --git a/pydis_site/templates/wiki/plugins/macros/sidebar.html b/pydis_site/templates/wiki/plugins/macros/sidebar.html deleted file mode 100644 index 31b68520..00000000 --- a/pydis_site/templates/wiki/plugins/macros/sidebar.html +++ /dev/null @@ -1,20 +0,0 @@ -{% load i18n wiki_macro_tags %} -{% allowed_macros as macros %} - -{% for macro in macros %} -<h4>{{ macro.short_description }}</h4> -{{ macro.help_text|safe|linebreaks }} -{% if macro.example_code %} -<pre>{{ macro.example_code }}</pre> -{% endif %} -{% if macro.args %} -<table class="table table-compact"> -{% for arg,description in macro.args.items %} - <tr> - <th>{{ arg }}</th> - <td>{{ description }}</td> - </tr> -{% endfor %} -</table> -{% endif %} -{% endfor %} |