Projet

Général

Profil

0001-admin-style-data-source-page-with-sections-45796.patch

Frédéric Péters, 10 août 2020 09:56

Télécharger (2,5 ko)

Voir les différences:

Subject: [PATCH 1/2] admin: style data source page with sections (#45796)

 wcs/admin/data_sources.py                      |  3 ---
 wcs/templates/wcs/backoffice/data-sources.html | 18 ++++++++++++++++--
 2 files changed, 16 insertions(+), 5 deletions(-)
wcs/admin/data_sources.py
186 186
        if not items:
187 187
            return ''
188 188
        r = TemplateIO(html=True)
189
        r += htmltext('<h3>%s</h3>') % _('Preview (first items only)')
190
        r += htmltext('<div class="bo-block data-source-preview">')
191 189
        r += htmltext('<ul>')
192 190
        additional_keys = set()
193 191
        for item in items[:10]:
......
210 208
        if additional_keys:
211 209
            r += htmltext('<p>%s %s</p>') % (_('Additional keys are available:'),
212 210
                    ', '.join(sorted(additional_keys)))
213
        r += htmltext('</div>')
214 211
        return r.getvalue()
215 212

  
216 213
    def edit(self):
wcs/templates/wcs/backoffice/data-sources.html
15 15
{% endif %}
16 16

  
17 17
{% if datasource.data_source %}
18
<div class="section">
18 19
<h3>{% trans "Configuration" %}</h3>
19 20
<ul>
20 21
  <li>{% trans "Type of source:" %} {{ datasource.type_label }}</li>
......
27 28
  <li>{% trans "Cache Duration:" %} {{ datasource.humanized_cache_duration }}
28 29
  {% endif %}
29 30
</ul>
30
{{ view.preview_block|safe }}
31
</div>
32

  
33
{% with preview_block=view.preview_block %}
34
{% if preview_block %}
35
  <div class="section">
36
  <h3>{% trans "Preview (first items only)" %}</h3>
37
  <div class="data-source-preview">
38
  {{ view.preview_block|safe }}
39
  </div>
40
  </div>
41
{% endif %}
42
{% endwith %}
31 43

  
32 44
{% with formdefs=view.usage_in_formdefs %}
33 45
  {% if formdefs %}
46
  <div class="section">
34 47
  <h3>{% trans "Usage in forms" %}</h3>
35
  <ul class="biglist">
48
  <ul class="objects-list single-links">
36 49
  {% for formdef in formdefs %}
37 50
    <li><a href="{{ formdef.get_admin_url }}">{{ formdef.name }}</a></li>
38 51
  {% endfor %}
39 52
  </ul>
53
  </div>
40 54
  {% endif %}
41 55
{% endwith %}
42 56

  
43
-