mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #7925: Linkify contact phone and email attributes
This commit is contained in:
@ -15,7 +15,7 @@
|
|||||||
* [#7812](https://github.com/netbox-community/netbox/issues/7812) - Enable change logging for image attachments
|
* [#7812](https://github.com/netbox-community/netbox/issues/7812) - Enable change logging for image attachments
|
||||||
* [#7858](https://github.com/netbox-community/netbox/issues/7858) - Standardize the representation of content types across import & export functions
|
* [#7858](https://github.com/netbox-community/netbox/issues/7858) - Standardize the representation of content types across import & export functions
|
||||||
* [#7884](https://github.com/netbox-community/netbox/issues/7884) - Add FHRP groups column to interface tables
|
* [#7884](https://github.com/netbox-community/netbox/issues/7884) - Add FHRP groups column to interface tables
|
||||||
* [#7940](https://github.com/netbox-community/netbox/issues/7940) - Add ITA multistandard outlet
|
* [#7925](https://github.com/netbox-community/netbox/issues/7925) - Linkify contact phone and email attributes
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
@ -37,11 +37,23 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Phone</td>
|
<td>Phone</td>
|
||||||
<td>{{ object.phone|placeholder }}</td>
|
<td>
|
||||||
|
{% if object.phone %}
|
||||||
|
<a href="tel:{{ object.phone }}">{{ object.phone }}</a>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">None</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Email</td>
|
<td>Email</td>
|
||||||
<td>{{ object.email|placeholder }}</td>
|
<td>
|
||||||
|
{% if object.phone %}
|
||||||
|
<a href="mailto:{{ object.email }}">{{ object.email }}</a>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">None</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Address</td>
|
<td>Address</td>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from utilities.tables import (
|
from utilities.tables import (
|
||||||
BaseTable, ButtonsColumn, ContentTypeColumn, LinkedCountColumn, MarkdownColumn, MPTTColumn, TagColumn, ToggleColumn,
|
BaseTable, ButtonsColumn, ContentTypeColumn, LinkedCountColumn, linkify_phone, MarkdownColumn, MPTTColumn,
|
||||||
|
TagColumn, ToggleColumn,
|
||||||
)
|
)
|
||||||
from .models import *
|
from .models import *
|
||||||
|
|
||||||
@ -131,6 +132,9 @@ class ContactTable(BaseTable):
|
|||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
|
phone = tables.Column(
|
||||||
|
linkify=linkify_phone,
|
||||||
|
)
|
||||||
comments = MarkdownColumn()
|
comments = MarkdownColumn()
|
||||||
assignment_count = tables.Column(
|
assignment_count = tables.Column(
|
||||||
verbose_name='Assignments'
|
verbose_name='Assignments'
|
||||||
|
@ -489,3 +489,19 @@ def paginate_table(table, request):
|
|||||||
'per_page': get_paginate_count(request)
|
'per_page': get_paginate_count(request)
|
||||||
}
|
}
|
||||||
RequestConfig(request, paginate).configure(table)
|
RequestConfig(request, paginate).configure(table)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Callables
|
||||||
|
#
|
||||||
|
|
||||||
|
def linkify_email(value):
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
|
return f"mailto:{value}"
|
||||||
|
|
||||||
|
|
||||||
|
def linkify_phone(value):
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
|
return f"tel:{value}"
|
||||||
|
Reference in New Issue
Block a user