wcs: hide page fields in card custom display form (#78629) #121

Merged
csechet merged 1 commits from wip/78629-cellules-fiches-on-peut-choisir into main 2023-07-17 17:17:40 +02:00
4 changed files with 4 additions and 3 deletions

View File

@ -93,7 +93,7 @@
{% else %}
<div class="cell--body" {{ cell|get_filter_attrs:card }}>
{% for field in schema.fields %}
{% if 'varname' in field and field.varname %}
{% if 'varname' in field and field.varname and field.type != 'page' %}
{% with card.fields|get:field.varname as value %}
<div class="card--auto-field">
<div class="label">{{ field.label }}</div>

View File

@ -631,7 +631,7 @@ Card_cell_custom.prototype = {
const varname_select = this.grid_cell_form.field_varname;
const link_select = this.grid_cell_form.link_page;
this.cardSchema.fields.forEach(function(el, id) {
if (el.varname) {
if (el.varname && el.type !== "page") {
$('<option />')
.attr('value', el.varname)
.text(el.label)

View File

@ -1732,6 +1732,7 @@ def test_card_cell_card_mode_render(mock_send, context, app):
mock_send.reset_mock()
result = cell.render(context)
assert '<h2>Card Model 1 - aa</h2>' in result
assert '<div class="label">Page</div>' not in result
assert PyQuery(result).find('.label:contains("Field A") + .value').text() == '<i>a</i>'
assert PyQuery(result).find('.label:contains("Field B") + .value').text() == 'yes'
assert PyQuery(result).find('.label:contains("Field C") + .value').text() == 'Sept. 28, 2020'

View File

@ -287,7 +287,7 @@ WCS_CARDDEF_SCHEMAS = {
{'label': 'Empty', 'varname': 'empty', 'type': 'string'},
{'label': 'Empty Email', 'varname': 'empty_email', 'type': 'email'},
{'label': 'Related', 'varname': 'related', 'type': 'item'},
{'label': 'Page', 'type': 'page'},
{'label': 'Page', 'type': 'page', 'varname': 'page'},
{'label': 'Comment', 'type': 'comment'},
{'label': 'Title', 'type': 'title'},
{'label': 'Subtitle', 'type': 'subtitle'},