Empty table cells have clickable area, even if empty

svn: r13732
This commit is contained in:
Doug Blank 2009-12-06 17:35:51 +00:00
parent 4434fd6542
commit 08aaa658eb
8 changed files with 36 additions and 17 deletions

View File

@ -345,6 +345,7 @@ table tr td.TableDataCell {
}
table tr td.TableDataCell a {
display: block;
color: black;
text-decoration: none;
}

View File

@ -22,9 +22,9 @@
<span class="grampsid">[{{event.gramps_id}}]</span></a>
{% if user.is_authenticated %}
<td><a href="/{{view}}/{{event.handle|escape}}">{{event.event_type|escape}}</a>
<td><a href="/{{view}}/{{event.handle|escape}}">{{event.description|escape}}</a>
<td><a href="/{{view}}/{{event.handle|escape}}">{{event|display_date}}</a>
<td><a href="/{{view}}/{{event.handle|escape}}">{{event.place.title|escape}}</a>
<td><a href="/{{view}}/{{event.handle|escape}}">{{event.description|nbsp}}</a>
<td><a href="/{{view}}/{{event.handle|escape}}">{{event|display_date|nbsp}}</a>
<td><a href="/{{view}}/{{event.handle|escape}}">{{event.place.title|nbsp}}</a>
{% else %}
<td></td>
<td></td>

View File

@ -18,8 +18,8 @@
<tr class="{% cycle odd,even %}">
<td><a href="/{{view}}/{{family.handle|escape}}" class="noThumb">{{ forloop.counter|row_count:page }}</a></td>
<td><a href="/{{view}}/{{family.handle|escape}}" class="noThumb"><span class="grampsid">[{{family.gramps_id}}]</span></a>
<td><a href="/{{view}}/{{family.handle|escape}}">{{family.father.name_set|make_name:user}}</a>
<td><a href="/{{view}}/{{family.handle|escape}}">{{family.mother.name_set|make_name:user}}</a>
<td><a href="/{{view}}/{{family.handle|escape}}">{{family.father.name_set|make_name:user|nbsp}}</a>
<td><a href="/{{view}}/{{family.handle|escape}}">{{family.mother.name_set|make_name:user|nbsp}}</a>
{% if user.is_authenticated %}
<td><a href="/{{view}}/{{family.handle|escape}}">{{family.family_rel_type|escape}}</a>
{% else %}

View File

@ -21,7 +21,7 @@
<span class="grampsid">[{{media.gramps_id}}]</span></a>
{% if user.is_authenticated %}
<td><a href="/{{view}}/{{media.handle|escape}}">{{media.mime|escape}}</a>
<td><a href="/{{view}}/{{media.handle|escape}}">{{media|display_date}}</a>
<td><a href="/{{view}}/{{media.handle|escape}}">{{media|display_date|nbsp}}</a>
<td><a href="/{{view}}/{{media.handle|escape}}">{{media.path|escape}}</a>
{% else %}
<td></td>

View File

@ -27,8 +27,8 @@
<td><a href="{{name.person.handle|escape}}/" class="grampsid">[{{name.person.gramps_id|escape}}]</a></td>
<td><a href="{{name.person.handle|escape}}/" class="noThumb">{{name.person.gender_type|escape}}</a></td>
{% if user.is_authenticated %}
<td><a href="{{name.person.handle|escape}}/" class="noThumb">{{name.person|person_get_birth_date}}</a></td>
<td><a href="{{name.person.handle|escape}}/" class="noThumb">{{name.person|person_get_death_date}}</a></td>
<td><a href="{{name.person.handle|escape}}/" class="noThumb">{{name.person|person_get_birth_date|nbsp}}</a></td>
<td><a href="{{name.person.handle|escape}}/" class="noThumb">{{name.person|person_get_death_date|nbsp}}</a></td>
{% else %}
<td><a href="{{name.person.handle|escape}}/" class="noThumb">[Private]</a>
<td><a href="{{name.person.handle|escape}}/" class="noThumb">[Private]</a>

View File

@ -21,8 +21,8 @@
<span class="grampsid">[{{source.gramps_id}}]</span></a>
{% if user.is_authenticated %}
<td><a href="/{{view}}/{{source.handle|escape}}">{{source.title|escape}}</a>
<td><a href="/{{view}}/{{source.handle|escape}}">{{source.pubinfo|escape}}</a>
<td><a href="/{{view}}/{{source.handle|escape}}">{{source.author|escape}}</a>
<td><a href="/{{view}}/{{source.handle|escape}}">{{source.pubinfo|nbsp}}</a>
<td><a href="/{{view}}/{{source.handle|escape}}">{{source.author|nbsp}}</a>
{% else %}
<td></td>
<td></td>

View File

@ -1,14 +1,21 @@
from django.template import escape, Library
from django.utils.safestring import mark_safe
from web.utils import *
import web.utils
register = Library()
util_filters = ['person_event_table', 'person_name_table', 'person_source_table', 'person_attribute_table',
'person_address_table', 'person_note_table', 'person_gallery_table', 'person_internet_table',
'person_association_table', 'person_lds_table', 'person_reference_table',
'family_children_table', 'family_event_table', 'family_source_table', 'family_attribute_table',
'family_note_table', 'family_gallery_table', 'family_lds_table']
util_filters = ['person_event_table', 'person_name_table',
'person_source_table', 'person_attribute_table',
'person_address_table', 'person_note_table',
'person_gallery_table', 'person_internet_table',
'person_association_table', 'person_lds_table',
'person_reference_table',
'family_children_table', 'family_event_table',
'family_source_table', 'family_attribute_table',
'family_note_table', 'family_gallery_table',
'family_lds_table',
'nbsp']
for filter_name in util_filters:
func = getattr(web.utils, filter_name)
func.is_safe = True

View File

@ -37,6 +37,7 @@ from gen.lib.date import Date as GDate, Today
from gen.plug import BasePluginManager
from cli.grampscli import CLIManager
from django.template import escape
from django.utils.safestring import mark_safe
from django.contrib.contenttypes.models import ContentType
#------------------------------------------------------------------------
@ -68,6 +69,14 @@ def format_number(number, with_grouping=True):
locale.setlocale(locale.LC_ALL, "en_US.utf8")
return locale.format("%d", number, with_grouping)
def nbsp(string):
"""
"""
if string:
return escape(string)
else:
return mark_safe("&nbsp;")
class Table(object):
"""
>>> table = Table()
@ -93,14 +102,16 @@ class Table(object):
self.table.columns(*args)
def row(self, *args):
self.table.row(*args)
self.table.row(*[nbsp(arg) for arg in args])
def link(self, object_type_name, handle):
self.table.set_link_col((object_type_name, handle))
def get_html(self):
# The HTML writer escapes data:
self.table.write(self.doc) # forces to htmllist
return str(self.doc.doc.htmllist[0])
# We have a couple of HTML bits that we want to unescape:
return str(self.doc.doc.htmllist[0]).replace("&amp;nbsp;", "&nbsp;")
_ = lambda text: text