Improve UX of create and update record screen

The create record has a couple of issues that this fixes:
 - when the name needs to end with a '.' character, the user
   is left clueless about this rule.

 - General review of record types is not present.
 - The buttons on the bottom of the page are non standard.

Change-Id: I4782552e7c044b5d8a141792166af5c578ca62a7
Closes-bug: #1447737
This commit is contained in:
eric 2015-04-23 14:50:50 -06:00
parent 09f06ec5ef
commit 7ce7e401f8
3 changed files with 28 additions and 34 deletions

View File

@ -203,15 +203,15 @@ class RecordForm(forms.SelfHandlingForm):
label=_("Record Type"),
required=False,
choices=[
('a', _('A')),
('aaaa', _('AAAA')),
('cname', _('CNAME')),
('mx', _('MX')),
('ptr', _('PTR')),
('spf', _('SPF')),
('srv', _('SRV')),
('sshfp', _('SSHFP')),
('txt', _('TXT')),
('a', _('A - Address record')),
('aaaa', _('AAAA - IPv6 address record')),
('cname', _('CNAME - Canonical name record')),
('mx', _('MX - Mail exchange record')),
('ptr', _('PTR - Pointer record')),
('spf', _('SPF - Sender Policy Framework')),
('srv', _('SRV - Service locator')),
('sshfp', _('SSHFP - SSH Public Key Fingerprint')),
('txt', _('TXT - Text record')),
],
widget=forms.Select(attrs={
'class': 'switchable',
@ -338,7 +338,9 @@ class RecordForm(forms.SelfHandlingForm):
else:
if not re.match(WILDCARD_DOMAIN_NAME_REGEX,
cleaned_data['name']):
self._add_field_error('name', _('Enter a valid hostname'))
self._add_field_error('name', _('Enter a valid hostname.'
' The hostname should end'
' with a period.'))
elif not cleaned_data['name'].endswith(domain_name):
self._add_field_error(
'name',

View File

@ -7,15 +7,19 @@
{% block modal_id %}create_record_modal{% endblock %}
{% block modal-header %}{% trans "Create Record for" %} {{ domain.name }}{% endblock %}
{% block modal-body %}
<div class="full">
<fieldset>
{% include "horizon/common/_form_fields.html" %}
</fieldset>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Create Domain Record" %}" />
<a href="{% url 'horizon:project:dns_domains:records' domain.id %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% block modal-body-right %}
<h3>{% trans "Description:" %}</h3>
{% blocktrans %}
<p>
<strong>Please note:</strong>
For record types, the name <strong>must</strong> end with a period.
</p>
<p>
<strong>TTL</strong>
The TTL is the time-to-live for the record, in seconds.
</p>
<p>
See <a href="http://en.wikipedia.org/wiki/List_of_DNS_record_types" target="_designate_record_defs">more info</a> on record types.
</p>
{% endblocktrans %}
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "horizon/common/_modal_form.html" %}
{% extends "project/dns_domains/_create_record.html" %}
{% load i18n %}
{% load url from future %}
@ -7,15 +7,3 @@
{% block modal-header %}{% trans "Update Domain Record" %}{% endblock %}
{% block modal-body %}
<div class="full">
<fieldset>
{% include "horizon/common/_form_fields.html" %}
</fieldset>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Update Domain Record" %}" />
<a href="{% url 'horizon:project:dns_domains:records' record.domain_id %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}