Files
crm.clientright.ru/test_edit_button_simple.html

77 lines
3.3 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Простой тест кнопки редактирования</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body { font-family: Arial, sans-serif; padding: 20px; }
.btn { padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; margin: 5px; text-decoration: none; display: inline-block; }
.btn-primary { background: #007bff; color: white; }
.btn-default { background: #6c757d; color: white; }
.btn:hover { opacity: 0.8; }
</style>
</head>
<body>
<h1>🧪 Простой тест кнопки "Редактировать"</h1>
<p>Имитация интерфейса FilePreview с кнопкой редактирования:</p>
<div style="border: 1px solid #ccc; padding: 20px; background: #f9f9f9;">
<h3><b>test_document.docx</b></h3>
<a class="btn btn-default" href="#">Скачать файл</a>
<button class="btn btn-primary" onclick="testEditButton('12345', 'test_document.docx')" title="Редактировать в Nextcloud">
<i class="fa fa-edit"></i> Редактировать
</button>
</div>
<div id="log" style="background: #f0f0f0; padding: 15px; margin-top: 20px; border-radius: 5px; font-family: monospace; min-height: 100px;"></div>
<script>
function addLog(message) {
const log = document.getElementById('log');
const timestamp = new Date().toLocaleTimeString();
log.textContent += `[${timestamp}] ${message}\n`;
}
function testEditButton(recordId, fileName) {
addLog('🧪 Кнопка "Редактировать" нажата!');
addLog('Record ID: ' + recordId);
addLog('File Name: ' + fileName);
alert('✅ Кнопка работает!\n\nRecord ID: ' + recordId + '\nFile Name: ' + fileName);
// Проверяем есть ли наша функция
if (typeof openNextcloudEditor === 'function') {
addLog('✅ Функция openNextcloudEditor найдена');
openNextcloudEditor(recordId, fileName);
} else {
addLog('❌ Функция openNextcloudEditor НЕ найдена');
}
}
document.addEventListener('DOMContentLoaded', function() {
addLog('Страница загружена');
addLog('Готов к тестированию кнопки');
});
</script>
<!-- Пробуем подключить наш JavaScript -->
<script src="crm_extensions/nextcloud_editor/js/nextcloud-editor.js"></script>
<script>
// Проверяем загрузился ли наш скрипт
setTimeout(function() {
if (typeof openNextcloudEditor === 'function') {
addLog('✅ nextcloud-editor.js загружен успешно');
} else {
addLog('❌ nextcloud-editor.js НЕ загружен');
}
}, 1000);
</script>
</body>
</html>