Projet

Général

Profil

0001-card-cell-display-customize-content-layout-52073.patch

Thomas Jund, 15 juin 2021 19:20

Télécharger (2,52 ko)

Voir les différences:

Subject: [PATCH] card cell: display customize content layout (#52073)

 combo/apps/wcs/templates/combo/wcs/card.html | 50 +++++++++++++++++++-
 1 file changed, 48 insertions(+), 2 deletions(-)
combo/apps/wcs/templates/combo/wcs/card.html
9 9
{% endblock %}
10 10

  
11 11
{% if card %}
12
<div>
12
<div class="cell--body">
13
{% if cell.custom_schema %}
14
  <div class="{{ cell.custom_schema.grid_class }}">
15
    {% for item in cell.custom_schema.cells %}
16
      <div class="{{ item.cell_size|default:"" }}">
17
        {% for field in schema.fields %}
18
          {% if field.varname == item.varname %}
19
          {% with card.fields|get:item.varname as value %}
20
            {% for display in item.display %}
21
              {% if display == "title" %}
22
                <h3>
23
                  {% if field.type == "date" %}
24
                    {{ value|date }}
25
                  {% elif field.type == "bool" and value is not None %}
26
                    {{ value|yesno }}
27
                  {% else %}
28
                    {{ value|default:"" }}
29
                  {% endif %}
30
                </h3>
31
              {% endif %}
32
              {% if display == "key" %}
33
                <p class="label">{{ field.label }}</p>
34
              {% endif %}
35
              {% if display == "value" %}
36
                <p class="value">
37
                  {% if field.type == "date" %}
38
                    {{ value|date }}
39
                  {% elif field.type == "bool" and value is not None %}
40
                    {{ value|yesno }}
41
                  {% else %}
42
                    {{ value|default:"" }}
43
                  {% endif %}
44
                </p>
45
              {% endif %}
46
            {% endfor %}
47
          {% endwith %}
48
          {% endif %}
49
        {% endfor%}
50
      </div>
51
    {% endfor%}
52
  </div>
53

  
54
{% else %}
13 55
{% for field in schema.fields %}
14 56
  {% if 'varname' in field and field.varname and field.type != 'file' %}
15 57
  {% with card.fields|get:field.varname as value %}
......
26 68
  {% endwith %}
27 69
  {% endif %}
28 70
{% endfor %}
71
{% endif %}
72

  
29 73
{% else %}
30
<p>{% trans 'Unknown Card' %}</p>
74
<div class="cell--body">
75
  <p>{% trans 'Unknown Card' %}</p>
76
</div>
31 77
{% endif %}
32 78
</div>
33 79
</div>
34
-