Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #344 from erikarvstedt/increase_link_area
Browse files Browse the repository at this point in the history
[Help needed] Increase link area in documents listing
  • Loading branch information
danielquinn committed May 20, 2018
2 parents 82f9dde + 8d5ae64 commit ac0cda8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 />
Expand Down
17 changes: 16 additions & 1 deletion src/documents/templatetags/hacks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

from django.contrib.admin.templatetags.admin_list import (
result_headers,
result_hidden_fields,
Expand All @@ -6,6 +8,8 @@
from django.template import Library


EXTRACT_URL = re.compile(r'href="(.*?)"')

register = Library()


Expand All @@ -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

0 comments on commit ac0cda8

Please sign in to comment.