Projet

Général

Profil

0001-tipi-do-not-show-community-identifier-if-only-one-de.patch

Serghei Mihai (congés, retour 15/05), 10 septembre 2018 23:18

Télécharger (2,2 ko)

Voir les différences:

Subject: [PATCH] tipi: do not show community identifier if only one defined
 (#15461)

 combo/apps/lingo/templates/lingo/tipi_form.html | 4 ++++
 tests/test_lingo_cells.py                       | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
combo/apps/lingo/templates/lingo/tipi_form.html
8 8
    <ul class="errorlist" id="popup_warning" style="display: none">
9 9
      <li>{% trans "Your browser is blocking popups but they are required to start the payment, make sure they are allowed for this site." %}</li>
10 10
    </ul>
11
    {% if regies|length > 1 %}
11 12
    <p><label>{% trans "Community identifier" %}</label>
12 13
      <select id="numcli">
13 14
        {% for id in regies %}
......
15 16
        {% endfor %}
16 17
      </select>
17 18
    </p>
19
    {% else %}
20
    <input type="hidden" id="numcli" value="{{ regies.0 }}" />
21
    {% endif %}
18 22
    <ul class="errorlist" id="refdet_error" style="display: none">
19 23
      <li>{% trans "invalid reference" %}</li>
20 24
    </ul>
tests/test_lingo_cells.py
170 170
    assert cell.template_name == 'lingo/tipi_form.html'
171 171
    html = cell.render({})
172 172
    assert "<h2>TIPI Payment</h2>" in html
173
    assert "Community identifier" in html
173
    assert "Community identifier" not in html
174
    assert '<input type="hidden" id="numcli" value="test regie" />' in html
174 175
    assert 'id="exer"' in html
175 176
    assert 'id="idpce"' in html
176 177
    assert 'id="idligne"' in html
......
192 193

  
193 194
    cell_media = str(cell.media)
194 195
    assert "js/tipi.js" in cell_media
196

  
197
    cell.regies = 'regie1, regie2'
198
    cell.save()
199
    html = cell.render({})
200
    assert "Community identifier" in html
201
    assert '<select id="numcli">' in html
195
-