52 lines
2.0 KiB
HTML
52 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>File Upload and Git Commit</title>
|
|
<!-- jQuery -->
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
<!-- Tailwind CSS -->
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
</head>
|
|
<body class="bg-gray-100 flex items-center justify-center min-h-screen">
|
|
<div class="bg-white p-8 rounded shadow-md w-full max-w-md">
|
|
<h1 class="text-2xl font-bold mb-6">Upload sys02.lib</h1>
|
|
<form id="uploadForm">
|
|
<div class="mb-4">
|
|
<label class="block text-gray-700">Select file (must be sys02.lib):</label>
|
|
<input type="file" name="file" class="mt-1 p-2 border border-gray-300 rounded w-full" required>
|
|
</div>
|
|
<div class="mb-4">
|
|
<label class="block text-gray-700">Commit Message (cislo noveho protokolu nebo jiny popis):</label>
|
|
<input type="text" name="commit_msg" class="mt-1 p-2 border border-gray-300 rounded w-full" placeholder="Enter commit message" required>
|
|
</div>
|
|
<button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Submit</button>
|
|
</form>
|
|
<div id="result" class="mt-4"></div>
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function () {
|
|
$('#uploadForm').on('submit', function (e) {
|
|
e.preventDefault();
|
|
var formData = new FormData(this);
|
|
$.ajax({
|
|
url: '/upload',
|
|
type: 'POST',
|
|
data: formData,
|
|
processData: false,
|
|
contentType: false,
|
|
success: function (response) {
|
|
$('#result').html('<p class="text-green-600">' + response.message + '</p>');
|
|
},
|
|
error: function (xhr) {
|
|
var error = (xhr.responseJSON && xhr.responseJSON.error) ? xhr.responseJSON.error : 'An error occurred';
|
|
$('#result').html('<p class="text-red-600">' + error + '</p>');
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |