template_code.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. OBJECTCHANGE_FULL_NAME = """
  2. {% load helpers %}
  3. {{ value.get_full_name|placeholder }}
  4. """
  5. OBJECTCHANGE_OBJECT = """
  6. {% if value and value.get_absolute_url %}
  7. <a href="{{ value.get_absolute_url }}">{{ record.object_repr }}</a>
  8. {% else %}
  9. {{ record.object_repr }}
  10. {% endif %}
  11. """
  12. OBJECTCHANGE_REQUEST_ID = """
  13. <a href="{% url 'core:objectchange_list' %}?request_id={{ value }}">{{ value }}</a>
  14. """
  15. PLUGIN_IS_INSTALLED = """
  16. {% if record.is_local %}
  17. {% if record.is_loaded %}
  18. <span class="text-success"><i class="mdi mdi-check-bold"></i></span>
  19. {% else %}
  20. <span class="text-danger"><i class="mdi mdi-alert" data-bs-toggle="tooltip" title="Could not load plugin. Version may be incompatible. Min version: {{ record.netbox_min_version }}, max version: {{ record.netbox_max_version }}"></i></span>
  21. {% endif %}
  22. {% else %}
  23. <span class="text-muted">&mdash;</span>
  24. {% endif %}
  25. """
  26. PLUGIN_NAME_TEMPLATE = """
  27. {% load static %}
  28. {% if record.icon_url %}
  29. <img class="plugin-icon" src="{{ record.icon_url }}">
  30. {% else %}
  31. <img class="plugin-icon" src="{% static 'plugin-default.svg' %}">
  32. {% endif %}
  33. <a href="{% url 'core:plugin' record.config_name %}">{{ record.title_long }}</a>
  34. """
  35. DATA_SOURCE_SYNC_BUTTON = """
  36. {% load helpers %}
  37. {% load i18n %}
  38. {% if perms.core.sync_datasource %}
  39. {% if record.ready_for_sync %}
  40. <button class="btn btn-primary btn-sm" type="submit" formaction="{% url 'core:datasource_sync' pk=record.pk %}?return_url={{ request.get_full_path|urlencode }}" formmethod="post">
  41. <i class="mdi mdi-sync" aria-hidden="true"></i> {% trans "Sync" %}
  42. </button>
  43. {% else %}
  44. <button class="btn btn-primary btn-sm" disabled>
  45. <i class="mdi mdi-sync" aria-hidden="true"></i> {% trans "Sync" %}
  46. </button>
  47. {% endif %}
  48. {% endif %}
  49. """