{% extends "base.html" %} {% block title %}{% if file %}Edytuj Hosts File{% else %}Nowy Hosts File{% endif %} - /etc/hosts Manager{% endblock %} {% block extra_css %} {{ super() }} <style> .tooltip-inner { max-width: 300px; text-align: left; } </style> {% endblock %} {% block content %} <div class="card mb-4"> <div class="card-header"> <h2>{% if file %}Edytuj Hosts File{% else %}Nowy Hosts File{% endif %}</h2> </div> <div class="card-body"> <form method="POST"> <div class="mb-3"> <label for="title" class="form-label">Tytuł</label> <input type="text" class="form-control" id="title" name="title" value="{% if file %}{{ file.title }}{% endif %}" required> </div> <div class="mb-3"> <label for="content" class="form-label">Treść</label> <textarea class="form-control" id="content" name="content" rows="10" required>{% if file %}{{ file.content }}{% endif %}</textarea> </div> <button type="submit" class="btn btn-primary">{% if file %}Zapisz zmiany{% else %}Utwórz{% endif %}</button> </form> </div> </div> {% if file %} <!-- Sekcja zarządzania wersjami --> <div class="card mb-4"> <div class="card-header"> <h3>Wersje pliku /etc/hosts</h3> </div> <div class="card-body"> <p>Przeglądaj historię zmian, porównaj aktualną zawartość z najnowszą wersją zapisanej historii lub usuń stare wersje.</p> <a href="{{ url_for('hostfile_versions', hostfile_id=file.id) }}" class="btn btn-info">Historia wersji</a> <a href="{{ url_for('delete_old_versions', hostfile_id=file.id, days=30) }}" class="btn btn-secondary" onclick="return confirm('Usuń wersje starsze niż 30 dni?');">Usuń wersje starsze niż 30 dni</a> {% if file.versions|length > 0 %} <a href="{{ url_for('diff_current_hostfile', hostfile_id=file.id) }}" class="btn btn-warning" onclick="return confirm('Porównaj aktualną zawartość z najnowszą wersją zapisanej historii?');">Diff aktualny vs. ostatnia kopia</a> {% endif %} </div> </div> {% endif %} <div class="mt-3 text-center"> <a href="{{ url_for('list_hosts_files') }}" class="btn btn-secondary">Lista Hosts Files</a> </div> {% endblock %}