refact: remove exercise detail pages and modernize assessment interface

- Remove routes/exercises.py blueprint (only consultation routes)
- Delete templates/exercise_detail.html (intermediate page removed)
- Update app.py to remove exercises blueprint registration
- Modernize templates/assessment_detail.html with:
  * Hero section with gradient background
  * Action cards with hover effects and animations
  * Centered progress indicator with visual circles
  * Compact exercise structure display
  * Improved responsive design and UX

Part of Phase 2 UX improvements - eliminating intermediate pages for direct navigation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-05 10:40:18 +02:00
parent b7d8194c51
commit 1dccf28d5f
4 changed files with 310 additions and 290 deletions

2
app.py
View File

@@ -10,7 +10,6 @@ from core.logging import setup_logging
# Import blueprints
from routes.assessments import bp as assessments_bp
from routes.exercises import bp as exercises_bp
from routes.grading import bp as grading_bp
from routes.config import bp as config_bp
@@ -40,7 +39,6 @@ def create_app(config_name=None):
# Register blueprints
app.register_blueprint(assessments_bp)
app.register_blueprint(exercises_bp)
app.register_blueprint(grading_bp)
app.register_blueprint(config_bp)

View File

@@ -1,17 +0,0 @@
from flask import Blueprint, render_template
from models import Assessment, Exercise
from utils import handle_db_errors
bp = Blueprint('exercises', __name__)
# Routes de consultation seulement - La création/modification se fait via le formulaire unifié d'évaluation
@bp.route('/assessments/<int:assessment_id>/exercises/<int:id>')
@handle_db_errors
def detail(assessment_id, id):
from sqlalchemy.orm import joinedload
assessment = Assessment.query.get_or_404(assessment_id)
exercise = Exercise.query.options(
joinedload(Exercise.grading_elements)
).filter_by(id=id, assessment_id=assessment_id).first_or_404()
return render_template('exercise_detail.html', assessment=assessment, exercise=exercise)

View File

@@ -3,194 +3,361 @@
{% block title %}{{ assessment.title }} - Gestion Scolaire{% endblock %}
{% block content %}
<div class="space-y-6">
<div class="flex justify-between items-center">
<div>
<a href="{{ url_for('assessments.list') }}" class="text-blue-600 hover:text-blue-800 text-sm font-medium mb-2 inline-block">
← Retour aux évaluations
</a>
<h1 class="text-2xl font-bold text-gray-900">{{ assessment.title }}</h1>
<p class="text-gray-600">{{ assessment.class_group.name }} - {{ assessment.date.strftime('%d/%m/%Y') }} - Trimestre {{ assessment.trimester }}</p>
</div>
<div class="flex space-x-3">
<a href="{{ url_for('assessments.edit', id=assessment.id) }}" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors">
Modifier l'évaluation complète
</a>
<button onclick="if(confirm('Êtes-vous sûr de vouloir supprimer cette évaluation ?')) { document.getElementById('delete-form').submit(); }"
class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors">
Supprimer
</button>
<div class="space-y-8">
<!-- Hero Section moderne avec gradient -->
<div class="bg-gradient-to-r from-purple-600 to-blue-600 text-white rounded-xl p-8 shadow-lg">
<div class="flex items-center justify-between">
<div class="flex-1">
<a href="{{ url_for('assessments.list') }}" class="text-white/80 hover:text-white text-sm font-medium mb-3 inline-block transition-colors">
← Retour aux évaluations
</a>
<h1 class="text-4xl font-bold mb-2">{{ assessment.title }}</h1>
<div class="flex items-center space-x-6 text-lg opacity-90">
<span class="flex items-center">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
{{ assessment.class_group.name }}
</span>
<span class="flex items-center">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"/>
</svg>
{{ assessment.date.strftime('%d/%m/%Y') }}
</span>
<span class="flex items-center">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path d="M7 3a1 1 0 000 2h6a1 1 0 100-2H7zM4 7a1 1 0 011-1h10a1 1 0 110 2H5a1 1 0 01-1-1zM2 11a2 2 0 012-2h12a2 2 0 012 2v4a2 2 0 01-2 2H4a2 2 0 01-2-2v-4z"/>
</svg>
Trimestre {{ assessment.trimester }}
</span>
</div>
</div>
<div class="hidden lg:block">
<div class="w-24 h-24 bg-white/20 rounded-full flex items-center justify-center">
<svg class="w-12 h-12" fill="currentColor" viewBox="0 0 20 20">
<path d="M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"/>
<path fill-rule="evenodd" d="M4 5a2 2 0 012-2v1a1 1 0 102 0V3a2 2 0 012 2v6a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm2.5 2.5a.5.5 0 000 1h3a.5.5 0 000-1h-3z" clip-rule="evenodd"/>
</svg>
</div>
</div>
</div>
</div>
<form id="delete-form" method="POST" action="{{ url_for('assessments.delete', id=assessment.id) }}" style="display: none;"></form>
<!-- Informations de l'évaluation -->
<div class="bg-white shadow rounded-lg">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-lg font-medium text-gray-900">Informations générales</h2>
</div>
<div class="px-6 py-4">
<dl class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<dt class="text-sm font-medium text-gray-500">Classe</dt>
<dd class="mt-1 text-sm text-gray-900">{{ assessment.class_group.name }}</dd>
<!-- Actions principales mises en avant -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<a href="{{ url_for('grading.assessment_grading', assessment_id=assessment.id) }}"
class="group bg-gradient-to-r from-green-500 to-green-600 text-white rounded-xl p-6 hover:from-green-600 hover:to-green-700 transition-all duration-300 transform hover:scale-105 shadow-lg hover:shadow-xl">
<div class="flex items-center">
<div class="w-12 h-12 bg-white/20 rounded-xl flex items-center justify-center mr-4 group-hover:bg-white/30 transition-colors">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20">
<path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"/>
</svg>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Date</dt>
<dd class="mt-1 text-sm text-gray-900">{{ assessment.date.strftime('%d/%m/%Y') }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Trimestre</dt>
<dd class="mt-1 text-sm text-gray-900">{{ assessment.trimester }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Coefficient</dt>
<dd class="mt-1 text-sm text-gray-900">{{ assessment.coefficient }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Nombre d'exercices</dt>
<dd class="mt-1 text-sm text-gray-900">{{ assessment.exercises|length }}</dd>
<h3 class="text-lg font-bold mb-1">Noter</h3>
<p class="text-sm opacity-90">Saisir les notes</p>
</div>
</div>
</a>
<!-- Indicateur de progression des corrections -->
<div class="md:col-span-2">
<dt class="text-sm font-medium text-gray-500 mb-2">État des corrections</dt>
<dd class="mt-1">
{% set progress = assessment.grading_progress %}
<div class="flex items-center justify-between">
<!-- Indicateur fusionné -->
{% if progress.status == 'completed' %}
<div class="inline-flex items-center px-4 py-2 rounded-lg text-sm font-medium bg-green-100 text-green-800 border border-green-200">
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
<span class="font-semibold">Corrections terminées (100%)</span>
</div>
{% elif progress.status == 'in_progress' %}
<a href="{{ url_for('grading.assessment_grading', assessment_id=assessment.id) }}"
class="inline-flex items-center px-4 py-2 rounded-lg text-sm font-medium bg-orange-100 text-orange-800 border border-orange-200 hover:bg-orange-200 transition-colors cursor-pointer">
<div class="relative w-4 h-4 mr-2">
<svg class="w-4 h-4 transform -rotate-90" viewBox="0 0 16 16">
<circle cx="8" cy="8" r="6" stroke="currentColor" stroke-width="2" fill="none" class="text-orange-300"/>
<circle cx="8" cy="8" r="6" stroke="currentColor" stroke-width="2" fill="none"
class="text-orange-600" stroke-dasharray="37.7"
stroke-dashoffset="{{ 37.7 - (37.7 * progress.percentage / 100) }}"/>
</svg>
</div>
<span class="font-semibold">Corrections en cours ({{ progress.percentage }}%) - Cliquer pour continuer</span>
</a>
{% elif progress.status == 'not_started' %}
<a href="{{ url_for('grading.assessment_grading', assessment_id=assessment.id) }}"
class="inline-flex items-center px-4 py-2 rounded-lg text-sm font-medium bg-red-100 text-red-800 border border-red-200 hover:bg-red-200 transition-colors cursor-pointer">
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/>
</svg>
<span class="font-semibold">Corrections non commencées - Cliquer pour démarrer</span>
</a>
{% else %}
<div class="inline-flex items-center px-4 py-2 rounded-lg text-sm font-medium bg-gray-100 text-gray-800 border border-gray-200">
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
</svg>
<span class="font-semibold">État indéterminé</span>
</div>
{% endif %}
<a href="{{ url_for('assessments.results', id=assessment.id) }}"
class="group bg-gradient-to-r from-purple-500 to-purple-600 text-white rounded-xl p-6 hover:from-purple-600 hover:to-purple-700 transition-all duration-300 transform hover:scale-105 shadow-lg hover:shadow-xl">
<div class="flex items-center">
<div class="w-12 h-12 bg-white/20 rounded-xl flex items-center justify-center mr-4 group-hover:bg-white/30 transition-colors">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
</div>
<div>
<h3 class="text-lg font-bold mb-1">Résultats</h3>
<p class="text-sm opacity-90">Stats & graphiques</p>
</div>
</div>
</a>
<!-- Info détaillée -->
<div class="text-sm text-gray-500">
<span class="font-medium">{{ progress.completed }}/{{ progress.total }}</span> notes saisies
{% if progress.students_count %}
<span class="ml-2">({{ progress.students_count }} élèves)</span>
{% endif %}
</div>
<a href="{{ url_for('assessments.edit', id=assessment.id) }}"
class="group bg-gradient-to-r from-blue-500 to-blue-600 text-white rounded-xl p-6 hover:from-blue-600 hover:to-blue-700 transition-all duration-300 transform hover:scale-105 shadow-lg hover:shadow-xl">
<div class="flex items-center">
<div class="w-12 h-12 bg-white/20 rounded-xl flex items-center justify-center mr-4 group-hover:bg-white/30 transition-colors">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20">
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"/>
<path fill-rule="evenodd" d="M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z" clip-rule="evenodd"/>
</svg>
</div>
<div>
<h3 class="text-lg font-bold mb-1">Modifier</h3>
<p class="text-sm opacity-90">Évaluation complète</p>
</div>
</div>
</a>
<button onclick="if(confirm('Êtes-vous sûr de vouloir supprimer cette évaluation ?')) { document.getElementById('delete-form').submit(); }"
class="group bg-gradient-to-r from-red-500 to-red-600 text-white rounded-xl p-6 hover:from-red-600 hover:to-red-700 transition-all duration-300 transform hover:scale-105 shadow-lg hover:shadow-xl">
<div class="flex items-center">
<div class="w-12 h-12 bg-white/20 rounded-xl flex items-center justify-center mr-4 group-hover:bg-white/30 transition-colors">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd"/>
</svg>
</div>
<div>
<h3 class="text-lg font-bold mb-1">Supprimer</h3>
<p class="text-sm opacity-90">Définitivement</p>
</div>
</div>
</button>
</div>
<!-- Indicateur de progression et informations clés -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- État des corrections - Carte principale -->
<div class="lg:col-span-2 bg-white shadow rounded-xl p-6">
<div class="flex items-center justify-between mb-6">
<h2 class="text-xl font-bold text-gray-900">État des corrections</h2>
{% set progress = assessment.grading_progress %}
{% if progress.status == 'completed' %}
<span class="bg-green-100 text-green-800 text-sm px-3 py-1 rounded-full font-medium">Terminé</span>
{% elif progress.status == 'in_progress' %}
<span class="bg-orange-100 text-orange-800 text-sm px-3 py-1 rounded-full font-medium">En cours</span>
{% elif progress.status == 'not_started' %}
<span class="bg-red-100 text-red-800 text-sm px-3 py-1 rounded-full font-medium">À faire</span>
{% endif %}
</div>
<!-- Indicateur visuel principal -->
<div class="text-center mb-6">
{% if progress.status == 'completed' %}
<div class="w-24 h-24 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
<svg class="w-12 h-12 text-green-600" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
</div>
<h3 class="text-2xl font-bold text-green-600 mb-2">100% Terminé</h3>
<p class="text-gray-600">Toutes les corrections sont saisies</p>
{% elif progress.status == 'in_progress' %}
<div class="relative w-24 h-24 mx-auto mb-4">
<svg class="w-24 h-24 transform -rotate-90" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" stroke="#fed7aa" stroke-width="8" fill="none"/>
<circle cx="50" cy="50" r="40" stroke="#ea580c" stroke-width="8" fill="none"
stroke-dasharray="251.2" stroke-dashoffset="{{ 251.2 - (251.2 * progress.percentage / 100) }}"
class="transition-all duration-1000 ease-out"/>
</svg>
<div class="absolute inset-0 flex items-center justify-center">
<span class="text-xl font-bold text-orange-600">{{ progress.percentage }}%</span>
</div>
</dd>
</div>
<h3 class="text-2xl font-bold text-orange-600 mb-2">En cours</h3>
<p class="text-gray-600">{{ progress.completed }} notes sur {{ progress.total }} saisies</p>
<a href="{{ url_for('grading.assessment_grading', assessment_id=assessment.id) }}"
class="inline-flex items-center mt-4 bg-orange-500 hover:bg-orange-600 text-white px-4 py-2 rounded-lg font-medium transition-colors">
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"/>
</svg>
Continuer la correction
</a>
{% elif progress.status == 'not_started' %}
<div class="w-24 h-24 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4">
<svg class="w-12 h-12 text-red-600" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/>
</svg>
</div>
<h3 class="text-2xl font-bold text-red-600 mb-2">0% - À commencer</h3>
<p class="text-gray-600">Aucune note n'a encore été saisie</p>
<a href="{{ url_for('grading.assessment_grading', assessment_id=assessment.id) }}"
class="inline-flex items-center mt-4 bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded-lg font-medium transition-colors">
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"/>
</svg>
Démarrer la correction
</a>
{% endif %}
</div>
<!-- Détails techniques -->
<div class="bg-gray-50 rounded-lg p-4">
<div class="grid grid-cols-2 gap-4 text-sm">
<div>
<span class="text-gray-500">Notes saisies :</span>
<span class="font-medium text-gray-900">{{ progress.completed }}/{{ progress.total }}</span>
</div>
{% if progress.students_count %}
<div>
<span class="text-gray-500">Élèves :</span>
<span class="font-medium text-gray-900">{{ progress.students_count }}</span>
</div>
{% endif %}
</div>
</div>
</div>
<!-- Informations générales - Carte latérale -->
<div class="bg-white shadow rounded-xl p-6">
<h2 class="text-lg font-bold text-gray-900 mb-4">Informations générales</h2>
<div class="space-y-4">
<div class="flex items-center justify-between">
<span class="text-sm font-medium text-gray-500">Classe</span>
<span class="text-sm font-bold text-gray-900">{{ assessment.class_group.name }}</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm font-medium text-gray-500">Date</span>
<span class="text-sm font-bold text-gray-900">{{ assessment.date.strftime('%d/%m/%Y') }}</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm font-medium text-gray-500">Trimestre</span>
<span class="text-sm font-bold text-gray-900">{{ assessment.trimester }}</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm font-medium text-gray-500">Coefficient</span>
<span class="text-sm font-bold text-gray-900">{{ assessment.coefficient }}</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm font-medium text-gray-500">Exercices</span>
<span class="text-sm font-bold text-gray-900">{{ assessment.exercises|length }}</span>
</div>
{% if assessment.description %}
<div class="md:col-span-2">
<dt class="text-sm font-medium text-gray-500">Description</dt>
<dd class="mt-1 text-sm text-gray-900">{{ assessment.description }}</dd>
<div class="border-t border-gray-200 pt-4">
<span class="text-sm font-medium text-gray-500">Description</span>
<p class="mt-1 text-sm text-gray-900 bg-blue-50 p-3 rounded-lg">{{ assessment.description }}</p>
</div>
{% endif %}
</dl>
</div>
</div>
</div>
<!-- Exercices -->
<div class="bg-white shadow rounded-lg">
<div class="px-6 py-4 border-b border-gray-200 flex justify-between items-center">
<h2 class="text-lg font-medium text-gray-900">Exercices</h2>
<span class="text-sm text-gray-500">
Utilisez "Modifier l'évaluation complète" pour ajouter des exercices
</span>
<div class="bg-white shadow rounded-xl">
<div class="px-6 py-5 border-b border-gray-200 flex justify-between items-center">
<div class="flex items-center">
<h2 class="text-xl font-bold text-gray-900">Structure de l'évaluation</h2>
<span class="ml-3 bg-blue-100 text-blue-800 text-sm px-3 py-1 rounded-full font-medium">
{{ assessment.exercises|length }} exercice(s)
</span>
</div>
<div class="text-sm text-gray-500 flex items-center">
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
</svg>
Utilisez "Modifier" pour ajouter des exercices
</div>
</div>
<div class="px-6 py-4">
<div class="px-6 py-6">
{% if assessment.exercises %}
<div class="space-y-4">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{% for exercise in assessment.exercises|sort(attribute='order') %}
<div class="border border-gray-200 rounded-lg p-4">
<div class="flex justify-between items-start">
<div class="flex-1">
<h3 class="text-sm font-medium text-gray-900">{{ exercise.title }}</h3>
{% if exercise.description %}
<p class="text-sm text-gray-600 mt-1">{{ exercise.description }}</p>
{% endif %}
<div class="text-xs text-gray-500 mt-2">
{{ exercise.grading_elements|length }} élément(s) de notation
<div class="bg-white border border-gray-200 rounded-xl shadow-sm hover:shadow-md transition-shadow duration-300">
<!-- En-tête de la card -->
<div class="p-4 border-b border-gray-100">
<div class="mb-2">
<div class="flex items-center">
<span class="w-8 h-8 bg-gradient-to-br from-purple-500 to-blue-600 rounded-full flex items-center justify-center text-white text-sm font-bold mr-3">
{{ loop.index }}
</span>
<div>
<h3 class="text-base font-bold text-gray-900 leading-tight">{{ exercise.title }}</h3>
{% set total_points = exercise.grading_elements | map(attribute='max_points') | sum %}
{% if total_points > 0 %}
<span class="text-xs text-purple-600 font-medium">
{{ total_points }} points total
</span>
{% endif %}
</div>
</div>
</div>
<div class="flex space-x-2 ml-4">
<a href="{{ url_for('exercises.detail', assessment_id=assessment.id, id=exercise.id) }}" class="text-blue-600 hover:text-blue-800 text-sm font-medium">
Voir détails
</a>
</div>
{% if exercise.description %}
<p class="text-xs text-gray-600 line-clamp-2">{{ exercise.description }}</p>
{% endif %}
</div>
<!-- Éléments de notation -->
<div class="p-4">
{% if exercise.grading_elements %}
<div class="space-y-2">
{% for element in exercise.grading_elements %}
<div class="flex items-center justify-between text-sm">
<div class="flex-1 min-w-0">
<div class="font-medium text-gray-900 truncate">{{ element.label }}</div>
<div class="flex items-center space-x-1 mt-1">
{% if element.skill %}
<span class="text-xs text-purple-700 bg-purple-100 px-2 py-0.5 rounded-full">
{{ element.skill }}
</span>
{% endif %}
{% if element.grading_type == 'competences' %}
<span class="text-xs text-green-700 bg-green-100 px-2 py-0.5 rounded-full">
Échelle
</span>
{% endif %}
</div>
</div>
<span class="font-bold text-gray-900 ml-2">{{ element.max_points }}</span>
</div>
{% if not loop.last %}
<hr class="border-gray-100">
{% endif %}
{% endfor %}
</div>
{% else %}
<p class="text-xs text-gray-500 text-center py-4">Aucun élément de notation</p>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="text-center py-8">
<svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48">
<path d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8m9-16v20m5-14H9m1 4h8m1 2h8m-8 6h8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
<h3 class="mt-2 text-sm font-medium text-gray-900">Aucun exercice</h3>
<p class="mt-1 text-sm text-gray-500">Commencez par ajouter le premier exercice de cette évaluation.</p>
<div class="mt-6">
<a href="{{ url_for('assessments.edit', id=assessment.id) }}" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors">
Modifier l'évaluation complète
</a>
<div class="text-center py-12">
<div class="w-24 h-24 bg-gradient-to-br from-gray-100 to-gray-200 rounded-full flex items-center justify-center mx-auto mb-6">
<svg class="w-12 h-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48">
<path d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8m9-16v20m5-14H9m1 4h8m1 2h8m-8 6h8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</div>
<h3 class="text-xl font-bold text-gray-900 mb-2">Aucun exercice créé</h3>
<p class="text-gray-600 mb-6 max-w-md mx-auto">
Cette évaluation ne contient pas encore d'exercices. Utilisez le bouton "Modifier" pour structurer votre évaluation.
</p>
<a href="{{ url_for('assessments.edit', id=assessment.id) }}"
class="inline-flex items-center bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white px-6 py-3 rounded-xl font-semibold shadow-lg hover:shadow-xl transform hover:scale-105 transition-all duration-300">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd"/>
</svg>
Ajouter des exercices
</a>
</div>
{% endif %}
</div>
</div>
<!-- Actions rapides -->
<div class="bg-white shadow rounded-lg">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-lg font-medium text-gray-900">Actions</h2>
<!-- Actions secondaires -->
<div class="bg-white shadow rounded-xl">
<div class="px-6 py-5 border-b border-gray-200">
<h2 class="text-xl font-bold text-gray-900">Actions supplémentaires</h2>
</div>
<div class="px-6 py-4">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<a href="{{ url_for('grading.assessment_grading', assessment_id=assessment.id) }}" class="flex items-center justify-center px-4 py-3 border border-gray-300 rounded-lg text-sm font-medium text-gray-700 hover:bg-gray-50 transition-colors">
<svg class="w-5 h-5 mr-2 text-green-600" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 4a1 1 0 011-1h12a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1V8z" clip-rule="evenodd"/>
<div class="px-6 py-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<button disabled class="flex items-center justify-center px-4 py-3 border-2 border-dashed border-gray-300 rounded-xl text-sm font-medium text-gray-500 cursor-not-allowed transition-colors">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clip-rule="evenodd"/>
</svg>
Saisir les notes
</a>
<a href="{{ url_for('assessments.results', id=assessment.id) }}" class="flex items-center justify-center px-4 py-3 border border-gray-300 rounded-lg text-sm font-medium text-gray-700 hover:bg-gray-50 transition-colors">
<svg class="w-5 h-5 mr-2 text-purple-600" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 011 1v1a1 1 0 01-1 1H4a1 1 0 01-1-1v-1zM3 4a1 1 0 011-1h12a1 1 0 011 1v1a1 1 0 01-1 1H4a1 1 0 01-1-1V4z" clip-rule="evenodd"/>
Exporter PDF
<span class="ml-2 text-xs bg-gray-200 text-gray-600 px-2 py-1 rounded-full">Bientôt</span>
</button>
<button disabled class="flex items-center justify-center px-4 py-3 border-2 border-dashed border-gray-300 rounded-xl text-sm font-medium text-gray-500 cursor-not-allowed transition-colors">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M4 2a2 2 0 00-2 2v11a3 3 0 106 0V4a2 2 0 00-2-2H4z" clip-rule="evenodd"/>
</svg>
Voir les résultats
</a>
<button class="flex items-center justify-center px-4 py-3 border border-gray-300 rounded-lg text-sm font-medium text-gray-700 hover:bg-gray-50 transition-colors">
<svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 011 1v1a1 1 0 01-1 1H4a1 1 0 01-1-1v-1zM3 4a1 1 0 011-1h12a1 1 0 011 1v1a1 1 0 01-1 1H4a1 1 0 01-1-1V4z" clip-rule="evenodd"/>
Imprimer
<span class="ml-2 text-xs bg-gray-200 text-gray-600 px-2 py-1 rounded-full">Bientôt</span>
</button>
<button disabled class="flex items-center justify-center px-4 py-3 border-2 border-dashed border-gray-300 rounded-xl text-sm font-medium text-gray-500 cursor-not-allowed transition-colors">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path d="M8 5a1 1 0 100 2h5.586l-1.293 1.293a1 1 0 001.414 1.414l3-3a1 1 0 000-1.414l-3-3a1 1 0 10-1.414 1.414L13.586 5H8zM12 15a1 1 0 100-2H6.414l1.293-1.293a1 1 0 10-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L6.414 15H12z"/>
</svg>
Exporter
Dupliquer
<span class="ml-2 text-xs bg-gray-200 text-gray-600 px-2 py-1 rounded-full">Bientôt</span>
</button>
</div>
</div>

View File

@@ -1,128 +0,0 @@
{% extends "base.html" %}
{% block title %}{{ exercise.title }} - Gestion Scolaire{% endblock %}
{% block content %}
<div class="space-y-6">
<div class="flex justify-between items-center">
<div>
<a href="{{ url_for('assessments.detail', id=assessment.id) }}" class="text-blue-600 hover:text-blue-800 text-sm font-medium mb-2 inline-block">
← Retour à l'évaluation "{{ assessment.title }}"
</a>
<h1 class="text-2xl font-bold text-gray-900">{{ exercise.title }}</h1>
<p class="text-gray-600">{{ assessment.title }} - {{ assessment.class_group.name }}</p>
</div>
<div class="flex space-x-3">
<a href="{{ url_for('assessments.edit', id=assessment.id) }}" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors">
Modifier l'évaluation complète
</a>
</div>
</div>
<!-- Informations de l'exercice -->
<div class="bg-white shadow rounded-lg">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-lg font-medium text-gray-900">Informations de l'exercice</h2>
</div>
<div class="px-6 py-4">
<dl class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<dt class="text-sm font-medium text-gray-500">Ordre</dt>
<dd class="mt-1 text-sm text-gray-900">{{ exercise.order }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Nombre d'éléments de notation</dt>
<dd class="mt-1 text-sm text-gray-900">{{ exercise.grading_elements|length }}</dd>
</div>
{% if exercise.description %}
<div class="md:col-span-2">
<dt class="text-sm font-medium text-gray-500">Description</dt>
<dd class="mt-1 text-sm text-gray-900">{{ exercise.description }}</dd>
</div>
{% endif %}
</dl>
</div>
</div>
<!-- Éléments de notation -->
<div class="bg-white shadow rounded-lg">
<div class="px-6 py-4 border-b border-gray-200 flex justify-between items-center">
<h2 class="text-lg font-medium text-gray-900">Éléments de notation</h2>
<a href="{{ url_for('assessments.edit', id=assessment.id) }}" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors">
Modifier l'évaluation complète
</a>
</div>
<div class="px-6 py-4">
{% if exercise.grading_elements %}
<div class="space-y-4">
{% for element in exercise.grading_elements %}
<div class="border border-gray-200 rounded-lg p-4">
<div class="flex justify-between items-start">
<div class="flex-1">
<div class="flex items-center space-x-3">
<h3 class="text-sm font-medium text-gray-900">{{ element.label }}</h3>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
{% if element.grading_type == 'score' %}bg-purple-100 text-purple-800{% else %}bg-green-100 text-green-800{% endif %}">
{% if element.grading_type == 'score' %}Score (0-3){% else %}Points{% endif %}
</span>
</div>
{% if element.description %}
<p class="text-sm text-gray-600 mt-1">{{ element.description }}</p>
{% endif %}
<div class="flex items-center space-x-4 text-xs text-gray-500 mt-2">
{% if element.skill %}
<span><strong>Compétence:</strong> {{ element.skill }}</span>
{% endif %}
<span><strong>Barème:</strong> {{ element.max_points }} {% if element.grading_type == 'points' %}point(s){% else %}max{% endif %}</span>
</div>
</div>
<div class="flex space-x-2 ml-4">
<span class="text-xs text-gray-500">
Utilisez "Modifier l'évaluation complète" pour modifier
</span>
</div>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="text-center py-8">
<svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48">
<path d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8m9-16v20m5-14H9m1 4h8m1 2h8m-8 6h8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
<h3 class="mt-2 text-sm font-medium text-gray-900">Aucun élément de notation</h3>
<p class="mt-1 text-sm text-gray-500">Commencez par ajouter le premier élément de notation pour cet exercice.</p>
<div class="mt-6">
<a href="{{ url_for('assessments.edit', id=assessment.id) }}" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors">
Modifier l'évaluation complète
</a>
</div>
</div>
{% endif %}
</div>
</div>
<!-- Actions rapides -->
<div class="bg-white shadow rounded-lg">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-lg font-medium text-gray-900">Actions</h2>
</div>
<div class="px-6 py-4">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<a href="{{ url_for('grading.assessment_grading', assessment_id=assessment.id) }}" class="flex items-center justify-center px-4 py-3 border border-gray-300 rounded-lg text-sm font-medium text-gray-700 hover:bg-gray-50 transition-colors">
<svg class="w-5 h-5 mr-2 text-green-600" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zm0 4a1 1 0 011-1h12a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1V8z" clip-rule="evenodd"/>
</svg>
Saisir les notes
</a>
<button class="flex items-center justify-center px-4 py-3 border border-gray-300 rounded-lg text-sm font-medium text-gray-700 hover:bg-gray-50 transition-colors">
<svg class="w-5 h-5 mr-2 text-purple-600" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 011 1v1a1 1 0 01-1 1H4a1 1 0 01-1-1v-1zM3 4a1 1 0 011-1h12a1 1 0 011 1v1a1 1 0 01-1 1H4a1 1 0 01-1-1V4z" clip-rule="evenodd"/>
</svg>
Voir les résultats
</button>
</div>
</div>
</div>
</div>
{% endblock %}