LINKTERMINATION = """
{% for termination in value %}
{% if termination.parent_object %}
{{ termination.parent_object }}
{% endif %}
{{ termination }} {% if not forloop.last %} {% endif %}
{% empty %}
{{ ''|placeholder }}
{% endfor %}
"""
CABLE_LENGTH = """
{% load helpers %}
{% if record.length %}{{ record.length|floatformat:"-2" }} {{ record.length_unit }}{% endif %}
"""
WEIGHT = """
{% load helpers %}
{% if value %}{{ value|floatformat:"-2" }} {{ record.weight_unit }}{% endif %}
"""
DEVICE_LINK = """
{{ value|default:'Unnamed device ' }}
"""
DEVICEBAY_STATUS = """
{% if record.installed_device_id %}
{{ record.installed_device.get_status_display }}
{% else %}
Vacant
{% endif %}
"""
INTERFACE_IPADDRESSES = """
{% for ip in value.all %}
{% if ip.status != 'active' %}
{{ ip }}
{% else %}
{{ ip }}
{% endif %}
{% endfor %}
"""
INTERFACE_FHRPGROUPS = """
"""
INTERFACE_TAGGED_VLANS = """
{% if record.mode == 'tagged' %}
{% for vlan in value.all %}
{{ vlan }}
{% endfor %}
{% elif record.mode == 'tagged-all' %}
All
{% endif %}
"""
INTERFACE_WIRELESS_LANS = """
{% for wlan in value.all %}
{{ wlan }}
{% endfor %}
"""
POWERFEED_CABLE = """
{{ value }}
"""
POWERFEED_CABLETERMINATION = """
{{ value.parent_object }}
{{ value }}
"""
LOCATION_BUTTONS = """
"""
#
# Device component templatebuttons
#
MODULAR_COMPONENT_TEMPLATE_BUTTONS = """
{% load helpers %}
{% if perms.dcim.add_inventoryitemtemplate and record.device_type_id %}
{% endif %}
"""
#
# Device component buttons
#
CONSOLEPORT_BUTTONS = """
{% if perms.dcim.add_inventoryitem %}
{% endif %}
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.change_cable or perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% else %}
{% endif %}
"""
CONSOLESERVERPORT_BUTTONS = """
{% if perms.dcim.add_inventoryitem %}
{% endif %}
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.change_cable or perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% else %}
{% endif %}
"""
POWERPORT_BUTTONS = """
{% if perms.dcim.add_inventoryitem %}
{% endif %}
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.change_cable or perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% else %}
{% endif %}
"""
POWEROUTLET_BUTTONS = """
{% if perms.dcim.add_inventoryitem %}
{% endif %}
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.change_cable or perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% if not record.mark_connected %}
{% else %}
{% endif %}
{% endif %}
"""
INTERFACE_BUTTONS = """
{% if perms.dcim.change_interface %}
{% endif %}
{% if record.link %}
{% endif %}
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.change_cable or perms.dcim.delete_cable %}
{% endif %}
{% elif record.wireless_link %}
{% if perms.wireless.delete_wirelesslink %}
{% endif %}
{% elif record.is_wired and perms.dcim.add_cable %}
{% if not record.mark_connected %}
{% else %}
{% endif %}
{% elif record.is_wireless and perms.wireless.add_wirelesslink %}
{% endif %}
"""
FRONTPORT_BUTTONS = """
{% if perms.dcim.add_inventoryitem %}
{% endif %}
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.change_cable or perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% if not record.mark_connected %}
{% else %}
{% endif %}
{% endif %}
"""
REARPORT_BUTTONS = """
{% if perms.dcim.add_inventoryitem %}
{% endif %}
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.change_cable or perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% if not record.mark_connected %}
{% else %}
{% endif %}
{% endif %}
"""
DEVICEBAY_BUTTONS = """
{% if perms.dcim.change_devicebay %}
{% if record.installed_device %}
{% else %}
{% endif %}
{% endif %}
"""
MODULEBAY_BUTTONS = """
{% if perms.dcim.add_module %}
{% if record.installed_module %}
{% else %}
{% endif %}
{% endif %}
"""