datatracker/ietf/templates/doc/material/edit_material.html
Henrik Levkowetz aa5e61d958 Updated all urlpatterns to use ietf.utils.urls.url() instead of django's,
in order to autogenerate dotted path url pattern names.  Updated a number
of url reverses to use dotted path, and removed explicit url pattern names
as needed.

Changed some imports to prevent import of ietf.urls before django
initialization was complete.


Changed 3 cases of form classes being curried to functions; django 1.10
didn't accept that.

Started converting old-style middleware classes to new-style middleware
functions (incomplete).

Tweaked a nomcom decorator to preserve function names and attributes, like
a good decorator should.

Replaced the removed django templatetag 'removetags' with our own version
which uses bleach, and does sanitizing in addition to removing explicitly
mentionied html tags.

Rewrote the filename argument handling in a management command which had
broken with the upgrade.
 - Legacy-Id: 12818
2017-02-11 14:43:01 +00:00

56 lines
2.1 KiB
HTML

{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% load bootstrap3 %}
{% block title %}{% if action == "new" or action == "revise" %}Upload{% else %}Edit{% endif %} {{ document_type.name }} for group {{ group.name }} ({{ group.acronym }}){% endblock %}
{% block content %}
{% origin %}
<h1>{% if action == "new" or action == "revise" %}Upload{% else %}Edit{% endif %} {{ document_type.name }}<br><small>{{ group.name }} ({{ group.acronym }})</small></h1>
{% if action == "new" %}
<p class="help-block">
Below you can upload a document for the group {{ group.name }}
<a href="{% url "ietf.group.views.materials" acronym=group.acronym %}">({{ group.acronym }})</a>.
The document will appear under the materials tab in the group pages.
</p>
<h2>Upload</h2>
{% elif action == "revise" %}
<p>
Below you can upload a new revision of {{ doc_name }} for the group {{ group.name }}
<a href="{% url "ietf.group.views.materials" acronym=group.acronym %}">({{ group.acronym }})</a>.
</p>
<h2>Upload New Revision</h2>
{% endif %}
<form class="upload-material" method="post" enctype="multipart/form-data" data-nameprefix="{{ document_type.slug }}-{{ group.acronym }}-">
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<a class="btn btn-default pull-right" href="{% if doc_name %}{% url "doc_view" name=doc_name %}{% else %}{% url "ietf.group.views.materials" acronym=group.acronym %}{% endif %}">Back</a>
<button class="btn btn-primary" type="submit">{% if action == "new" or action == "revise" %}Upload{% else %}Save{% endif %}</button>
{% endbuttons %}
</form>
{% endblock content %}
{% block js %}
<script>
$(document).ready(function () {
$("form.upload-material input#id_title").on("change keyup", function () {
var v = $(this).val();
var slug = $(this).parents("form").data("nameprefix");
slug += v.toLowerCase().replace(/ /g,'-').replace(/[-]+/g, '-').replace(/[^a-z-]+/g,'');
$(this).parents("form").find("input#id_name").val(slug);
});
});
</script>
{% endblock %}