Complete v2.0 transformation: Production-ready Flask application
Major Changes: - Migrated from prototype to production architecture - Implemented modular Flask app with models/services/web layers - Added Docker containerization with docker-compose - Switched to Pipenv for dependency management - Built advanced parser extracting 63 real activities from INDEX_MASTER - Implemented SQLite FTS5 full-text search - Created minimalist, responsive web interface - Added comprehensive documentation and deployment guides Technical Improvements: - Clean separation of concerns (models, services, web) - Enhanced database schema with FTS5 indexing - Dynamic filters populated from real data - Production-ready configuration management - Security best practices implementation - Health monitoring and API endpoints Removed Legacy Files: - Old src/ directory structure - Static requirements.txt (replaced by Pipfile) - Test and debug files - Temporary cache files Current Status: - 63 activities indexed across 8 categories - Full-text search operational - Docker deployment ready - Production documentation complete 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
24
app/templates/404.html
Normal file
24
app/templates/404.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Pagină nu a fost găsită - INDEX Sistem Jocuri{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="error-page">
|
||||
<div class="error-content">
|
||||
<h1 class="error-title">404</h1>
|
||||
<h2 class="error-subtitle">Pagina nu a fost găsită</h2>
|
||||
<p class="error-message">
|
||||
Ne pare rău, dar pagina pe care o căutați nu există sau a fost mutată.
|
||||
</p>
|
||||
|
||||
<div class="error-actions">
|
||||
<a href="{{ url_for('main.index') }}" class="btn btn-primary">
|
||||
Întoarce-te la căutare
|
||||
</a>
|
||||
<a href="javascript:history.back()" class="btn btn-secondary">
|
||||
Pagina anterioară
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
24
app/templates/500.html
Normal file
24
app/templates/500.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Eroare server - INDEX Sistem Jocuri{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="error-page">
|
||||
<div class="error-content">
|
||||
<h1 class="error-title">500</h1>
|
||||
<h2 class="error-subtitle">Eroare internă server</h2>
|
||||
<p class="error-message">
|
||||
A apărut o eroare neașteptată. Echipa noastră a fost notificată și lucrează pentru a rezolva problema.
|
||||
</p>
|
||||
|
||||
<div class="error-actions">
|
||||
<a href="{{ url_for('main.index') }}" class="btn btn-primary">
|
||||
Întoarce-te la căutare
|
||||
</a>
|
||||
<a href="javascript:location.reload()" class="btn btn-secondary">
|
||||
Reîncarcă pagina
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
196
app/templates/activity.html
Normal file
196
app/templates/activity.html
Normal file
@@ -0,0 +1,196 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ activity.name }} - INDEX Sistem Jocuri{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="activity-detail-page">
|
||||
<!-- Breadcrumb navigation -->
|
||||
<nav class="breadcrumb">
|
||||
<a href="{{ url_for('main.index') }}">Căutare</a>
|
||||
<span class="breadcrumb-separator">»</span>
|
||||
<span class="breadcrumb-current">{{ activity.name }}</span>
|
||||
</nav>
|
||||
|
||||
<!-- Activity header -->
|
||||
<header class="activity-detail-header">
|
||||
<div class="activity-title-section">
|
||||
<h1 class="activity-detail-title">{{ activity.name }}</h1>
|
||||
<span class="activity-category-badge">{{ activity.category }}</span>
|
||||
</div>
|
||||
|
||||
{% if activity.subcategory %}
|
||||
<p class="activity-subcategory">{{ activity.subcategory }}</p>
|
||||
{% endif %}
|
||||
</header>
|
||||
|
||||
<!-- Activity content -->
|
||||
<div class="activity-detail-content">
|
||||
<!-- Main description -->
|
||||
<section class="activity-section">
|
||||
<h2 class="section-title">Descriere</h2>
|
||||
<div class="activity-description">{{ activity.description }}</div>
|
||||
</section>
|
||||
|
||||
<!-- Rules and variations -->
|
||||
{% if activity.rules %}
|
||||
<section class="activity-section">
|
||||
<h2 class="section-title">Reguli</h2>
|
||||
<div class="activity-rules">{{ activity.rules }}</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.variations %}
|
||||
<section class="activity-section">
|
||||
<h2 class="section-title">Variații</h2>
|
||||
<div class="activity-variations">{{ activity.variations }}</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<!-- Metadata grid -->
|
||||
<section class="activity-section">
|
||||
<h2 class="section-title">Detalii activitate</h2>
|
||||
<div class="metadata-grid">
|
||||
{% if activity.get_age_range_display() != "toate vârstele" %}
|
||||
<div class="metadata-card">
|
||||
<h3 class="metadata-title">Grupa de vârstă</h3>
|
||||
<p class="metadata-value">{{ activity.get_age_range_display() }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.get_participants_display() != "orice număr" %}
|
||||
<div class="metadata-card">
|
||||
<h3 class="metadata-title">Participanți</h3>
|
||||
<p class="metadata-value">{{ activity.get_participants_display() }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.get_duration_display() != "durată variabilă" %}
|
||||
<div class="metadata-card">
|
||||
<h3 class="metadata-title">Durata</h3>
|
||||
<p class="metadata-value">{{ activity.get_duration_display() }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.get_materials_display() != "nu specificate" %}
|
||||
<div class="metadata-card">
|
||||
<h3 class="metadata-title">Materiale necesare</h3>
|
||||
<p class="metadata-value">{{ activity.get_materials_display() }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.skills_developed %}
|
||||
<div class="metadata-card">
|
||||
<h3 class="metadata-title">Competențe dezvoltate</h3>
|
||||
<p class="metadata-value">{{ activity.skills_developed }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.difficulty_level %}
|
||||
<div class="metadata-card">
|
||||
<h3 class="metadata-title">Nivel dificultate</h3>
|
||||
<p class="metadata-value">{{ activity.difficulty_level }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Additional materials -->
|
||||
{% if activity.materials_list and activity.materials_list != activity.get_materials_display() %}
|
||||
<section class="activity-section">
|
||||
<h2 class="section-title">Lista detaliată materiale</h2>
|
||||
<div class="materials-list">{{ activity.materials_list }}</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<!-- Keywords -->
|
||||
{% if activity.keywords %}
|
||||
<section class="activity-section">
|
||||
<h2 class="section-title">Cuvinte cheie</h2>
|
||||
<div class="keywords">
|
||||
{% for keyword in activity.keywords.split(',') %}
|
||||
<span class="keyword-tag">{{ keyword.strip() }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<!-- Source information -->
|
||||
<section class="activity-section">
|
||||
<h2 class="section-title">Informații sursă</h2>
|
||||
<div class="source-info">
|
||||
{% if activity.source_file %}
|
||||
<p><strong>Fișier sursă:</strong> {{ activity.source_file }}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.page_reference %}
|
||||
<p><strong>Referință:</strong> {{ activity.page_reference }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- Similar activities -->
|
||||
{% if similar_activities %}
|
||||
<section class="similar-activities">
|
||||
<h2 class="section-title">Activități similare</h2>
|
||||
<div class="similar-activities-grid">
|
||||
{% for similar in similar_activities %}
|
||||
<article class="similar-activity-card">
|
||||
<h3 class="similar-activity-title">
|
||||
<a href="{{ url_for('main.activity_detail', activity_id=similar.id) }}">
|
||||
{{ similar.name }}
|
||||
</a>
|
||||
</h3>
|
||||
<p class="similar-activity-description">
|
||||
{{ similar.description[:100] }}{% if similar.description|length > 100 %}...{% endif %}
|
||||
</p>
|
||||
<div class="similar-activity-meta">
|
||||
{% if similar.get_age_range_display() != "toate vârstele" %}
|
||||
<span class="meta-item">{{ similar.get_age_range_display() }}</span>
|
||||
{% endif %}
|
||||
{% if similar.get_participants_display() != "orice număr" %}
|
||||
<span class="meta-item">{{ similar.get_participants_display() }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<!-- Action buttons -->
|
||||
<div class="activity-actions">
|
||||
<a href="javascript:history.back()" class="btn btn-secondary">
|
||||
← Înapoi la rezultate
|
||||
</a>
|
||||
<a href="{{ url_for('main.index') }}" class="btn btn-primary">
|
||||
Căutare nouă
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
// Print functionality
|
||||
function printActivity() {
|
||||
window.print();
|
||||
}
|
||||
|
||||
// Copy link functionality
|
||||
function copyLink() {
|
||||
navigator.clipboard.writeText(window.location.href).then(function() {
|
||||
alert('Link copiat în clipboard!');
|
||||
});
|
||||
}
|
||||
|
||||
// Add print styles when printing
|
||||
window.addEventListener('beforeprint', function() {
|
||||
document.body.classList.add('printing');
|
||||
});
|
||||
|
||||
window.addEventListener('afterprint', function() {
|
||||
document.body.classList.remove('printing');
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
44
app/templates/base.html
Normal file
44
app/templates/base.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ro">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}INDEX Sistem Jocuri{% endblock %}</title>
|
||||
<link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet">
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
<div class="container">
|
||||
<h1 class="header-title">
|
||||
<a href="{{ url_for('main.index') }}">INDEX Sistem Jocuri</a>
|
||||
</h1>
|
||||
<nav class="header-nav">
|
||||
<a href="{{ url_for('main.index') }}" class="nav-link">Căutare</a>
|
||||
<a href="{{ url_for('main.api_statistics') }}" class="nav-link">Statistici</a>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="main">
|
||||
<div class="container">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="footer-text">
|
||||
{% if stats and stats.total_activities %}
|
||||
{{ stats.total_activities }} activități indexate
|
||||
{% else %}
|
||||
Sistem de indexare activități educaționale
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="{{ url_for('static', filename='js/app.js') }}"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
153
app/templates/index.html
Normal file
153
app/templates/index.html
Normal file
@@ -0,0 +1,153 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Căutare Activități - INDEX Sistem Jocuri{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="search-page">
|
||||
<div class="search-header">
|
||||
<h2 class="search-title">Căutare Activități Educaționale</h2>
|
||||
<p class="search-subtitle">
|
||||
Descoperă activități pentru copii și tineri din catalogul nostru de
|
||||
{% if stats and stats.total_activities %}{{ stats.total_activities }}{% else %}500+{% endif %}
|
||||
jocuri și exerciții.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="{{ url_for('main.search') }}" class="search-form">
|
||||
<!-- Main search input -->
|
||||
<div class="search-input-group">
|
||||
<input
|
||||
type="text"
|
||||
name="search_query"
|
||||
id="search_query"
|
||||
class="search-input"
|
||||
placeholder="Caută activități după nume, descriere sau cuvinte cheie..."
|
||||
autocomplete="off"
|
||||
>
|
||||
<button type="submit" class="search-button">Căutare</button>
|
||||
</div>
|
||||
|
||||
<!-- Dynamic filters -->
|
||||
<div class="filters-grid">
|
||||
{% if filters %}
|
||||
{% if filters.category %}
|
||||
<div class="filter-group">
|
||||
<label for="category" class="filter-label">Categorie</label>
|
||||
<select name="category" id="category" class="filter-select">
|
||||
<option value="">Toate categoriile</option>
|
||||
{% for category in filters.category %}
|
||||
<option value="{{ category }}">{{ category }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if filters.age_group %}
|
||||
<div class="filter-group">
|
||||
<label for="age_group" class="filter-label">Grupa de vârstă</label>
|
||||
<select name="age_group" id="age_group" class="filter-select">
|
||||
<option value="">Toate vârstele</option>
|
||||
{% for age_group in filters.age_group %}
|
||||
<option value="{{ age_group }}">{{ age_group }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if filters.participants %}
|
||||
<div class="filter-group">
|
||||
<label for="participants" class="filter-label">Participanți</label>
|
||||
<select name="participants" id="participants" class="filter-select">
|
||||
<option value="">Orice număr</option>
|
||||
{% for participants in filters.participants %}
|
||||
<option value="{{ participants }}">{{ participants }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if filters.duration %}
|
||||
<div class="filter-group">
|
||||
<label for="duration" class="filter-label">Durata</label>
|
||||
<select name="duration" id="duration" class="filter-select">
|
||||
<option value="">Orice durată</option>
|
||||
{% for duration in filters.duration %}
|
||||
<option value="{{ duration }}">{{ duration }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if filters.materials %}
|
||||
<div class="filter-group">
|
||||
<label for="materials" class="filter-label">Materiale</label>
|
||||
<select name="materials" id="materials" class="filter-select">
|
||||
<option value="">Orice materiale</option>
|
||||
{% for materials in filters.materials %}
|
||||
<option value="{{ materials }}">{{ materials }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if filters.difficulty %}
|
||||
<div class="filter-group">
|
||||
<label for="difficulty" class="filter-label">Dificultate</label>
|
||||
<select name="difficulty" id="difficulty" class="filter-select">
|
||||
<option value="">Orice nivel</option>
|
||||
{% for difficulty in filters.difficulty %}
|
||||
<option value="{{ difficulty }}">{{ difficulty }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Action buttons -->
|
||||
<div class="search-actions">
|
||||
<button type="submit" class="btn btn-primary">Aplică filtrele</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="clearFilters()">Resetează</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Quick stats -->
|
||||
{% if stats and stats.categories %}
|
||||
<div class="quick-stats">
|
||||
<h3 class="stats-title">Categorii disponibile</h3>
|
||||
<div class="stats-grid">
|
||||
{% for category, count in stats.categories.items() %}
|
||||
<div class="stat-item">
|
||||
<span class="stat-label">{{ category }}</span>
|
||||
<span class="stat-value">{{ count }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
function clearFilters() {
|
||||
// Reset all form fields
|
||||
document.getElementById('search_query').value = '';
|
||||
|
||||
const selects = document.querySelectorAll('.filter-select');
|
||||
selects.forEach(select => select.selectedIndex = 0);
|
||||
}
|
||||
|
||||
// Auto-submit on filter change for better UX
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const filterSelects = document.querySelectorAll('.filter-select');
|
||||
filterSelects.forEach(select => {
|
||||
select.addEventListener('change', function() {
|
||||
if (this.value) {
|
||||
document.querySelector('.search-form').submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
222
app/templates/results.html
Normal file
222
app/templates/results.html
Normal file
@@ -0,0 +1,222 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Rezultate căutare - INDEX Sistem Jocuri{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="results-page">
|
||||
<!-- Search form (compact version) -->
|
||||
<form method="POST" action="{{ url_for('main.search') }}" class="search-form compact">
|
||||
<div class="search-input-group">
|
||||
<input
|
||||
type="text"
|
||||
name="search_query"
|
||||
value="{{ search_query }}"
|
||||
class="search-input"
|
||||
placeholder="Caută activități..."
|
||||
>
|
||||
<button type="submit" class="search-button">Căutare</button>
|
||||
</div>
|
||||
|
||||
{% if filters %}
|
||||
<div class="filters-row">
|
||||
{% if filters.category %}
|
||||
<select name="category" class="filter-select compact">
|
||||
<option value="">Toate categoriile</option>
|
||||
{% for category in filters.category %}
|
||||
<option value="{{ category }}" {% if applied_filters.category == category %}selected{% endif %}>
|
||||
{{ category }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% endif %}
|
||||
|
||||
{% if filters.age_group %}
|
||||
<select name="age_group" class="filter-select compact">
|
||||
<option value="">Toate vârstele</option>
|
||||
{% for age_group in filters.age_group %}
|
||||
<option value="{{ age_group }}" {% if applied_filters.age_group == age_group %}selected{% endif %}>
|
||||
{{ age_group }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% endif %}
|
||||
|
||||
{% if filters.participants %}
|
||||
<select name="participants" class="filter-select compact">
|
||||
<option value="">Orice număr</option>
|
||||
{% for participants in filters.participants %}
|
||||
<option value="{{ participants }}" {% if applied_filters.participants == participants %}selected{% endif %}>
|
||||
{{ participants }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% endif %}
|
||||
|
||||
{% if filters.duration %}
|
||||
<select name="duration" class="filter-select compact">
|
||||
<option value="">Orice durată</option>
|
||||
{% for duration in filters.duration %}
|
||||
<option value="{{ duration }}" {% if applied_filters.duration == duration %}selected{% endif %}>
|
||||
{{ duration }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% endif %}
|
||||
|
||||
<button type="button" class="btn btn-secondary btn-sm" onclick="clearFilters()">
|
||||
Resetează
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
<!-- Results header -->
|
||||
<div class="results-header">
|
||||
<h2 class="results-title">
|
||||
Rezultate căutare
|
||||
{% if search_query %}pentru "{{ search_query }}"{% endif %}
|
||||
</h2>
|
||||
<p class="results-count">
|
||||
{% if results_count > 0 %}
|
||||
{{ results_count }} activități găsite
|
||||
{% else %}
|
||||
Nu au fost găsite activități
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<!-- Applied filters display -->
|
||||
{% if applied_filters %}
|
||||
<div class="applied-filters">
|
||||
<span class="applied-filters-label">Filtre aplicate:</span>
|
||||
{% for filter_key, filter_value in applied_filters.items() %}
|
||||
<span class="applied-filter">
|
||||
{{ filter_value }}
|
||||
<a href="javascript:removeFilter('{{ filter_key }}')" class="remove-filter">×</a>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Results list -->
|
||||
{% if activities %}
|
||||
<div class="results-list">
|
||||
{% for activity in activities %}
|
||||
<article class="activity-card">
|
||||
<header class="activity-header">
|
||||
<h3 class="activity-title">
|
||||
<a href="{{ url_for('main.activity_detail', activity_id=activity.id) }}">
|
||||
{{ activity.name }}
|
||||
</a>
|
||||
</h3>
|
||||
<span class="activity-category">{{ activity.category }}</span>
|
||||
</header>
|
||||
|
||||
<div class="activity-content">
|
||||
<p class="activity-description">{{ activity.description }}</p>
|
||||
|
||||
<div class="activity-metadata">
|
||||
{% if activity.get_age_range_display() != "toate vârstele" %}
|
||||
<span class="metadata-item">
|
||||
<strong>Vârsta:</strong> {{ activity.get_age_range_display() }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.get_participants_display() != "orice număr" %}
|
||||
<span class="metadata-item">
|
||||
<strong>Participanți:</strong> {{ activity.get_participants_display() }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.get_duration_display() != "durată variabilă" %}
|
||||
<span class="metadata-item">
|
||||
<strong>Durata:</strong> {{ activity.get_duration_display() }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.get_materials_display() != "nu specificate" %}
|
||||
<span class="metadata-item">
|
||||
<strong>Materiale:</strong> {{ activity.get_materials_display() }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if activity.source_file %}
|
||||
<div class="activity-source">
|
||||
<small>Sursă: {{ activity.source_file }}</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<footer class="activity-footer">
|
||||
<a href="{{ url_for('main.activity_detail', activity_id=activity.id) }}"
|
||||
class="btn btn-primary btn-sm">
|
||||
Vezi detalii
|
||||
</a>
|
||||
</footer>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="no-results">
|
||||
<h3>Nu au fost găsite activități</h3>
|
||||
<p>Încearcă să:</p>
|
||||
<ul>
|
||||
<li>Modifici termenii de căutare</li>
|
||||
<li>Elimini unele filtre</li>
|
||||
<li>Verifici ortografia</li>
|
||||
<li>Folosești termeni mai generali</li>
|
||||
</ul>
|
||||
<a href="{{ url_for('main.index') }}" class="btn btn-primary">
|
||||
Întoarce-te la căutare
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if error %}
|
||||
<div class="error-message">
|
||||
<strong>Eroare:</strong> {{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
function clearFilters() {
|
||||
// Clear search query and all filters
|
||||
const form = document.querySelector('.search-form');
|
||||
const inputs = form.querySelectorAll('input, select');
|
||||
|
||||
inputs.forEach(input => {
|
||||
if (input.type === 'text') {
|
||||
input.value = '';
|
||||
} else if (input.tagName === 'SELECT') {
|
||||
input.selectedIndex = 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Submit the form to show all results
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function removeFilter(filterKey) {
|
||||
// Remove specific filter by setting its value to empty
|
||||
const filterElement = document.querySelector(`[name="${filterKey}"]`);
|
||||
if (filterElement) {
|
||||
filterElement.value = '';
|
||||
document.querySelector('.search-form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-submit on filter change
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const filterSelects = document.querySelectorAll('.filter-select');
|
||||
filterSelects.forEach(select => {
|
||||
select.addEventListener('change', function() {
|
||||
document.querySelector('.search-form').submit();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user