Restores add-to-community-list functionality to several pages. Fixes #1601. Commit ready for merge.
- Legacy-Id: 9242
This commit is contained in:
parent
0584ccc47e
commit
02d807581a
|
@ -404,12 +404,6 @@ def search(request):
|
|||
|
||||
# Determine whether each document is being tracked or not, and remember
|
||||
# that so we can display the proper track/untrack option.
|
||||
# We use a slightly cumbersome pair of dictionaries:
|
||||
# - have_doc_status is set if we know anything about the document at all
|
||||
# - doc_is_tracked is set if we are tracking the document
|
||||
# If have_doc_status is False, then we use an empty cell, otherwise
|
||||
# we either use the track or untrack option in the cell, as appropriate.
|
||||
have_doc_status = { }
|
||||
doc_is_tracked = { }
|
||||
if request.user.is_authenticated():
|
||||
try:
|
||||
|
@ -420,10 +414,9 @@ def search(request):
|
|||
for doc in results:
|
||||
if clist.get_documents().filter(name=doc.name).count() > 0:
|
||||
doc_is_tracked[doc.name] = True
|
||||
have_doc_status[doc.name] = True
|
||||
|
||||
return render_to_response('doc/search/search.html',
|
||||
{'form':form, 'docs':results, 'have_doc_status':have_doc_status, 'doc_is_tracked':doc_is_tracked, 'meta':meta, },
|
||||
{'form':form, 'docs':results, 'doc_is_tracked':doc_is_tracked, 'meta':meta, },
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
def frontpage(request):
|
||||
|
|
|
@ -163,6 +163,12 @@ class GroupPagesTests(TestCase):
|
|||
|
||||
self.assertTrue(draft2.name in r.content)
|
||||
|
||||
# Make sure that a logged in user is presented with an opportunity to add results to their community list
|
||||
self.client.login(username="secretary", password="secretary+password")
|
||||
r = self.client.get(url)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(any([draft2.name in x.attrib['href'] for x in q('table.ietf-doctable td.addtolist a')]))
|
||||
|
||||
# test the txt version too while we're at it
|
||||
url = urlreverse('ietf.group.info.group_documents_txt', kwargs=dict(group_type=group.type_id, acronym=group.acronym))
|
||||
r = self.client.get(url)
|
||||
|
|
|
@ -35,9 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
{% load ietf_filters %}
|
||||
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
|
||||
{% if user.is_authenticated %}
|
||||
{% if not doc.name in have_doc_status %}
|
||||
<td> </td>
|
||||
{% elif doc.name in doc_is_tracked %}
|
||||
{% if doc.name in doc_is_tracked %}
|
||||
<td class="removefromlist">
|
||||
<a href="{% url "community_remove_track_document" doc.name %}" title="Remove from your personal ID list"><img src="/images/remove_from_list.png" alt="Remove from your personal ID list" /></a>
|
||||
</td>
|
||||
|
|
Loading…
Reference in a new issue