From 02d807581ac6d45889e34e46e095804869e0d38f Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Tue, 17 Mar 2015 20:24:42 +0000 Subject: [PATCH] Restores add-to-community-list functionality to several pages. Fixes #1601. Commit ready for merge. - Legacy-Id: 9242 --- ietf/doc/views_search.py | 9 +-------- ietf/group/tests_info.py | 6 ++++++ ietf/templates/doc/search/search_result_row.html | 4 +--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ietf/doc/views_search.py b/ietf/doc/views_search.py index 7e21c2362..46d636fc5 100644 --- a/ietf/doc/views_search.py +++ b/ietf/doc/views_search.py @@ -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): diff --git a/ietf/group/tests_info.py b/ietf/group/tests_info.py index 687050cfb..bafa78803 100644 --- a/ietf/group/tests_info.py +++ b/ietf/group/tests_info.py @@ -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) diff --git a/ietf/templates/doc/search/search_result_row.html b/ietf/templates/doc/search/search_result_row.html index 6e4db9165..d14ddf959 100644 --- a/ietf/templates/doc/search/search_result_row.html +++ b/ietf/templates/doc/search/search_result_row.html @@ -35,9 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. {% load ietf_filters %} {% if user.is_authenticated %} - {% if not doc.name in have_doc_status %} -  - {% elif doc.name in doc_is_tracked %} + {% if doc.name in doc_is_tracked %} Remove from your personal ID list