wcs: do not mix category and form descriptions (#70349)
This commit is contained in:
parent
1d6c14ba80
commit
d31bfde62b
|
@ -676,7 +676,7 @@ class WcsFormsOfCategoryCell(WcsCommonCategoryCell, WcsBlurpMixin):
|
|||
return extra_context
|
||||
extra_context['slug'] = self.category_reference.split(':')[-1]
|
||||
extra_context['title'] = self.cached_title
|
||||
extra_context['description'] = self.cached_description
|
||||
extra_context['category_description'] = self.cached_description
|
||||
try:
|
||||
extra_context['forms'] = list(extra_context['forms'][self.wcs_site]['data'])
|
||||
except (KeyError, TypeError):
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
{% block cell-header %}
|
||||
<h2>{{ title }}</h2>
|
||||
{% include "combo/asset_picture_fragment.html" %}
|
||||
{% if description %}
|
||||
{% if category_description %}
|
||||
<div class="intro">
|
||||
{{ description|safe }}
|
||||
{{ category_description|safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -160,6 +160,19 @@ def test_category_cell_save_cache(mock_send):
|
|||
assert cell.get_additional_label() == 'Test 3'
|
||||
|
||||
|
||||
@mock.patch('requests.Session.send', side_effect=mocked_requests_send)
|
||||
def test_category_cell_render(mock_send):
|
||||
page = Page(title='xxx', slug='test_category_cell_save_cache', template_name='standard')
|
||||
page.save()
|
||||
cell = WcsCategoryCell(page=page, placeholder='content', order=0, category_reference='default:test-3')
|
||||
cell.save()
|
||||
|
||||
context = {'synchronous': True} # to get fresh content
|
||||
result = cell.render(context)
|
||||
assert "Test 3" in result
|
||||
assert "category 3 description" in result
|
||||
|
||||
|
||||
@mock.patch('requests.Session.send', side_effect=mocked_requests_send)
|
||||
def test_category_cell_validity(mock_send):
|
||||
page = Page.objects.create(title='xxx', slug='test_category_cell_save_cache', template_name='standard')
|
||||
|
@ -874,6 +887,7 @@ def test_forms_of_category_cell_render(mock_send, context):
|
|||
assert 'keyword-foo' in result
|
||||
assert 'keyword-bar' in result
|
||||
assert '<p>a form description</p>' in result
|
||||
assert '<p>category 9 description</p>' not in result
|
||||
|
||||
cell.ordering = 'popularity'
|
||||
cell.save()
|
||||
|
|
|
@ -18,7 +18,13 @@ WCS_FORMDEFS_DATA = [
|
|||
]
|
||||
|
||||
WCS_CATEGORIES_DATA = [
|
||||
{'slug': 'test-%s' % i, 'title': 'Test %s' % i, 'url': '/test-%s/' % i} for i in [3, 9]
|
||||
{
|
||||
'slug': 'test-%s' % i,
|
||||
'title': 'Test %s' % i,
|
||||
'url': '/test-%s/' % i,
|
||||
'description': 'category %s description' % i,
|
||||
}
|
||||
for i in [3, 9]
|
||||
]
|
||||
|
||||
WCS_CATEGORIES_FORMDEFS_DATA = [
|
||||
|
|
Loading…
Reference in New Issue