Projet

Général

Profil

0001-backoffice-display-demand-name-and-digest-if-availab.patch

Serghei Mihai, 18 décembre 2018 12:14

Télécharger (2,24 ko)

Voir les différences:

Subject: [PATCH] backoffice: display demand name and digest if available
 (#29120)

 tests/test_backoffice_pages.py | 16 ++++++++++++++++
 wcs/forms/common.py            |  5 +++++
 2 files changed, 21 insertions(+)
tests/test_backoffice_pages.py
1271 1271
    assert 'data-init-lng="2.32"' in resp.body
1272 1272
    assert 'data-init-lat="48.83' in resp.body
1273 1273

  
1274
def test_backoffice_formdata_name_with_digest(pub):
1275
    create_user(pub)
1276
    create_environment(pub)
1277
    formdef = FormDef.get_by_urlname('form-title')
1278
    data_class = formdef.data_class()
1279
    demand = [x for x in data_class.select()][0]
1280
    demand_name = data_class.get(demand.id).get_display_name()
1281

  
1282
    app = login(get_app(pub))
1283
    resp = app.get('/backoffice/management/form-title/%s/' % demand.id)
1284
    assert '<div id="appbar"><h2>%s</h2></div>' % demand_name in resp.body
1285
    formdef.digest_template = 'XYZ'
1286
    data_class.get(demand.id).store()
1287
    resp = app.get('/backoffice/management/form-title/%s/' % demand.id)
1288
    assert '<div id="appbar"><h2>%s (XYZ)</h2></div>' % demand_name in resp.body
1289

  
1274 1290
def test_backoffice_info_text(pub):
1275 1291
    create_user(pub)
1276 1292
    create_environment(pub)
wcs/forms/common.py
315 315
        klasses = 'foldable'
316 316
        if folded:
317 317
            klasses += ' folded'
318
        if get_request().is_in_backoffice():
319
            r += htmltext('<div id="appbar"><h2>%s' % self.formdata.get_display_name())
320
            if self.formdata.digest:
321
                r += htmltext(' (%s)' % self.formdata.digest)
322
            r += htmltext('</h2></div>')
318 323
        r += htmltext('<div class="section %s" id="summary">' % klasses)
319 324
        r += htmltext('<h2>%s</h2>') % _('Summary')
320 325
        r += htmltext('<div class="dataview">')
321
-