Skip to content

Commit

Permalink
include links to provision editor on overview, restrict to reviewers
Browse files Browse the repository at this point in the history
  • Loading branch information
goose-life committed Jan 23, 2025
1 parent 7faf6b8 commit 24a1941
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ <h6 class="timeline-date">{{ entry.date|date:"Y-m-d" }}</h6>
<div class="ms-4">{{ task.description|linebreaks|urlize }}</div>
{% endfor %}
</div>
{% if perms.indigo_api.publish_document %}
<div class="mt-1 ms-1">
{% for document in entry.expressions %}
<div>
<i class="fas fa-list published"></i> <a href="{% url 'choose_document_provision' doc_id=document.id %}">{% trans "Provision editor" %}</a> · {{ document.language }}
</div>
{% endfor %}
</div>
{% endif %}
</div>

{% if editable and entry.create_import_document %}
Expand Down
8 changes: 2 additions & 6 deletions indigo_app/views/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class ChooseDocumentProvisionView(AbstractAuthedIndigoView, DetailView):
context_object_name = 'document'
pk_url_kwarg = 'doc_id'
template_name = 'indigo_api/document/_provisions.html'
permission_required = ('indigo_api.publish_document',)

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
Expand All @@ -119,13 +120,11 @@ def descend_toc_dict(items):
elem['href'] = reverse('document_provision', kwargs={'doc_id': int(self.kwargs['doc_id']), 'eid': elem['id']})
return json.dumps(toc)

def has_permission(self):
return self.request.user.is_superuser


class DocumentProvisionDetailView(DocumentDetailView):
eid = None
provision_xml = None
permission_required = ('indigo_api.publish_document',)

def get(self, request, *args, **kwargs):
document = self.get_object()
Expand All @@ -144,9 +143,6 @@ def get_context_data(self, **kwargs):
def get_document_content_json(self, document):
return json.dumps(etree.tostring(self.provision_xml, encoding='unicode'))

def has_permission(self):
return self.request.user.is_superuser


class DocumentPopupView(AbstractAuthedIndigoView, DetailView):
model = Document
Expand Down

0 comments on commit 24a1941

Please sign in to comment.