From ea7eb475519c0251221a6fc49fcdacb6c9d079d1 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 3 Aug 2017 19:16:53 -0500 Subject: [PATCH] Add auto-links for most grids probably still missing some yet? --- tailbone/grids/core.py | 2 +- tailbone/views/bouncer.py | 3 +++ tailbone/views/brands.py | 2 ++ tailbone/views/categories.py | 3 +++ tailbone/views/customers.py | 2 ++ tailbone/views/departments.py | 2 ++ tailbone/views/depositlinks.py | 2 ++ tailbone/views/exports.py | 2 ++ tailbone/views/labels/profiles.py | 2 ++ tailbone/views/people.py | 2 ++ tailbone/views/reportcodes.py | 2 ++ tailbone/views/reports.py | 4 ++++ tailbone/views/taxes.py | 2 ++ tailbone/views/tempmon/clients.py | 4 ++++ tailbone/views/tempmon/probes.py | 4 ++++ tailbone/views/tempmon/readings.py | 3 +++ tailbone/views/trainwreck.py | 6 ++++++ tailbone/views/vendors/core.py | 3 +++ 18 files changed, 49 insertions(+), 1 deletion(-) diff --git a/tailbone/grids/core.py b/tailbone/grids/core.py index fd0ac595..f4daedc1 100644 --- a/tailbone/grids/core.py +++ b/tailbone/grids/core.py @@ -977,7 +977,7 @@ class CustomWebhelpersGrid(webhelpers2_grid.Grid): if hasattr(record, 'uuid'): attrs['data_uuid'] = record.uuid return HTML.tag('li', tags.link_to(value, url), **attrs) - if self.linked_columns and column_name in self.linked_columns: + if self.linked_columns and column_name in self.linked_columns and value: url = self.url_generator(record, i) value = tags.link_to(value, url) class_name = 'c{} {}'.format(column_number, column_name) diff --git a/tailbone/views/bouncer.py b/tailbone/views/bouncer.py index 542f71b6..72674890 100644 --- a/tailbone/views/bouncer.py +++ b/tailbone/views/bouncer.py @@ -87,6 +87,9 @@ class EmailBouncesView(MasterView): g.set_label('bounce_recipient_address', "Bounced To") g.set_label('intended_recipient_address', "Intended For") + g.set_link('bounced') + g.set_link('intended_recipient_address') + def configure_fieldset(self, fs): bounce = fs.model handler = self.get_handler(bounce) diff --git a/tailbone/views/brands.py b/tailbone/views/brands.py index cb24279c..407d16f7 100644 --- a/tailbone/views/brands.py +++ b/tailbone/views/brands.py @@ -43,9 +43,11 @@ class BrandsView(MasterView): ] def configure_grid(self, g): + super(BrandsView, self).configure_grid(g) g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' g.default_sortkey = 'name' + g.set_link('name') def configure_fieldset(self, fs): fs.configure( diff --git a/tailbone/views/categories.py b/tailbone/views/categories.py index 5376776b..79082913 100644 --- a/tailbone/views/categories.py +++ b/tailbone/views/categories.py @@ -52,6 +52,9 @@ class CategoriesView(MasterView): g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' g.default_sortkey = 'code' + g.set_link('code') + g.set_link('number') + g.set_link('name') def configure_fieldset(self, fs): fs.configure( diff --git a/tailbone/views/customers.py b/tailbone/views/customers.py index df0650c9..96802767 100644 --- a/tailbone/views/customers.py +++ b/tailbone/views/customers.py @@ -85,6 +85,8 @@ class CustomersView(MasterView): g.set_label('phone', "Phone Number") g.set_label('email', "Email Address") + g.set_link('id') + g.set_link('number') g.set_link('name') def get_mobile_data(self, session=None): diff --git a/tailbone/views/departments.py b/tailbone/views/departments.py index 8f2a2760..d4ddcbdf 100644 --- a/tailbone/views/departments.py +++ b/tailbone/views/departments.py @@ -51,6 +51,8 @@ class DepartmentsView(MasterView): g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' g.default_sortkey = 'number' + g.set_link('number') + g.set_link('name') def configure_fieldset(self, fs): fs.configure( diff --git a/tailbone/views/depositlinks.py b/tailbone/views/depositlinks.py index b59bcef2..6fa7acd5 100644 --- a/tailbone/views/depositlinks.py +++ b/tailbone/views/depositlinks.py @@ -52,6 +52,8 @@ class DepositLinksView(MasterView): g.filters['description'].default_verb = 'contains' g.default_sortkey = 'code' g.set_type('amount', 'currency') + g.set_link('code') + g.set_link('description') def configure_fieldset(self, fs): fs.configure( diff --git a/tailbone/views/exports.py b/tailbone/views/exports.py index b24ff7f8..4d121a0b 100644 --- a/tailbone/views/exports.py +++ b/tailbone/views/exports.py @@ -77,6 +77,8 @@ class ExportMasterView(MasterView): g.set_label('id', "ID") g.set_label('created_by', "Created by") + g.set_link('id') + def render_id(self, export, column): return export.id_str diff --git a/tailbone/views/labels/profiles.py b/tailbone/views/labels/profiles.py index 73fd7cb8..3c06d8c8 100644 --- a/tailbone/views/labels/profiles.py +++ b/tailbone/views/labels/profiles.py @@ -55,6 +55,8 @@ class ProfilesView(MasterView): super(ProfilesView, self).configure_grid(g) g.default_sortkey = 'ordinal' g.set_type('visible', 'boolean') + g.set_link('code') + g.set_link('description') def configure_fieldset(self, fs): fs.printer_spec.set(renderer=forms.renderers.StrippedTextFieldRenderer) diff --git a/tailbone/views/people.py b/tailbone/views/people.py index b81f8558..a049be6a 100644 --- a/tailbone/views/people.py +++ b/tailbone/views/people.py @@ -104,6 +104,8 @@ class PeopleView(MasterView): g.set_label('customer_id', "Customer ID") g.set_link('display_name') + g.set_link('first_name') + g.set_link('last_name') def get_instance(self): # TODO: I don't recall why this fallback check for a vendor contact diff --git a/tailbone/views/reportcodes.py b/tailbone/views/reportcodes.py index 7aa04751..59646cfc 100644 --- a/tailbone/views/reportcodes.py +++ b/tailbone/views/reportcodes.py @@ -49,6 +49,8 @@ class ReportCodesView(MasterView): g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' g.default_sortkey = 'code' + g.set_link('code') + g.set_link('name') def configure_fieldset(self, fs): fs.configure( diff --git a/tailbone/views/reports.py b/tailbone/views/reports.py index 2a759168..ac349138 100644 --- a/tailbone/views/reports.py +++ b/tailbone/views/reports.py @@ -212,6 +212,10 @@ class ReportOutputView(ExportMasterView): 'created_by', ] + def configure_grid(self, g): + super(ReportOutputView, self).configure_grid(g) + g.set_link('filename') + def _preconfigure_fieldset(self, fs): super(ReportOutputView, self)._preconfigure_fieldset(fs) if self.viewing: diff --git a/tailbone/views/taxes.py b/tailbone/views/taxes.py index 2cfbbbff..75485342 100644 --- a/tailbone/views/taxes.py +++ b/tailbone/views/taxes.py @@ -51,6 +51,8 @@ class TaxesView(MasterView): g.filters['description'].default_active = True g.filters['description'].default_verb = 'contains' g.default_sortkey = 'code' + g.set_link('code') + g.set_link('description') def configure_fieldset(self, fs): fs.configure( diff --git a/tailbone/views/tempmon/clients.py b/tailbone/views/tempmon/clients.py index c6909275..7f275565 100644 --- a/tailbone/views/tempmon/clients.py +++ b/tailbone/views/tempmon/clients.py @@ -91,6 +91,10 @@ class TempmonClientView(MasterView): g.set_label('config_key', "Key") + g.set_link('config_key') + g.set_link('hostname') + g.set_link('location') + def _preconfigure_fieldset(self, fs): fs.config_key.set(validate=unique_config_key) fs.probes.set(renderer=ProbesFieldRenderer) diff --git a/tailbone/views/tempmon/probes.py b/tailbone/views/tempmon/probes.py index 526bec1b..75d6540c 100644 --- a/tailbone/views/tempmon/probes.py +++ b/tailbone/views/tempmon/probes.py @@ -79,6 +79,10 @@ class TempmonProbeView(MasterView): g.set_label('config_key', "Key") + g.set_link('client') + g.set_link('config_key') + g.set_link('description') + def _preconfigure_fieldset(self, fs): fs.config_key.set(validate=unique_config_key) fs.client.set(label="TempMon Client", renderer=ClientFieldRenderer) diff --git a/tailbone/views/tempmon/readings.py b/tailbone/views/tempmon/readings.py index cd45a4c9..fcd771e9 100644 --- a/tailbone/views/tempmon/readings.py +++ b/tailbone/views/tempmon/readings.py @@ -81,6 +81,9 @@ class TempmonReadingView(MasterView): g.set_renderer('client_key', self.render_client_key) g.set_renderer('client_host', self.render_client_host) + g.set_link('probe') + g.set_link('taken') + def render_client_key(self, reading, column): return reading.client.config_key diff --git a/tailbone/views/trainwreck.py b/tailbone/views/trainwreck.py index f41087c9..ba363cd3 100644 --- a/tailbone/views/trainwreck.py +++ b/tailbone/views/trainwreck.py @@ -92,6 +92,12 @@ class TransactionView(MasterView): g.set_label('receipt_number', "Receipt No.") g.set_label('customer_id', "Customer ID") + g.set_link('start_time') + g.set_link('receipt_number') + g.set_link('customer_id') + g.set_link('customer_name') + g.set_link('total') + def _preconfigure_fieldset(self, fs): fs.system.set(renderer=forms.renderers.EnumFieldRenderer(self.enum.TRAINWRECK_SYSTEM)) fs.terminal_id.set(label="Terminal") diff --git a/tailbone/views/vendors/core.py b/tailbone/views/vendors/core.py index 7976a732..16ee11dd 100644 --- a/tailbone/views/vendors/core.py +++ b/tailbone/views/vendors/core.py @@ -59,6 +59,9 @@ class VendorsView(MasterView): g.set_label('phone', "Phone Number") g.set_label('email', "Email Address") + g.set_link('id') + g.set_link('name') + def configure_fieldset(self, fs): fs.append(forms.AssociationProxyField('contact')) fs.configure(