datatracker/ietf/templates/community/manage_list.html
Ole Laursen c7589f9b6a Integrate community lists for groups with the existing group documents
page. Each WG/RG now gets a list with an initial set of rules to
populate the list.

Refine the community list management interface a bit to support the
group lists better - group lists aren't connected to the usual track
icons so need to be able to add/remove individual drafts.

Change the "name contains" rule to support regular expressions to
enable each group to have a default replacement for the previously
implemented "related documents" search. Maintain a materialized view
of the regexp-matched drafts with a call in the submit code to avoid
having to scan all drafts/~1000 group rules all the time.
 - Legacy-Id: 10963
2016-03-22 12:48:44 +00:00

144 lines
4.7 KiB
HTML

{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% load bootstrap3 %}
{% load staticfiles %}
{% block pagehead %}
<link rel="stylesheet" href="{% static 'select2/select2.css' %}">
<link rel="stylesheet" href="{% static 'select2-bootstrap-css/select2-bootstrap.min.css' %}">
{% endblock %}
{% block title %}Manage {{ clist.long_name }}{% endblock %}
{% block content %}
{% origin %}
<h1>Manage {{ clist.long_name }}</h1>
<noscript>This page depends on Javascript being enabled to work properly.</noscript>
{% bootstrap_messages %}
<p>The list currently tracks <a href="{{ clist.get_absolute_url }}">{{ total_count }} document{{ total_count|pluralize }}</a>.</p>
<p><a class="btn btn-default" href="{{ clist.get_absolute_url }}">Back to list</a></p>
<h2>Individual documents</h2>
{% if individually_added %}
<p>The list tracks {{ individually_added|length }} individually added document{{ individually_added|length|pluralize }}:</p>
<table class="table table-condensed table-striped">
<tbody>
{% for d in individually_added %}
<tr>
<td>{{ d.name }}</td>
<td>
<form method="post">
{% csrf_token %}
<input type="hidden" name="document" value="{{ d.pk }}">
<button class="btn btn-danger btn-xs" name="action" value="remove_document">Remove</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>The list does not track any individually added documents yet.</p>
{% endif %}
{% if clist.group %}
<p>Add individual documents here:</p>
{% else %}
<p>Conveniently track individual documents in your personal list with the track icon <span class="fa fa-bookmark-o"></span> in <a href="/doc/search/">search results</a>.</p>
<p>You can also add documents here:</p>
{% endif %}
<form class="form add-document" method="post">
{% csrf_token %}
{% bootstrap_field add_doc_form.documents show_label=False %}
<button class="btn btn-primary" name="action" value="add_documents">Add documents</button>
</form>
<h2>Search rules</h2>
<p>You can track documents with a search rule. When a document fulfills the search criteria, it will automatically show up in the list.</p>
{% if rules %}
<table class="table table-condensed table-striped">
<thead>
<tr><th>Rule</th><th>Value</th><th>Documents</th><th></th></tr>
</thead>
<tbody>
{% for rule in rules %}
<tr id="r{{ rule.pk }}">
<td>{{ rule.get_rule_type_display }}</td>
<td>
{% if "group" in rule.rule_type or "area" in rule.rule_type %}
{{ rule.group.acronym }}
{% elif "state_" in rule.rule_type %}
{{ rule.state }}
{% elif "author" in rule.rule_type or rule.rule_type == "ad" or "shepherd" in rule.rule_type %}
{{ rule.person }}
{% elif "name_contains" in rule.rule_type %}
{{ rule.text }}
{% endif %}
</td>
<td>{{ rule.matching_documents_count }} match{{ rule.matching_documents_count|pluralize:"es" }}</td>
<td>
<form method="post">
{% csrf_token %}
<input type="hidden" name="rule" value="{{ rule.pk }}">
<button class="btn btn-danger btn-xs" name="action" value="remove_rule">Remove</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No rules defined.</p>
{% endif %}
<div><a class="btn btn-primary" data-toggle="collapse" data-target="#add-new-rule">Add a new rule</a></div>
<div id="add-new-rule" {% if not rule_type_form.errors and not rule_form %}class="collapse"{% endif %}>
<h3>Add a new rule</h3>
<form method="post">
{% csrf_token %}
{% bootstrap_form rule_type_form %}
<div class="form-content-placeholder">
{% if rule_form %}
{% bootstrap_form rule_form %}
{% endif %}
</div>
{% buttons %}
<button type="submit" class="btn btn-primary" name="action" value="add_rule">Add rule</button>
{% endbuttons %}
</form>
<div class="empty-forms hide">
{% for rule_type, f in empty_rule_forms.items %}
<div class="rule-type {{ rule_type }}">
{% bootstrap_form f %}
</div>
{% endfor %}
</div>
</div>
{% endblock %}
{% block js %}
<script src="{% static 'select2/select2.min.js' %}"></script>
<script src="{% static 'ietf/js/select2-field.js' %}"></script>
<script src="{% static 'ietf/js/manage-community-list.js' %}"></script>
{% endblock %}