Empty table cells have clickable area, even if empty
svn: r13732
This commit is contained in:
@@ -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
|
||||
|
@@ -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(" ")
|
||||
|
||||
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(" ", " ")
|
||||
|
||||
_ = lambda text: text
|
||||
|
||||
|
Reference in New Issue
Block a user