Fixed #27207 -- Replaced <p> tag with <div> in admin help texts.

This commit is contained in:
Alexander Gaevsky 2016-04-14 20:10:55 +03:00 committed by Tim Graham
parent 14879ac61d
commit 2d26b4637f
9 changed files with 44 additions and 22 deletions

View File

@ -187,7 +187,7 @@ p.mini {
margin-top: -3px; margin-top: -3px;
} }
.help, p.help, form p.help { .help, p.help, form p.help, div.help, form div.help {
font-size: 11px; font-size: 11px;
color: #999; color: #999;
} }
@ -410,6 +410,9 @@ input, textarea, select, .form-row p, form .button {
font-weight: normal; font-weight: normal;
font-size: 13px; font-size: 13px;
} }
.form-row div.help {
padding: 2px 3px;
}
textarea { textarea {
vertical-align: top; vertical-align: top;

View File

@ -83,7 +83,7 @@ form ul.inline li {
height: 26px; height: 26px;
} }
.aligned label + p { .aligned label + p, .aligned label + div.help {
padding: 6px 0; padding: 6px 0;
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
@ -115,26 +115,32 @@ form .aligned ul.radiolist {
padding: 0; padding: 0;
} }
form .aligned p.help { form .aligned p.help,
form .aligned div.help {
clear: left; clear: left;
margin-top: 0; margin-top: 0;
margin-left: 160px; margin-left: 160px;
padding-left: 10px; padding-left: 10px;
} }
form .aligned label + p.help { form .aligned label + p.help,
form .aligned label + div.help {
margin-left: 0; margin-left: 0;
padding-left: 0; padding-left: 0;
} }
form .aligned p.help:last-child { form .aligned p.help:last-child,
form .aligned div.help:last-child {
margin-bottom: 0; margin-bottom: 0;
padding-bottom: 0; padding-bottom: 0;
} }
form .aligned input + p.help, form .aligned input + p.help,
form .aligned textarea + p.help, form .aligned textarea + p.help,
form .aligned select + p.help { form .aligned select + p.help,
form .aligned input + div.help,
form .aligned textarea + div.help,
form .aligned select + div.help {
margin-left: 160px; margin-left: 160px;
padding-left: 10px; padding-left: 10px;
} }
@ -156,7 +162,8 @@ form .aligned table p {
padding: 0 0 5px 5px; padding: 0 0 5px 5px;
} }
.aligned .vCheckboxLabel + p.help { .aligned .vCheckboxLabel + p.help,
.aligned .vCheckboxLabel + div.help {
margin-top: -4px; margin-top: -4px;
} }
@ -164,7 +171,8 @@ form .aligned table p {
width: 610px; width: 610px;
} }
.checkbox-row p.help { .checkbox-row p.help,
.checkbox-row div.help {
margin-left: 0; margin-left: 0;
padding-left: 0; padding-left: 0;
} }
@ -180,14 +188,22 @@ fieldset .field-box {
width: 200px; width: 200px;
} }
form .wide p, form .wide input + p.help { form .wide p,
form .wide input + p.help,
form .wide input + div.help {
margin-left: 200px; margin-left: 200px;
} }
form .wide p.help { form .wide p.help,
form .wide div.help {
padding-left: 38px; padding-left: 38px;
} }
form div.help ul {
padding-left: 0;
margin-left: 0;
}
.colM fieldset.wide .vLargeTextField, .colM fieldset.wide .vXMLLargeTextField { .colM fieldset.wide .vLargeTextField, .colM fieldset.wide .vXMLLargeTextField {
width: 450px; width: 450px;
} }

View File

@ -37,7 +37,7 @@
{{ form.password1.errors }} {{ form.password1.errors }}
{{ form.password1.label_tag }} {{ form.password1 }} {{ form.password1.label_tag }} {{ form.password1 }}
{% if form.password1.help_text %} {% if form.password1.help_text %}
<p class="help">{{ form.password1.help_text|safe }}</p> <div class="help">{{ form.password1.help_text|safe }}</div>
{% endif %} {% endif %}
</div> </div>
@ -45,7 +45,7 @@
{{ form.password2.errors }} {{ form.password2.errors }}
{{ form.password2.label_tag }} {{ form.password2 }} {{ form.password2.label_tag }} {{ form.password2 }}
{% if form.password2.help_text %} {% if form.password2.help_text %}
<p class="help">{{ form.password2.help_text|safe }}</p> <div class="help">{{ form.password2.help_text|safe }}</div>
{% endif %} {% endif %}
</div> </div>

View File

@ -20,7 +20,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if field.field.help_text %} {% if field.field.help_text %}
<p class="help">{{ field.field.help_text|safe }}</p> <div class="help">{{ field.field.help_text|safe }}</div>
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}

View File

@ -36,7 +36,7 @@
{{ form.new_password1.errors }} {{ form.new_password1.errors }}
{{ form.new_password1.label_tag }} {{ form.new_password1 }} {{ form.new_password1.label_tag }} {{ form.new_password1 }}
{% if form.new_password1.help_text %} {% if form.new_password1.help_text %}
<p class="help">{{ form.new_password1.help_text|safe }}</p> <div class="help">{{ form.new_password1.help_text|safe }}</div>
{% endif %} {% endif %}
</div> </div>
@ -44,7 +44,7 @@
{{ form.new_password2.errors }} {{ form.new_password2.errors }}
{{ form.new_password2.label_tag }} {{ form.new_password2 }} {{ form.new_password2.label_tag }} {{ form.new_password2 }}
{% if form.new_password2.help_text %} {% if form.new_password2.help_text %}
<p class="help">{{ form.new_password2.help_text|safe }}</p> <div class="help">{{ form.new_password2.help_text|safe }}</div>
{% endif %} {% endif %}
</div> </div>

View File

@ -494,6 +494,9 @@ Miscellaneous
* ETags are now parsed according to the :rfc:`7232` Conditional Requests * ETags are now parsed according to the :rfc:`7232` Conditional Requests
specification rather than the syntax from :rfc:`2616`. specification rather than the syntax from :rfc:`2616`.
* In the admin templates, ``<p class="help">`` is replaced with a ``<div>`` tag
to allow including lists inside help text.
.. _deprecated-features-1.11: .. _deprecated-features-1.11:
Features deprecated in 1.11 Features deprecated in 1.11

View File

@ -158,7 +158,7 @@ class TestInline(TestDataMixin, TestCase):
Ref #8190. Ref #8190.
""" """
response = self.client.get(reverse('admin:admin_inlines_holder4_add')) response = self.client.get(reverse('admin:admin_inlines_holder4_add'))
self.assertContains(response, '<p class="help">Awesome stacked help text is awesome.</p>', 4) self.assertContains(response, '<div class="help">Awesome stacked help text is awesome.</div>', 4)
self.assertContains( self.assertContains(
response, response,
'<img src="/static/admin/img/icon-unknown.svg" ' '<img src="/static/admin/img/icon-unknown.svg" '

View File

@ -4608,20 +4608,20 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
self.assertContains(response, '<div class="form-row field-posted">') self.assertContains(response, '<div class="form-row field-posted">')
self.assertContains(response, '<div class="form-row field-value">') self.assertContains(response, '<div class="form-row field-value">')
self.assertContains(response, '<div class="form-row">') self.assertContains(response, '<div class="form-row">')
self.assertContains(response, '<p class="help">', 3) self.assertContains(response, '<div class="help">', 3)
self.assertContains( self.assertContains(
response, response,
'<p class="help">Some help text for the title (with unicode ŠĐĆŽćžšđ)</p>', '<div class="help">Some help text for the title (with unicode ŠĐĆŽćžšđ)</div>',
html=True html=True
) )
self.assertContains( self.assertContains(
response, response,
'<p class="help">Some help text for the content (with unicode ŠĐĆŽćžšđ)</p>', '<div class="help">Some help text for the content (with unicode ŠĐĆŽćžšđ)</div>',
html=True html=True
) )
self.assertContains( self.assertContains(
response, response,
'<p class="help">Some help text for the date (with unicode ŠĐĆŽćžšđ)</p>', '<div class="help">Some help text for the date (with unicode ŠĐĆŽćžšđ)</div>',
html=True html=True
) )
@ -4724,7 +4724,7 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
""" """
p = FieldOverridePost.objects.create(title="Test Post", content="Test Content") p = FieldOverridePost.objects.create(title="Test Post", content="Test Content")
response = self.client.get(reverse('admin:admin_views_fieldoverridepost_change', args=(p.pk,))) response = self.client.get(reverse('admin:admin_views_fieldoverridepost_change', args=(p.pk,)))
self.assertContains(response, '<p class="help">Overridden help text for the date</p>') self.assertContains(response, '<div class="help">Overridden help text for the date</div>')
self.assertContains(response, '<label for="id_public">Overridden public label:</label>', html=True) self.assertContains(response, '<label for="id_public">Overridden public label:</label>', html=True)
self.assertNotContains(response, "Some help text for the date (with unicode ŠĐĆŽćžšđ)") self.assertNotContains(response, "Some help text for the date (with unicode ŠĐĆŽćžšđ)")

View File

@ -1222,7 +1222,7 @@ class AdminRawIdWidgetSeleniumTests(AdminWidgetSeleniumTestCase):
# Help text for the field is displayed # Help text for the field is displayed
self.assertEqual( self.assertEqual(
self.selenium.find_element_by_css_selector('.field-supporting_bands p.help').text, self.selenium.find_element_by_css_selector('.field-supporting_bands div.help').text,
'Supporting Bands.' 'Supporting Bands.'
) )