Initial commit

This commit is contained in:
2020-12-12 18:38:31 +01:00
commit f877b78f33
117 changed files with 23104 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<h1>Editer un devoir</h1>
<span><%= link "Retour", to: Routes.assignment_path(@conn, :index) %></span>
<hr>
<%= render "form.html", Map.put(assigns, :action, Routes.assignment_path(@conn, :update, @assignment)) %>

View File

@@ -0,0 +1,26 @@
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>Oops, quelque chose c'est mal passé, merci de vérifier le formulaire</p>
</div>
<% end %>
<%= label f, "Classe" %>
<%= select f, :class_id, @classes %>
<%= label f, "Titre" %>
<%= text_input f, :title %>
<%= error_tag f, :title %>
<%= label f, "Dénomination" %>
<%= text_input f, :slug %>
<%= error_tag f, :slug %>
<%= label f, "Echéance" %>
<%= date_select f, :due %>
<%= error_tag f, :due %>
<div>
<%= submit "Sauvegarder" %>
</div>
<% end %>

View File

@@ -0,0 +1,38 @@
<h1>Liste des devoirs</h1>
<span><%= link "Ajouter un devoir", to: Routes.assignment_path(@conn, :new) %></span>
<hr>
<table>
<thead>
<tr>
<th>Titre</th>
<th>Dénominateur</th>
<th>Echéance</th>
<th>Classe</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<%= for assignment <- @assignments do %>
<tr>
<td><%= assignment.title %></td>
<td><%= assignment.slug %></td>
<td><%= assignment.due %></td>
<%= if assignment.class do %>
<td><%= link assignment.class.name, to: Routes.class_path(@conn, :show, assignment.class.id) %></td>
<% else %>
<td></td>
<% end %>
<td>
<span><%= link "Voir", to: Routes.assignment_path(@conn, :show, assignment) %></span>
<span><%= link "Editer", to: Routes.assignment_path(@conn, :edit, assignment) %></span>
<span><%= link "Supprimer", to: Routes.assignment_path(@conn, :delete, assignment), method: :delete, data: [confirm: "Vous êtes sur ?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,7 @@
<h1>Nouveau devoir</h1>
<span><%= link "Retour", to: Routes.assignment_path(@conn, :index) %></span>
<hr>
<%= render "form.html", Map.put(assigns, :action, Routes.assignment_path(@conn, :create)) %>

View File

@@ -0,0 +1,67 @@
<h1>Devoir : <%= @assignment.title %> | Classe : <%= @assignment.class.name %></h1>
<span><%= link "Editer", to: Routes.assignment_path(@conn, :edit, @assignment) %></span>
<span><%= link "Retour", to: Routes.assignment_path(@conn, :index) %></span>
<hr>
<h2>Informations générales</h2>
<ul>
<li>
<strong>Classe:</strong>
<%= @assignment.class.name %>
</li>
<li>
<strong>Echéance:</strong>
<%= @assignment.due %>
</li>
<li>
<strong>Dénominateur:</strong>
<%= @assignment.slug %>
</li>
</ul>
<hr>
<h2>Liste des rendus pour ce devoir</h2>
<%= if length(@assignment.students_works) > 0 do %>
<%= link "Générer une archive de tous les rendus", to: Routes.assignment_path(@conn, :archive, @assignment.id), target: "_blank" %>
<table>
<thead>
<tr>
<th>Elève</th>
<th>Date</th>
<th>Action</th>
<tr>
</thead>
<tbody>
<%= for work <- @assignment.students_works do %>
<tr>
<td><%= link "#{work.student.lastname} #{work.student.firstname}", to: Routes.student_path(@conn, :show, work.student.id) %></td>
<td><%= work.inserted_at %></td>
<td><%= link "Télécharger", to: Path.join([Application.fetch_env!(:confient, :domain), "uploads", @assignment.class.name, @assignment.slug, work.path]), target: "_blank" %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p>Aucun rendu</p>
<% end %>
<%= if length(@assignment.students_works) > 0 do %>
<h2>Liste des élèves n'ayant pas rendu ce devoir</h2>
<ul>
<%= for stud <- @missing do %>
<li><%= link "#{stud.lastname} #{stud.firstname}", to: Routes.student_path(@conn, :show, stud.id) %></li>
<% end %>
</ul>
<% end %>

View File

@@ -0,0 +1,7 @@
<h1>Editer une classe</h1>
<span><%= link "Retour", to: Routes.class_path(@conn, :index) %></span>
<hr>
<%= render "form.html", Map.put(assigns, :action, Routes.class_path(@conn, :update, @class)) %>

View File

@@ -0,0 +1,15 @@
<%= form_for @changeset, @action, [multipart: true], fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>Oops, quelque chose c'est mal passé, merci de vérifier le formulaire</p>
</div>
<% end %>
<%= label f, "Dénomination" %>
<%= text_input f, :name %>
<%= error_tag f, :name %>
<div>
<%= submit "Sauvegarder" %>
</div>
<% end %>

View File

@@ -0,0 +1,29 @@
<h1>Liste des classes</h1>
<span><%= link "Ajouter une classe", to: Routes.class_path(@conn, :new) %></span>
<hr>
<table>
<thead>
<tr>
<th>Nom</th>
<th>Nombre d'élèves</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<%= for class <- @classes do %>
<tr>
<td><%= class.name %></td>
<td><%= length(class.students) %></td>
<td>
<span><%= link "Voir", to: Routes.class_path(@conn, :show, class) %></span>
<span><%= link "Editer", to: Routes.class_path(@conn, :edit, class) %></span>
<span><%= link "Supprimer", to: Routes.class_path(@conn, :delete, class), method: :delete, data: [confirm: "Vous êtes sur ?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,7 @@
<h1>Nouvelle classe</h1>
<span><%= link "Retour", to: Routes.class_path(@conn, :index) %></span>
<hr>
<%= render "form.html", Map.put(assigns, :action, Routes.class_path(@conn, :create)) %>

View File

@@ -0,0 +1,14 @@
<h1><%= @class.name %></h1>
<span><%= link "Editer", to: Routes.class_path(@conn, :edit, @class) %></span>
<span><%= link "Retour", to: Routes.class_path(@conn, :index) %></span>
<hr>
<h2>Liste des élèves</h2>
<ul>
<%= for student <- @class.students do %>
<li><%= link "#{student.lastname} - #{student.firstname}", to: Routes.student_path(@conn, :show, student) %></li>
<% end %>
</ul>

View File

@@ -0,0 +1,23 @@
<h1>Rendu des devoirs - <%= @class.name %></h1>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>Oops, quelque chose c'est mal passé, merci de vérifier le formulaire</p>
</div>
<% end %>
<%= form_for @changeset, Routes.deposit_path(@conn, :deposit, @class.id), [multipart: true], fn f -> %>
<%= label f, "Elève" %>
<%= select f, :student_id, Enum.map(@class.students, &{"#{&1.lastname} #{&1.firstname}", &1.id}), selected: @student_id %>
<%= label f, "Devoir" %>
<%= select f, :assignment_id, Enum.map(@assignments, &{"#{&1.title} - #{&1.due}", &1.id}), selected: @assignment_id %>
<%= label f, "Fichier (formats acceptés : pdf, rtf, odt, doc, docx)" %>
<%= file_input f, :file %>
<div>
<%= submit "Envoyer" %>
</div>
<% end %>

View File

@@ -0,0 +1,24 @@
<h1>Liste des rendus</h1>
<table>
<thead>
<tr>
<th>Elève</th>
<th>Classe</th>
<th>Devoir</th>
<th>Validé</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<%= for work <- @works do %>
<tr>
<td><%= link "#{work.student.lastname} #{work.student.firstname}", to: Routes.student_path(@conn, :show, work.student.id) %></td>
<td><%= link work.student.class.name, to: Routes.class_path(@conn, :show, work.student.class.id) %></td>
<td><%= link "#{work.assignment.title} | #{work.assignment.slug}", to: Routes.assignment_path(@conn, :show, work.assignment.id) %></td>
<td><%= work.inserted_at %></td>
<td><%= link "Télécharger", to: Path.join([Application.fetch_env!(:confient, :domain), "uploads", work.student.class.name, work.assignment.slug, work.path]), target: "_blank" %></td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Confi-ENT | Rendus de devois</title>
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
<script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
</head>
<body>
<header>
<section class="container">
<%= if signed_in?(@conn) do %>
<%= link "#{String.upcase(get_username(@conn))} (Deconnexion)", to: Routes.session_path(@conn, :delete), method: :delete %>
<% else %>
<%= link "Accès Enseignant", to: Routes.session_path(@conn, :new) %>
<% end %>
<a href="/">
<img src="/images/logo.png" alt="">
</a>
</section>
<%= if signed_in?(@conn) do %>
<div class="container">
<div class="navbar">
<ul>
<li><%= link "Classes", to: Routes.class_path(@conn, :index) %></li>
<li><%= link "Elèves", to: Routes.student_path(@conn, :index) %></li>
<li><%= link "Devoirs", to: Routes.assignment_path(@conn, :index) %></li>
<li><%= link "Rendus", to: Routes.deposit_path(@conn, :index) %></li>
</ul>
</div>
</div>
<% end %>
</header>
<main role="main" class="container main">
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
<%= @inner_content %>
</main>
<footer>
<a href="https://www.phoenixframework.org/">🔥🐦</a><a href="https://git.athelas-conseils.fr/papey/confient">👨💻</a>
</footer>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<section class="hero">
<h1>Rendre un devoir</h1>
<hr>
<%= if length(@classes) > 0 do %>
<p>Sélectionner une classe</p>
<ul>
<%= for class <- @classes do %>
<li style="font-size: 2rem;"><%= link class.name, to: Routes.deposit_path(@conn, :form, class.id) %></li>
<% end %>
</ul>
<% else %>
<p>Il n'y a actuellement aucune classe dans la base de données</p>
<% end %>
<hr>
</section>

View File

@@ -0,0 +1,9 @@
<h1>Connexion à l'espace enseignant</h1>
<%= form_for @conn, Routes.session_path(@conn, :new), [as: :session], fn f -> %>
<%= label f, "Identifiant" %>
<%= text_input f, :username, placeholder: "Utilisateur" %>
<%= label f, "Mot de passe" %>
<%= password_input f, :password %>
<%= submit "Se connecter" %>
<% end %>

View File

@@ -0,0 +1,17 @@
<h1>Ajouter un lot d'élèves</h1>
<form action="<%= Routes.student_path(@conn, :bulkcreate) %>" method="post" enctype="multipart/form-data">
<input type="hidden" value="<%= @token %>" name="_csrf_token"/>
<%= label :class, "Classe" %>
<%= select :class, :class_id, @classes %>
<%= label :class, "Fichier" %>
<%= file_input :file, :list %>
<div>
<%= submit "Ajouter" %>
</div>
</form>
<span><%= link "Retour", to: Routes.student_path(@conn, :index) %></span>

View File

@@ -0,0 +1,7 @@
<h1>Editer un élève</h1>
<span><%= link "Retour", to: Routes.student_path(@conn, :index) %></span>
<hr>
<%= render "form.html", Map.put(assigns, :action, Routes.student_path(@conn, :update, @student)) %>

View File

@@ -0,0 +1,22 @@
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>Oops, quelque chose c'est mal passé, merci de vérifier le formulaire</p>
</div>
<% end %>
<%= label f, "Nom" %>
<%= text_input f, :lastname %>
<%= error_tag f, :lastname %>
<%= label f, "Prénom" %>
<%= text_input f, :firstname %>
<%= error_tag f, :firstname %>
<%= label f, "Classe" %>
<%= select f, :class_id, @classes %>
<div>
<%= submit "Sauvegarder" %>
</div>
<% end %>

View File

@@ -0,0 +1,32 @@
<h1>Liste des élèves</h1>
<span><%= link "Ajouter un élève", to: Routes.student_path(@conn, :new) %></span> |
<span><%= link "Ajouter un lot d'élèves", to: Routes.student_path(@conn, :bulkform) %></span>
<hr>
<table>
<thead>
<tr>
<th>Prénom</th>
<th>Nom</th>
<th>Classe</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<%= for student <- @students do %>
<tr>
<td><%= student.lastname %></td>
<td><%= student.firstname %></td>
<td><%= link student.class.name, to: Routes.class_path(@conn, :show, student.class.id) %></td>
<td>
<span><%= link "Voir", to: Routes.student_path(@conn, :show, student) %></span>
<span><%= link "Editer", to: Routes.student_path(@conn, :edit, student) %></span>
<span><%= link "Supprimer", to: Routes.student_path(@conn, :delete, student), method: :delete, data: [confirm: "Vous êtes sur ?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,5 @@
<h1>Ajouter un nouvel élève</h1>
<%= render "form.html", Map.put(assigns, :action, Routes.student_path(@conn, :create)) %>
<span><%= link "Retour", to: Routes.student_path(@conn, :index) %></span>

View File

@@ -0,0 +1,52 @@
<h1><%= @student.lastname %> - <%= @student.firstname %></h1>
<span><%= link "Editer", to: Routes.student_path(@conn, :edit, @student) %></span>
<span><%= link "Retour", to: Routes.student_path(@conn, :index) %></span>
<hr>
<h2>Informations générales</h2>
<ul>
<li>
<strong>Nom:</strong>
<%= @student.lastname %>
</li>
<li>
<strong>Prénom:</strong>
<%= @student.firstname %>
</li>
<li>
<strong>Classe:</strong>
<%= @student.class.name %>
</li>
</ul>
<h2>Rendus</h2>
<%= if length(@student.students_works) > 0 do %>
<table>
<thead>
<tr>
<th>Titre</th>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<%= for work <- @student.students_works do %>
<tr>
<td><%= work.assignment.title %></td>
<td><%= work.inserted_at %></td>
<td><%= link "Télécharger", to: Path.join([ConfientWeb.Endpoint.url(), "uploads", @student.class.name, work.assignment.slug, work.path]), target: "_blank" %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p>Aucun devoir rendu</p>
<% end %>