Add 'Track this document' link on drafts.

Fixes #1085.
 - Legacy-Id: 6642
This commit is contained in:
Timothy B. Terriberry 2013-11-03 00:26:02 +00:00
parent 04f4b26b3a
commit 0ffa8be8ea
2 changed files with 19 additions and 0 deletions

View file

@ -40,10 +40,12 @@ from django.template.defaultfilters import truncatewords_html
from django.utils import simplejson as json
from django.utils.decorators import decorator_from_middleware
from django.middleware.gzip import GZipMiddleware
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse as urlreverse, NoReverseMatch
from django.conf import settings
from django import forms
from ietf.community.models import CommunityList
from ietf.doc.models import *
from ietf.doc.utils import *
from ietf.utils.history import find_history_active_at
@ -324,6 +326,15 @@ def document_main(request, name, rev=None):
elif can_edit_stream_info and (not iesg_state or iesg_state.slug == 'watching'):
actions.append(("Submit to IESG for Publication", urlreverse('doc_to_iesg', kwargs=dict(name=doc.name))))
show_add_to_list = False
if request.user.is_authenticated():
try:
clist = CommunityList.objects.get(user=request.user)
clist.update()
show_add_to_list = clist.get_documents().filter(name=doc.name).count() == 0
except ObjectDoesNotExist:
pass
return render_to_response("doc/document_draft.html",
dict(doc=doc,
group=group,
@ -374,6 +385,7 @@ def document_main(request, name, rev=None):
shepherd_writeup=shepherd_writeup,
search_archive=search_archive,
actions=actions,
show_add_to_list=show_add_to_list,
),
context_instance=RequestContext(request))

View file

@ -245,6 +245,9 @@
{% if user|has_role:"Area Director" %}
| <a href="https://www.iesg.org/bin/c5i?mid=6&rid=77&target={{ doc.name }}" rel="nofollow" target="_blank">Search Mailing Lists (ARO)</a>
{% endif %}
{% if show_add_to_list and user.is_authenticated %}
| <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>
{% endif %}
</div>
{% if can_edit and iesg_state %}
@ -295,3 +298,7 @@
{% endblock %}
{% block js %}
<script type="text/javascript" src="/js/utils.js"></script>
<script type="text/javascript" src="/js/doc-search.js"></script>
{% endblock %}