From 7e3e92794667decf79d6b497e251f1c55938fa48 Mon Sep 17 00:00:00 2001 From: Hannaeko Date: Mon, 31 Mar 2025 02:16:10 +0200 Subject: [PATCH] wip friendly records --- templates/bases/base.html | 2 +- templates/macros.html | 74 +++++++++++++++++ templates/pages/new_record.html | 61 ++++++++++++++ templates/pages/records.html | 137 +++++++++++++++----------------- 4 files changed, 198 insertions(+), 76 deletions(-) create mode 100644 templates/macros.html create mode 100644 templates/pages/new_record.html diff --git a/templates/bases/base.html b/templates/bases/base.html index e543cb6..f653f85 100644 --- a/templates/bases/base.html +++ b/templates/bases/base.html @@ -1,5 +1,5 @@ - + diff --git a/templates/macros.html b/templates/macros.html new file mode 100644 index 0000000..5316a26 --- /dev/null +++ b/templates/macros.html @@ -0,0 +1,74 @@ +{% macro rrset(rtype, ttl, data, zone) %} +
  • +
    + {{ rtype }} +
    + + + + + + +
    +
    + + +
  • +{% endmacro rrset %} diff --git a/templates/pages/new_record.html b/templates/pages/new_record.html new file mode 100644 index 0000000..6bab4a4 --- /dev/null +++ b/templates/pages/new_record.html @@ -0,0 +1,61 @@ +{% extends "bases/app.html" %} +{% block title %}New record - {{ current_zone }} - {% endblock title %} + +{% block main %} +

    Create a new record in zone {{ current_zone }}

    +{% if not new_record_name or (new_record_name and domain_error) %} +

    Choose the name of the new record

    +
    + +
    + + .{{ current_zone }} +
    + {% if domain_error %} +

    {{ domain_error.description }}

    + {% endif %} +

    Only the subdomain, without the main domain. For instance, "www" to create the subdomain "www.{{ current_zone }}".

    + +
    +{% elif not config and not rtype %} + +

    Configure the domain {{ new_record_name }}...

    + +

    ...or create a new record for the domain {{ new_record_name }}

    +

    General

    + +

    E-mails

    + +

    Security

    + +

    DNS Delegation

    + +{% else %} +{% endif %} + +{% endblock %} diff --git a/templates/pages/records.html b/templates/pages/records.html index 5bc1407..7711904 100644 --- a/templates/pages/records.html +++ b/templates/pages/records.html @@ -1,9 +1,11 @@ +{% import "macros.html" as macros %} {% extends "bases/app.html" %} + {% block title %}Records - {{ current_zone }} - {% endblock title %} {% block main %} -

    Zone {{ current_zone }} records

    -

    Zone {{ current_zone }} records

    +

    Records

    - - {% set current_domain = '' %} - {% set current_rtype = '' %} - - {% for record in records %} - {% if record.name != current_domain %} - {% if current_domain %} - - - - - - {% endif %} - {% set_global current_domain = record.name %} - {% set_global current_rtype = '' %} + {% for group in records.records %}
    -

    {{ record.name }}

    +

    {{ group.owner }}

    - +
    + {% if group.web %} +

    Web

      - {% endif %} - {% if record.type != current_rtype %} - {% if current_rtype %} -
    - - {% endif %} - {% set_global current_rtype = record.type %} -
  • - {{ record.type }} -
      -
    • + {% if group.web.addresses %} + {{ macros::rrset( + rtype=group.web.addresses.rtype, + ttl=group.web.addresses.ttl, + data=group.web.addresses.data, + zone=current_zone) }} {% endif %} -
      - {% if record.type == "A" or record.type == "AAAA" %} -
      - - {{ record.rdata.address }} - -
      - {% elif record.type == "MX" %} -
      - - {{ record.rdata.mail_exchanger }} - -
      -
      - - Preference: {{ record.rdata.mail_exchanger }} - -
      - {% elif record.type == "NS" %} -
      - - {{ record.rdata.target }} - -
      - {% endif %} -
      -
      - - - - - - -
      -
    • +
    + {% endif %} + + {% if group.mail %} +

    E-mails

    +
      + {% if group.mail.servers %} + {{ macros::rrset( + rtype=group.mail.servers.rtype, + ttl=group.mail.servers.ttl, + data=group.mail.servers.data, + zone=current_zone) }} + {% endif %} + {% if group.mail.spf %} + {{ macros::rrset( + rtype=group.mail.spf.rtype, + ttl=group.mail.spf.ttl, + data=group.mail.spf.data, + zone=current_zone) }} + {% endif %} +
    + {% endif %} + + {% if group.general_records %} +

    General

    +
      + {% for rrset in group.general_records %} + {{ macros::rrset( + rtype=rrset.rtype, + ttl=rrset.ttl, + data=rrset.data, + zone=current_zone) }} + {% endfor %} +
    + {% endif %} + +
  • +
    {% endfor %} - - - - - +
    +
    +

    Aliases

    + +
    {% endblock main %}