diff --git a/locales/en/main.ftl b/locales/en/main.ftl index 1976bf7..4a1fd88 100644 --- a/locales/en/main.ftl +++ b/locales/en/main.ftl @@ -30,6 +30,19 @@ zone-content-new-record-button = New record ## Create record +new-record-title = New record + +record-creation-process-heading = Create a new record in zone { $zone } + +record-choose-name-heading = Choose the subdomain name of the new record + +record-input-name = + .input-label = Subdomain of the new record + .help-description = Only the subdomain, without the parent domain. For instance, "www" to create the subdomain "www.{ $zone }". + .error-domain-characters_not_permitted = Domain name label "{ $label }" contains characters not permitted. The allowed characters are lowercase alphanumeric characters (a-z and 0-9), the dash ('-'), the underscore ('_') and the forward slash ('/'). + +button-create-record-next-step = Next step + record-input-addresses = .input-label = IP address #{ $index } .error-record-parse-ip = Unexpected IP address format. The IP address diff --git a/locales/fr/main.ftl b/locales/fr/main.ftl index a92c269..aef3987 100644 --- a/locales/fr/main.ftl +++ b/locales/fr/main.ftl @@ -30,6 +30,19 @@ zone-content-new-record-button = Nouvel enregistrement ## Create record +new-record-title = Nouvel enregistrement + +record-creation-process-heading = Créer un nouvel enregistrement dans la zone { $zone } + +record-choose-name-heading = Choisir le nom du sous-domaine du nouvel enregistrement + +record-input-name = + .input-label = Sous-domaine du nouvel enregistrement + .help-description = Seulement le sous-domaine, sans le domaine parent. Par exemple, “www” pour créer le sous-domaine “www.{ $zone }”. + .error-domain-characters_not_permitted = Le segment “{ $label }” du nom de domain contient des caractères interdits. Les caractères autorisés sont les caractères alphanumériques (a-z et 0-9), le tiret (“-”), le tiret bas (“_”) et le slash (“/”). + +button-create-record-next-step = Étape suivante + record-input-addresses = .input-label = Adresse IP #{ $index } .error-record-parse-ip = Format d’adresse IP inconnu. L’adresse IP doit être diff --git a/src/resources/dns/friendly/create.rs b/src/resources/dns/friendly/create.rs index aeb42a3..cc78730 100644 --- a/src/resources/dns/friendly/create.rs +++ b/src/resources/dns/friendly/create.rs @@ -51,7 +51,10 @@ impl NewRecordQuery { errors, "/name" ); - self.name = new_name; + // Keep the old value if the name is invalid + if new_name.is_some() { + self.name = new_name; + } } } diff --git a/templates/pages/new_record.html b/templates/pages/new_record.html index 87cb7a6..1e5a317 100644 --- a/templates/pages/new_record.html +++ b/templates/pages/new_record.html @@ -1,10 +1,14 @@ {% extends "bases/app.html" %} {% import "macros/new_rrset.html" as new_rrset %} -{% block title %}New record - {{ current_zone }} - {% endblock title %} +{% block title %}{{ tr(msg="new-record-title", lang=lang) }} – {{ current_zone }} ‑ {% endblock title %} {% block main %} -

Create a new record in zone {{ current_zone }}

-{{ errors | json_encode(pretty=true) }} +

{{ tr(msg="record-creation-process-heading", zone=current_zone, lang=lang) }}

+ + +{% set domain_error = errors | get(key="/name", default="") %} + +{{ domain_error | json_encode(pretty=true) }} {% if not new_record_name or (new_record_name and domain_error) %} {% include "pages/new_record/choose_name.html" %} {% elif not config and not rtype %} diff --git a/templates/pages/new_record/choose_name.html b/templates/pages/new_record/choose_name.html index 1ee7bd3..5b9f22b 100644 --- a/templates/pages/new_record/choose_name.html +++ b/templates/pages/new_record/choose_name.html @@ -1,21 +1,28 @@ -

Choose the name of the new record

+

{{ tr(msg="record-choose-name-heading", lang=lang) }}

- - {% set domain_error = errors | get(key="/name", default="") %} -
- - .{{ current_zone }} +
+ +
+ + .{{ current_zone }} +
{% if domain_error %} -

{{ domain_error.description }}

+

+ {{ tr( + msg="record-input-name", + attr="error-" ~ domain_error.code | replace(from=":", to="-"), + extra_args=domain_error | get(key="details", default=""), + lang=lang) }} +

{% endif %} -

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

- +

{{ tr(msg="record-input-name", attr="help-description", zone=current_zone, lang=lang) }}

+ diff --git a/templates/pages/records.html b/templates/pages/records.html index b4c7346..18b24fd 100644 --- a/templates/pages/records.html +++ b/templates/pages/records.html @@ -1,7 +1,7 @@ {% import "macros/display_rrset.html" as rrset %} {% extends "bases/app.html" %} -{% block title %}{{ tr(msg="zone-content-title", lang=lang) }} - {{ current_zone }} - {% endblock title %} +{% block title %}{{ tr(msg="zone-content-title", lang=lang) }} – {{ current_zone }} – {% endblock title %} {% block main %}

{{ tr(msg="zone-header", lang=lang, zone_name="" ~ current_zone ~ "") | safe }}