Browse Source

Refact: refonte des tables de la vue ActionsEdu

olivier.massot 7 years ago
parent
commit
777cdce727

+ 0 - 2
CD67.FicheCollege.MVC/CD67.FicheCollege.MVC.csproj

@@ -477,12 +477,10 @@
     <Content Include="Views\ActionsEdu\Edit.cshtml" />
     <Content Include="Views\ActionsEdu\Index.cshtml" />
     <Content Include="Views\ActionsEdu\Details.cshtml" />
-    <Content Include="Views\ActionsEduCollege\Details.cshtml" />
     <Content Include="Views\ActionsEduCollege\Edit.cshtml" />
     <Content Include="Views\Shared\_AdminLayout.cshtml" />
     <Content Include="Views\Colleges\Import.cshtml" />
     <Content Include="Views\ActionsEdu\Import.cshtml" />
-    <Content Include="Views\ActionsEduActeurs\Details.cshtml" />
     <Content Include="Views\ActionsEduActeurs\Edit.cshtml" />
     <Content Include="Views\Restauration\Index.cshtml" />
     <Content Include="Views\RestaurationTypes\Edit.cshtml" />

+ 4 - 0
CD67.FicheCollege.MVC/Content/cd67-custom.less

@@ -298,4 +298,8 @@ header nav{
 
 .btn-bar .btn {
     margin-left: 15px;
+}
+
+.table-hover tbody tr:hover td, .table-hover tbody tr:hover th {
+  background-color: lighten(@color1,25%) !important;
 }

+ 0 - 1
CD67.FicheCollege.MVC/Content/cd67-model.less

@@ -508,7 +508,6 @@ ul {
 }
 
 
-
 .div-resultat{
     clear:both
 }

+ 2 - 26
CD67.FicheCollege.MVC/Controllers/ActionsEduController.cs

@@ -75,7 +75,7 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 ActionEduFactory fact = new ActionEduFactory(db);
                 fact.add(ref actionEdu);
-                return RedirectToAction("Index", new { annee_id = actionEdu.AnneeId });
+                return RedirectToAction("Details", new { id = actionEdu.Id });
             }
             ActionEduViewModel model = new ActionEduViewModel(actionEdu, db, ModeAcces.Creation);
             return View("Edit", model);
@@ -109,7 +109,7 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 ActionEduFactory fact = new ActionEduFactory(db);
                 fact.update(ref actionEdu);
-                return RedirectToAction("Index", new { annee_id = actionEdu.AnneeId });
+                return RedirectToAction("Details", new { id = actionEdu.Id });
             }
             if (actionEdu.Annee == null)
             {
@@ -215,30 +215,6 @@ namespace CD67.FicheCollege.MVC.Controllers
             return RedirectToAction("Index", new { annee_id = Annee_Id });
         }
 
-        public ActionResult Up(int? id)
-        {
-            if (id == null)
-            {
-                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
-            }
-            ActionEduFactory fact = new ActionEduFactory(db);
-            ActionEdu actionEdu = fact.getById(id.Value);
-            fact.Up(ref actionEdu);
-            return RedirectToAction("Index", new { annee_id = actionEdu.AnneeId });
-        }
-
-        public ActionResult Down(int? id)
-        {
-            if (id == null)
-            {
-                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
-            }
-            ActionEduFactory fact = new ActionEduFactory(db);
-            ActionEdu actionEdu = fact.getById(id.Value);
-            fact.Down(ref actionEdu);
-            return RedirectToAction("Index", new { annee_id = actionEdu.AnneeId });
-        }
-
         protected override void Dispose(bool disposing)
         {
             if (disposing)

+ 28 - 4
CD67.FicheCollege.MVC/Views/ActionsEdu/Details.cshtml

@@ -79,21 +79,33 @@
     </span>
 </legend>
 
-<table class="table datatable">
+<table class="table table-hover">
     <thead>
         <tr>
             <th>Acteur</th>
             <th>Rôle</th>
             <th>Commentaire</th>
+            <th width="1px"></th> @*'width=1px' >> force the minimum width*@ 
+            <th width="1px"></th>
         </tr>
     </thead>
     <tbody>
         @foreach (ActionEduActeur item in Model.Obj.ActionEduActeurs)
         {
-            <tr data-url="@Url.Action("Details", "ActionsEduActeurs", new { Id = item.Id })">
+            <tr>
                 <td>@Html.DisplayFor(model => item.Nom)</td>
                 <td>@Html.DisplayFor(model => item.ActionEduActeurRole.Libelle)</td>
                 <td>@Html.DisplayFor(model => item.Commentaire)</td>
+                <td>
+                    <a class="btn btn-primary btn-xs" href="@Url.Action("Edit", "ActionsEduActeurs", new { Id = item.Id })" title="Modifier l'acteur">
+                        <i class="glyphicon glyphicon-pencil"></i> 
+                    </a>
+                </td>
+                <td>
+                    <a class="btn btn-danger btn-xs" href="@Url.Action("Delete", "ActionsEduActeurs", new { Id = item.Id })" title="Retirer l'acteur">
+                        <i class="glyphicon glyphicon-remove"></i>
+                    </a>
+                </td>
             </tr>
         }
     </tbody>
@@ -110,21 +122,33 @@
     </span>
 </legend>
 
-<table class="table datatable">
+<table class="table table-hover">
     <thead>
         <tr>
             <th>Collège</th>
             <th>Nombre d'élèves</th>
             <th>Commentaire</th>
+            <th width="1px"></th> @*'width=1px' >> force the minimum width*@ 
+            <th width="1px"></th>
         </tr>
     </thead>
     <tbody>
         @foreach (ActionEduCollege item in Model.Obj.ActionsEduColleges)
         {
-        <tr data-url="@Url.Action("Details", "ActionsEduCollege", new { Id = item.Id })">
+        <tr>
             <td><a href=@Url.Action("Details", "Colleges", new { Id = item.College.Id })>@item.College.Libelle</a></td>
             <td>@Html.DisplayFor(model => item.NbEleves)</td>
             <td>@Html.DisplayFor(model => item.Commentaire)</td>
+            <td>
+                <a class="btn btn-primary btn-xs" href="@Url.Action("Edit", "ActionsEduCollege", new { Id = item.Id })" title="Modifier l'affectation">
+                    <i class="glyphicon glyphicon-pencil"></i> 
+                </a>
+            </td>
+            <td>
+                <a class="btn btn-danger btn-xs" href="@Url.Action("Delete", "ActionsEduCollege", new { Id = item.Id })" title="Retirer le collège">
+                    <i class="glyphicon glyphicon-remove"></i>
+                </a>
+            </td>
         </tr>
         }
     </tbody>

+ 0 - 34
CD67.FicheCollege.MVC/Views/ActionsEduActeurs/Details.cshtml

@@ -1,34 +0,0 @@
-@using CD67.FicheCollege.MVC.Models
-@model ActionEduActeurViewModel
-
-@{
-    ViewBag.Title = "Details";
-    Layout = "~/Views/Shared/_Layout.cshtml";
-    ActionEduActeur actionEduActeur = Model.Obj;
-}
-
-<header>
-    <h2>Acteur '@actionEduActeur.Nom'</h2>
-</header>
-
-<fieldset>
-    <legend>
-        Informations
-        @if (Model.Acces == ModeAcces.Lecture)
-        {
-            <span class="pull-right">
-                @Html.ActionLink("Modifier", "Edit", "ActionsEduActeurs", new { Id = actionEduActeur.Id }, new { @class = "btn btn-primary" })
-                @Html.ActionLink("Supprimer", "Delete", "ActionsEduActeurs", new { Id = actionEduActeur.Id }, new { @class = "btn btn-default" })
-            </span>
-        }
-    </legend>
-    <dl class="dl-horizontal">
-        <dt>@Html.DisplayNameFor(model => actionEduActeur.RoleId)</dt>
-        <dd>@Html.DisplayFor(model => actionEduActeur.ActionEduActeurRole.Libelle)</dd>
-
-        <dt>@Html.DisplayNameFor(model => actionEduActeur.Commentaire)</dt>
-        <dd>@Html.DisplayFor(model => actionEduActeur.Commentaire)</dd>
-    </dl>
-</fieldset>
-
-<a href="@Url.Action("Details", "ActionsEdu", new { id = actionEduActeur.ActionEdu.Id })">Retour à l'action</a>

+ 0 - 36
CD67.FicheCollege.MVC/Views/ActionsEduCollege/Details.cshtml

@@ -1,36 +0,0 @@
-@using CD67.FicheCollege.MVC.Models
-@model ActionEduCollegeViewModel
-
-@{
-    ViewBag.Title = "Details";
-    Layout = "~/Views/Shared/_Layout.cshtml";
-    ActionEduCollege actionEduCollege = Model.Obj;
-}
-
-<header>
-    <h2>Action Educative '@actionEduCollege.ActionEdu.Nom' à @actionEduCollege.College.Libelle</h2>
-    
-</header>
-
-<fieldset>
-    <legend>
-        Informations
-        @if (Model.Acces == ModeAcces.Lecture)
-        {
-            <span class="pull-right">
-                @Html.ActionLink("Modifier", "Edit", "ActionsEduCollege", new { Id = actionEduCollege.Id }, new { @class = "btn btn-primary" })
-                @Html.ActionLink("Supprimer", "Delete", "ActionsEduCollege", new { Id = actionEduCollege.Id }, new { @class = "btn btn-default" })
-            </span>
-        }
-    </legend>
-    <dl class="dl-horizontal">
-        <dt>@Html.DisplayNameFor(model => actionEduCollege.NbEleves)</dt>
-        <dd>@Html.DisplayFor(model => actionEduCollege.NbEleves)</dd>
-
-        <dt>@Html.DisplayNameFor(model => actionEduCollege.Commentaire)</dt>
-        <dd>@Html.DisplayFor(model => actionEduCollege.Commentaire)</dd>
-    </dl>
-</fieldset>
-
-
-<a href="@Url.Action("Details", "ActionsEdu", new { id = actionEduCollege.ActionEdu.Id })">Retour à l'index</a>