backoffice: display drafts stats (#72542)
gitea/wcs/pipeline/head There was a failure building this commit
Details
gitea/wcs/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
a6c0e8aa59
commit
1cd4659dff
|
@ -1760,6 +1760,23 @@ class FormDefPage(Directory, TempfileDirectoryMixin):
|
|||
f'{self.formdef.xml_root_node}:{self.formdef.id}'
|
||||
)
|
||||
context['deprecation_titles'] = deprecations.titles
|
||||
|
||||
temp_drafts = defaultdict(int)
|
||||
for formdata in self.formdef.data_class().select(clause=[Equal('status', 'draft')]):
|
||||
page_id = formdata.page_id if formdata.page_id is not None else '_unkown'
|
||||
temp_drafts[page_id] += 1
|
||||
temp_drafts['total'] += 1
|
||||
drafts = {}
|
||||
for page_id in temp_drafts.keys():
|
||||
if page_id in ('_unkown', '_confirmation_page', '_first_page'):
|
||||
drafts[page_id] = temp_drafts[page_id]
|
||||
continue
|
||||
for field in self.formdef.iter_fields(with_backoffice_fields=False):
|
||||
if page_id == page_id:
|
||||
drafts[page_id] = temp_drafts[page_id]
|
||||
break
|
||||
else:
|
||||
drafts['_unkown'] += temp_drafts[page_id]
|
||||
return template.QommonTemplateResponse(
|
||||
templates=[self.inspect_template_name],
|
||||
context=context,
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
<button role="tab" aria-selected="false" aria-controls="inspect-workflow" id="tab-workflow" tabindex="-1">{% trans "Workflow" %}</button>
|
||||
<button role="tab" aria-selected="false" aria-controls="inspect-options" id="tab-options" tabindex="-1">{% trans "Options" %}</button>
|
||||
<button role="tab" aria-selected="false" aria-controls="inspect-fields" id="tab-fields" tabindex="-1">{% trans "Fields" %}</button>
|
||||
{% if not snapshots_diff %}
|
||||
<button role="tab" aria-selected="false" aria-controls="inspect-drafts" id="tab-drafts" tabindex="-1">{% trans "Drafts" %}</button>
|
||||
{% endif %}
|
||||
{% if custom_views %}
|
||||
<button role="tab" aria-selected="false" aria-controls="inspect-customviews" id="tab-customviews" tabindex="-1">{% trans "Custom views" %}</button>
|
||||
{% endif %}
|
||||
|
@ -88,6 +91,16 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div id="inspect-drafts" role="tabpanel" tabindex="0" aria-labelledby="tab-drafts" hidden>
|
||||
<div class="pk-information page-field-counters"><p>
|
||||
{% blocktrans count page_count=formdef.page_count %}{{ page_count }} page{% plural %}{{ page_count }} pages{% endblocktrans %},
|
||||
{% blocktrans count fields_count=formdef.fields|count %}{{ fields_count }} field{% plural %}{{ fields_count }} fields{% endblocktrans %}.
|
||||
</p></div>
|
||||
{% for field in formdef.fields %}
|
||||
{% include "wcs/backoffice/includes/inspect-field.html" with path=formdef.get_admin_url|add:"fields/" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div id="inspect-customviews" role="tabpanel" tabindex="0" aria-labelledby="tab-customviews" hidden>
|
||||
<div>
|
||||
{% for custom_view in custom_views %}
|
||||
|
|
Loading…
Reference in New Issue