refactor: extract inline CSS/JS from views into separate asset files (20+ files)
Phase A — HTML removed from PHP files: - RateLimitMiddleware.php: heredoc moved to views/errors/429.php - public/index.php: inline HTML replaced with View::error() - AuthMiddleware.php: <script> redirect replaced with <meta refresh> Phase B — Inline CSS/JS extracted from views: - CSS: landing.css (459 lines), legal.css (shared by terms+privacy) - JS: 17 new files extracted from ~20 view files - main.js (layout sidebar + notifications) - dashboard-chart.js, server-show.js, server-services.js - nginx-manager.js, database-manager.js - terminal.js, team-show.js, team-index.js - server-list.js, server-permissions.js (shared by edit+create) - server-ssl.js, server-processes.js, system-users.js - admin-users.js, audit-log.js, admin-notifications.js, admin-security.js - notifications.js Total: -3264 lines from views, +288 lines in new assets
This commit is contained in:
@@ -71,66 +71,4 @@
|
||||
<input type="hidden" name="_csrf_token" value="<?= $this->csrfToken() ?>">
|
||||
</form>
|
||||
|
||||
<script>
|
||||
const allCards = document.querySelectorAll('.team-card');
|
||||
|
||||
function filterTeams(query) {
|
||||
const q = query.toLowerCase().trim();
|
||||
const grid = document.getElementById('teamsGrid');
|
||||
const empty = document.getElementById('emptyState');
|
||||
const clearBtn = document.getElementById('searchClear');
|
||||
let visible = 0;
|
||||
|
||||
clearBtn.style.display = q ? 'block' : 'none';
|
||||
|
||||
if (grid) {
|
||||
allCards.forEach(function(card) {
|
||||
const name = card.dataset.name || '';
|
||||
const desc = card.dataset.desc || '';
|
||||
const match = !q || name.includes(q) || desc.includes(q);
|
||||
card.style.display = match ? '' : 'none';
|
||||
if (match) visible++;
|
||||
});
|
||||
|
||||
if (visible === 0) {
|
||||
if (!empty) {
|
||||
const container = document.getElementById('teamsContainer');
|
||||
const div = document.createElement('div');
|
||||
div.className = 'empty-state';
|
||||
div.id = 'emptyState';
|
||||
div.innerHTML = '<i class="fas fa-users-cog"></i><p>No teams match your search.</p>';
|
||||
container.appendChild(div);
|
||||
} else {
|
||||
empty.querySelector('p').textContent = 'No teams match your search.';
|
||||
empty.style.display = '';
|
||||
}
|
||||
} else {
|
||||
if (empty) empty.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
// Update URL without reload
|
||||
const url = q ? '?search=' + encodeURIComponent(query) : window.location.pathname;
|
||||
window.history.replaceState({}, '', url);
|
||||
}
|
||||
|
||||
document.getElementById('teamSearch')?.addEventListener('input', function() {
|
||||
filterTeams(this.value);
|
||||
});
|
||||
|
||||
// Restore search on page load
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const searchInput = document.getElementById('teamSearch');
|
||||
if (searchInput && searchInput.value) {
|
||||
filterTeams(searchInput.value);
|
||||
}
|
||||
});
|
||||
|
||||
function deleteTeam(id, name) {
|
||||
if (confirm('Delete team "' + name + '"?\nThis will remove access for all members.')) {
|
||||
const form = document.getElementById('deleteForm');
|
||||
form.action = '/teams/' + id + '/delete';
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="/assets/js/team-index.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user