Projet

Général

Profil

0001-misc-add-foldable-cell-and-list-of-links-to-style-de.patch

Frédéric Péters, 20 janvier 2020 14:12

Télécharger (2,21 ko)

Voir les différences:

Subject: [PATCH] misc: add foldable cell and list of links to style demo page
 (#39112)

 combo/public/views.py | 13 +++++++++++++
 tests/test_public.py  |  5 +++++
 2 files changed, 18 insertions(+)
combo/public/views.py
343 343
                cell.text = '<h2>%s</h2>%s' % (
344 344
                        lorem_ipsum.words(3, common=False),
345 345
                        '\n'.join(['<p>%s</p>' % x for x in lorem_ipsum.paragraphs(3)]))
346
                if i == 1:
347
                    cell.extra_css_class = 'foldable'
348
                    cell.save()
346 349
            cell.save()
347 350

  
348 351
            if i == 0:
......
365 368
                                        _('Select'))
366 369
                cell.save()
367 370

  
371
            if i == 1:
372
                # add a list of links in second placeholder
373
                cell = TextCell(page=self.page, placeholder=placeholder.key, order=1)
374
                cell.text = '<h2>%s</h2><ul>' % _('Title')
375
                cell.extra_css_class = 'links-list'
376
                for i in range(5):
377
                    cell.text += '<li><a href="#">%s</a></li>' % lorem_ipsum.words(3, common=False)
378
                cell.text += '</ul>'
379
                cell.save()
380

  
368 381
        return self.page
369 382

  
370 383
    def __exit__(self, type, value, traceback):
tests/test_public.py
486 486
        assert TextCell.objects.count() == 0
487 487
        assert Page.objects.count() == 0
488 488

  
489
        resp = app.get('/__style__/?template=standard-sidebar', status=200)
490
        assert 'links-list' in resp.text
491
        assert Page.objects.count() == 0
492

  
493

  
489 494
def test_page_async_cell(app):
490 495
    Page.objects.all().delete()
491 496
    page = Page(title='Home', slug='index', template_name='standard')
492
-