tipi: do not show community identifier if only one defined (#15461)

This commit is contained in:
Serghei Mihai 2018-09-10 22:50:52 +02:00
parent 67e01e65b2
commit 83cba8d3a5
2 changed files with 12 additions and 1 deletions

View File

@ -8,6 +8,7 @@
<ul class="errorlist" id="popup_warning" style="display: none">
<li>{% trans "Your browser is blocking popups but they are required to start the payment, make sure they are allowed for this site." %}</li>
</ul>
{% if regies|length > 1 %}
<p><label>{% trans "Community identifier" %}</label>
<select id="numcli">
{% for id in regies %}
@ -15,6 +16,9 @@
{% endfor %}
</select>
</p>
{% else %}
<input type="hidden" id="numcli" value="{{ regies.0 }}" />
{% endif %}
<ul class="errorlist" id="refdet_error" style="display: none">
<li>{% trans "invalid reference" %}</li>
</ul>

View File

@ -170,7 +170,8 @@ def test_tipi_cell():
assert cell.template_name == 'lingo/tipi_form.html'
html = cell.render({})
assert "<h2>TIPI Payment</h2>" in html
assert "Community identifier" in html
assert "Community identifier" not in html
assert '<input type="hidden" id="numcli" value="test regie" />' in html
assert 'id="exer"' in html
assert 'id="idpce"' in html
assert 'id="idligne"' in html
@ -192,3 +193,9 @@ def test_tipi_cell():
cell_media = str(cell.media)
assert "js/tipi.js" in cell_media
cell.regies = 'regie1, regie2'
cell.save()
html = cell.render({})
assert "Community identifier" in html
assert '<select id="numcli">' in html