Skip to content

Commit 0ffa8be

Browse files
author
Timothy B. Terriberry
committed
Add 'Track this document' link on drafts.
Fixes ietf-tools#1085. - Legacy-Id: 6642
1 parent 04f4b26 commit 0ffa8be

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

ietf/doc/views_doc.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@
4040
from django.utils import simplejson as json
4141
from django.utils.decorators import decorator_from_middleware
4242
from django.middleware.gzip import GZipMiddleware
43+
from django.core.exceptions import ObjectDoesNotExist
4344
from django.core.urlresolvers import reverse as urlreverse, NoReverseMatch
4445
from django.conf import settings
4546
from django import forms
4647

48+
from ietf.community.models import CommunityList
4749
from ietf.doc.models import *
4850
from ietf.doc.utils import *
4951
from ietf.utils.history import find_history_active_at
@@ -324,6 +326,15 @@ def document_main(request, name, rev=None):
324326
elif can_edit_stream_info and (not iesg_state or iesg_state.slug == 'watching'):
325327
actions.append(("Submit to IESG for Publication", urlreverse('doc_to_iesg', kwargs=dict(name=doc.name))))
326328

329+
show_add_to_list = False
330+
if request.user.is_authenticated():
331+
try:
332+
clist = CommunityList.objects.get(user=request.user)
333+
clist.update()
334+
show_add_to_list = clist.get_documents().filter(name=doc.name).count() == 0
335+
except ObjectDoesNotExist:
336+
pass
337+
327338
return render_to_response("doc/document_draft.html",
328339
dict(doc=doc,
329340
group=group,
@@ -374,6 +385,7 @@ def document_main(request, name, rev=None):
374385
shepherd_writeup=shepherd_writeup,
375386
search_archive=search_archive,
376387
actions=actions,
388+
show_add_to_list=show_add_to_list,
377389
),
378390
context_instance=RequestContext(request))
379391

ietf/templates/doc/document_draft.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@
245245
{% if user|has_role:"Area Director" %}
246246
| <a href="https://www.iesg.org/bin/c5i?mid=6&rid=77&target={{ doc.name }}" rel="nofollow" target="_blank">Search Mailing Lists (ARO)</a>
247247
{% endif %}
248+
{% if show_add_to_list and user.is_authenticated %}
249+
| <span class="search-results"><span class="addtolist"><a href="{% url community_add_document doc.name %}" title="Add to your personal ID list"><img src="/images/add_to_list.png" alt="Add to your personal ID list"/>Track this document</a></span></span>
250+
{% endif %}
248251
</div>
249252

250253
{% if can_edit and iesg_state %}
@@ -295,3 +298,7 @@ <h4>Authors</h4>
295298

296299
{% endblock %}
297300

301+
{% block js %}
302+
<script type="text/javascript" src="/js/utils.js"></script>
303+
<script type="text/javascript" src="/js/doc-search.js"></script>
304+
{% endblock %}

0 commit comments

Comments
 (0)