Merge pull request #344 from erikarvstedt/increase_link_area

[Help needed] Increase link area in documents listing
This commit is contained in:
Daniel Quinn 2018-05-20 14:58:08 +01:00 committed by GitHub
commit ac0cda861e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -132,9 +132,10 @@
{# 3: Image #}
{# 4: Correspondent #}
{# 5: Tags #}
{# 6: Document edit url #}
<div class="box">
<div class="result">
<div class="header">
<div class="header" onclick="location.href='{{ result.6 }}';" style="cursor: pointer;">
<div class="checkbox">{{ result.0 }}</div>
<div class="info">
{{ result.4 }}<br />

View File

@ -1,3 +1,5 @@
import re
from django.contrib.admin.templatetags.admin_list import (
result_headers,
result_hidden_fields,
@ -6,6 +8,8 @@ from django.contrib.admin.templatetags.admin_list import (
from django.template import Library
EXTRACT_URL = re.compile(r'href="(.*?)"')
register = Library()
@ -25,4 +29,15 @@ def result_list(cl):
'result_hidden_fields': list(result_hidden_fields(cl)),
'result_headers': headers,
'num_sorted_fields': num_sorted_fields,
'results': list(results(cl))}
'results': map(add_doc_edit_url, results(cl))}
def add_doc_edit_url(result):
"""
Make the document edit URL accessible to the view as a separate item
"""
title = result[1]
match = re.search(EXTRACT_URL, title)
edit_doc_url = match[1]
result.append(edit_doc_url)
return result