wcs: fix cards list css class (#56029)
gitea-wip/combo/pipeline/head There was a failure building this commit Details
gitea/combo/pipeline/head Build started... Details

This commit is contained in:
Lauréline Guérin 2021-08-10 10:48:55 +02:00
parent 7c1821ce35
commit fe64a49258
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
3 changed files with 6 additions and 1 deletions

View File

@ -843,6 +843,9 @@ class WcsCardsCell(CardMixin, WcsBlurpMixin, CellBase):
populate_cache()
def card_slug(self):
return self.carddef_reference.split(':')[1]
def is_visible(self, **kwargs):
user = kwargs.get('user')
if self.only_for_user and (not user or user.is_anonymous):

View File

@ -8,7 +8,7 @@
{% endblock %}
{% if cards %}
<div class="links-list cards-{{ slug }} list-of-cards">
<div class="links-list cards-{{ cell.card_slug }} list-of-cards">
<ul>
{% for data in cards %}
<li>

View File

@ -1394,9 +1394,11 @@ def test_cards_cell_render(mock_send, context):
result = cell.render(context)
context['synchronous'] = True # to get fresh content
context['cell'] = cell
result = cell.render(context)
assert '<h2>Card Model 1</h2>' in result
assert 'cards-card_model_1' in result
assert (
'<a href="http://127.0.0.1:8999/backoffice/data/card_model_1/11/"><span class="card-title">aa</span></a>'
in result