Skip to content
Snippets Groups Projects
Commit c18e4779 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch '10-button-create-live-document-does-nothing' into 'master'

Resolve "Button "Create live document" does nothing"

Closes #10

See merge request AlekSIS/official/AlekSIS-App-Resint!36
parents 7ed0d381 82582c6c
No related branches found
No related tags found
1 merge request!36Resolve "Button "Create live document" does nothing"
Pipeline #49592 canceled
......@@ -18,6 +18,7 @@ Fixed
~~~~~
* Live documents table showed two "Actions" columns.
* Button for creation of live documents was there even if there weren't any live document types registered.
`2.0`_ - 2021-12-27
-------------------
......
......@@ -9,21 +9,28 @@
{% block page_title %}{% blocktrans %}Live documents{% endblocktrans %}{% endblock %}
{% block content %}
<a class="btn green waves-effect waves-light dropdown-trigger" href="#" data-target="widget-dropdown">
<i class="material-icons left">add</i>
{% trans "Create live document" %}
</a>
{% if document_types %}
<a class="btn green waves-effect waves-light dropdown-trigger" href="#" data-target="widget-dropdown">
<i class="material-icons left">add</i>
{% trans "Create live document" %}
</a>
<ul id="widget-dropdown" class="dropdown-content">
{% for ct, model in widget_types %}
<li>
<a href="{% url 'create_live_document' ct.app_label ct.model %}">
{% verbose_name_object model as widget_name %}
{% blocktrans with name=widget_name %}Create {{ name }}{% endblocktrans %}
</a>
</li>
{% endfor %}
</ul>
<ul id="widget-dropdown" class="dropdown-content">
{% for ct, model in document_types %}
<li>
<a href="{% url 'create_live_document' ct.app_label ct.model %}">
{% verbose_name_object model as document_name %}
{% blocktrans with name=document_name %}Create {{ name }}{% endblocktrans %}
</a>
</li>
{% endfor %}
</ul>
{% else %}
<figure class="alert primary">
<i class="material-icons left">info</i>
{% trans "There is no app installed which registers any live document types." %}
</figure>
{% endif %}
{% render_table table %}
{% endblock %}
......@@ -160,7 +160,7 @@ class LiveDocumentListView(PermissionRequiredMixin, SingleTableView):
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
context = super().get_context_data(**kwargs)
context["widget_types"] = [
context["document_types"] = [
(ContentType.objects.get_for_model(m, False), m) for m in LiveDocument.__subclasses__()
]
return context
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment