Browse Source

NEW Ajout d'un focus au chargement paramétrable

julien.legrand 8 years ago
parent
commit
3aafe22379

+ 1 - 0
CD67.ModeleMVC.MVC/CD67.ModeleMVC.MVC.csproj

@@ -234,6 +234,7 @@
     <Content Include="fonts\fontawesome-webfont.ttf" />
     <Content Include="fonts\fontawesome-webfont.eot" />
     <None Include="Scripts\jquery-3.1.1-vsdoc.js" />
+    <Content Include="Scripts\cd67-autofocus.js" />
     <Content Include="Scripts\cd67-Jquery.UI.DatePicker.js" />
     <Content Include="Scripts\jquery-3.1.1.js" />
     <Content Include="Scripts\jquery-3.1.1.min.js" />

+ 3 - 0
CD67.ModeleMVC.MVC/Scripts/cd67-autofocus.js

@@ -0,0 +1,3 @@
+//L'ajout d'une classe autofocus donne le focus au controle au chargement de la page
+//Exemple : @Html.EditorFor(model => model.Libelle, new { htmlAttributes = new { @class = "form-control autofocus" } })
+$(function () { $('.autofocus').focus(); });

+ 1 - 1
CD67.ModeleMVC.MVC/Views/TYPE_VIKING/Create.cshtml

@@ -29,7 +29,7 @@
         <div class="form-group">
             @Html.LabelFor(model => model.TYPE, htmlAttributes: new { @class = "control-label col-md-2" })
             <div class="col-md-10">
-                @Html.EditorFor(model => model.TYPE, new { htmlAttributes = new { @class = "form-control" } })
+                @Html.EditorFor(model => model.TYPE, new { htmlAttributes = new { @class = "form-control autofocus" } })
                 @Html.ValidationMessageFor(model => model.TYPE, "", new { @class = "text-danger" })
             </div>
         </div>

+ 1 - 1
CD67.ModeleMVC.MVC/Views/TYPE_VIKING/Edit.cshtml

@@ -21,7 +21,7 @@
         <div class="form-group">
             @Html.LabelFor(model => model.TYPE, htmlAttributes: new { @class = "control-label col-md-2" })
             <div class="col-md-10">
-                @Html.EditorFor(model => model.TYPE, new { htmlAttributes = new { @class = "form-control" } })
+                @Html.EditorFor(model => model.TYPE, new { htmlAttributes = new { @class = "form-control autofocus" } })
                 @Html.ValidationMessageFor(model => model.TYPE, "", new { @class = "text-danger" })
             </div>
         </div>

+ 1 - 1
CD67.ModeleMVC.MVC/Views/VIKINGS/Create.cshtml

@@ -29,7 +29,7 @@
         <div class="form-group">
             @Html.LabelFor(model => model.NOM, htmlAttributes: new { @class = "control-label col-md-2" })
             <div class="col-md-10">
-                @Html.EditorFor(model => model.NOM, new { htmlAttributes = new { @class = "form-control" } })
+                @Html.EditorFor(model => model.NOM, new { htmlAttributes = new { @class = "form-control autofocus" } })
                 @Html.ValidationMessageFor(model => model.NOM, "", new { @class = "text-danger" })
             </div>
         </div>

+ 1 - 1
CD67.ModeleMVC.MVC/Views/VIKINGS/Edit.cshtml

@@ -21,7 +21,7 @@
         <div class="form-group">
             @Html.LabelFor(model => model.NOM, htmlAttributes: new { @class = "control-label col-md-2" })
             <div class="col-md-10">
-                @Html.EditorFor(model => model.NOM, new { htmlAttributes = new { @class = "form-control" } })
+                @Html.EditorFor(model => model.NOM, new { htmlAttributes = new { @class = "form-control autofocus" } })
                 @Html.ValidationMessageFor(model => model.NOM, "", new { @class = "text-danger" })
             </div>
         </div>