Show 'enabled' column in grid, fix prefix bug for email profiles

This commit is contained in:
Lance Edgar 2016-12-10 14:15:40 -06:00
parent 9692e389d5
commit ed4c445fbe

View file

@ -40,6 +40,14 @@ from tailbone.views import MasterView, View
from tailbone.newgrids import Grid, GridColumn from tailbone.newgrids import Grid, GridColumn
class BoolGridColumn(GridColumn):
def render(self, value):
if value is None:
return ''
return 'Yes' if value else 'No'
class EmailListGridColumn(GridColumn): class EmailListGridColumn(GridColumn):
def render(self, value): def render(self, value):
@ -95,7 +103,7 @@ class ProfilesView(MasterView):
'key': email.key, 'key': email.key,
'fallback_key': email.fallback_key, 'fallback_key': email.fallback_key,
'description': email.__doc__, 'description': email.__doc__,
'prefix': email.get_prefix(data), 'prefix': email.get_prefix(data, magic=False),
'subject': email.get_subject(data, render=False), 'subject': email.get_subject(data, render=False),
'sender': email.get_sender(), 'sender': email.get_sender(),
'replyto': email.get_replyto(), 'replyto': email.get_replyto(),
@ -111,12 +119,14 @@ class ProfilesView(MasterView):
GridColumn('prefix'), GridColumn('prefix'),
GridColumn('subject'), GridColumn('subject'),
EmailListGridColumn('to'), EmailListGridColumn('to'),
BoolGridColumn('enabled'),
] ]
g.sorters['key'] = g.make_sorter('key', foldcase=True) g.sorters['key'] = g.make_sorter('key', foldcase=True)
g.sorters['prefix'] = g.make_sorter('prefix', foldcase=True) g.sorters['prefix'] = g.make_sorter('prefix', foldcase=True)
g.sorters['subject'] = g.make_sorter('subject', foldcase=True) g.sorters['subject'] = g.make_sorter('subject', foldcase=True)
g.sorters['to'] = g.make_sorter('to', foldcase=True) g.sorters['to'] = g.make_sorter('to', foldcase=True)
g.sorters['enabled'] = g.make_sorter('enabled')
g.default_sortkey = 'key' g.default_sortkey = 'key'
# Make edit link visible by default, no "More" actions. # Make edit link visible by default, no "More" actions.