f41fefbaa7
- ConnectorConfig(onlyoffice) + миграция, подсказка по extra_config в админке. - /documents/onlyoffice/ в whitelist 2FA — Document Server забирает файл без сессии портала (доступ по подписанному file-token + JWT DS). - Страница редактора и кнопки «открыть в OnlyOffice» в браузере документов. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
37 lines
1.8 KiB
HTML
37 lines
1.8 KiB
HTML
{% load i18n %}
|
||
<div class="page-content" style="display:flex; flex-direction:column; min-height:calc(100vh - 8rem);">
|
||
|
||
<div style="display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:0.75rem; margin-bottom:0.75rem;">
|
||
<div>
|
||
<h1 style="font-size:1.125rem; font-weight:500; margin:0;">{{ filename }}</h1>
|
||
<p style="font-size:0.75rem; color:var(--color-muted-foreground); margin:0.25rem 0 0;">
|
||
{% if mode == 'edit' %}{% trans "Редактирование в OnlyOffice" %}{% else %}{% trans "Просмотр в OnlyOffice" %}{% endif %}
|
||
</p>
|
||
</div>
|
||
{% if back.kind == 'pharmacy' %}
|
||
<a href="/pharmacies/{{ back.pharmacy_id }}/"
|
||
class="btn btn-secondary" style="text-decoration:none;">{% trans "К аптеке" %}</a>
|
||
{% else %}
|
||
<a href="/documents/"
|
||
hx-get="/documents/" hx-target="#main-content" hx-push-url="/documents/" hx-indicator="#loader"
|
||
class="btn btn-secondary" style="text-decoration:none;">{% trans "К документам" %}</a>
|
||
{% endif %}
|
||
</div>
|
||
|
||
<div id="onlyoffice-editor"
|
||
style="flex:1; min-height:70vh; border:1px solid var(--color-border); border-radius:0.75rem; overflow:hidden; background:var(--color-card);"></div>
|
||
</div>
|
||
|
||
<script src="{{ api_js }}"></script>
|
||
<script>
|
||
(function () {
|
||
var cfg = {{ editor_config|safe }};
|
||
if (typeof DocsAPI === 'undefined') {
|
||
document.getElementById('onlyoffice-editor').innerHTML =
|
||
'<p style="padding:1.25rem; font-size:0.875rem; color:#d63333;">Не удалось загрузить OnlyOffice. Проверьте хост Document Server.</p>';
|
||
return;
|
||
}
|
||
new DocsAPI.DocEditor('onlyoffice-editor', cfg);
|
||
})();
|
||
</script>
|