瀏覽代碼

NEW Ajout des classes no-screen et no-print

julien.legrand 8 年之前
父節點
當前提交
cb4a3ee6d1

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

@@ -153,6 +153,7 @@
   <ItemGroup>
     <Compile Include="App_Start\BundleConfig.cs" />
     <Compile Include="Controllers\HomeController.cs" />
+    <Compile Include="Controllers\PrintTestController.cs" />
     <Compile Include="Controllers\TYPE_VIKINGController.cs" />
     <Compile Include="Controllers\VIKINGSController.cs" />
     <Compile Include="Global.asax.cs">
@@ -314,6 +315,7 @@
     <Content Include="Views\Shared\DisplayTemplates\CanonicalHelperModel.cshtml" />
     <Content Include="Views\Shared\DisplayTemplates\Date.cshtml" />
     <Content Include="Views\Shared\EditorTemplates\Date.cshtml" />
+    <Content Include="Views\PrintTest\Index.cshtml" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="App_Data\" />

+ 4 - 1
CD67.ModeleMVC.MVC/Content/cd67-model.css

@@ -1,4 +1,7 @@
-.navbar-login {
+.no-print { /* Comportement défini dans le layout */ }
+.no-screen { /* Comportement défini dans le layout */ }
+
+.navbar-login {
     width: 300px;
     padding: 10px;
     padding-bottom: 0px;

+ 17 - 0
CD67.ModeleMVC.MVC/Controllers/PrintTestController.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace CD67.ModeleMVC.MVC.Controllers
+{
+    public class PrintTestController : Controller
+    {
+        // GET: PrintTest
+        public ActionResult Index()
+        {
+            return View();
+        }
+    }
+}

+ 1 - 1
CD67.ModeleMVC.MVC/Mvc.sitemap

@@ -14,7 +14,7 @@
       <mvcSiteMapNode title="Details Viking" controller="VIKINGS" action="Details" preservedRouteParameters="id" />
     </mvcSiteMapNode>
 
-    <mvcSiteMapNode title="About" controller="Home" action="About" />
+    <mvcSiteMapNode title="Tests d'impression" controller="PrintTest" action="Index" />
   </mvcSiteMapNode>
 
 </mvcSiteMap>

+ 19 - 0
CD67.ModeleMVC.MVC/Views/PrintTest/Index.cshtml

@@ -0,0 +1,19 @@
+
+@{
+    ViewBag.Title = "Index";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h2>Tests</h2>
+
+<p>
+    texte normal
+</p>
+
+<p class="no-print">
+    Texte n'apparaissant qu'à l'écran
+</p>
+
+<p class="no-screen">
+    Texte n'apparaissant qu'à l'impression
+</p>

+ 13 - 4
CD67.ModeleMVC.MVC/Views/Shared/_Layout.cshtml

@@ -26,6 +26,15 @@
     @Scripts.Render("~/bundles/bootstrap")
     @Scripts.Render("~/bundles/cd67")
     @Styles.Render("~/Content/css")
+
+    <!-- Ajout des classes no-screen et no-print -->
+    <style media="print">
+        .no-print{display: none}
+    </style>
+    <style type="text/css" media="screen">
+        .no-screen{display: none}
+    </style>
+
 </head>
 
 <body>
@@ -70,7 +79,7 @@
                 </ul>
             </div>
         </nav>
-        <sidebar class="background-color2 navbar-fixed-top nav-stacked" id="sidebar-wrapper">
+        <sidebar class="background-color2 navbar-fixed-top nav-stacked no-print" id="sidebar-wrapper">
             <ul class="sidebar-nav nav-stacked" id="menu">
                 <li>
                     <a id="menu-Accueil" class="active" href="/"><span class="fa-stack fa-lg pull-left "><i class="fa fa-home fa-stack-1x  "></i></span> Accueil</a>
@@ -79,10 +88,10 @@
                     <a id="menu-Vikings" href="/VIKINGS"><span class="fa-stack fa-lg pull-left"><i class="fa fa-gg fa-stack-1x "></i></span>Vikings</a>
                 </li>
                 <li>
-                    <a id="menuType" href="/TYPE_VIKING"><span class="fa-stack fa-lg pull-left"><i class="fa fa-leanpub fa-stack-1x "></i></span>Types de Vikings</a>
+                    <a id="menu-Type" href="/TYPE_VIKING"><span class="fa-stack fa-lg pull-left"><i class="fa fa-leanpub fa-stack-1x "></i></span>Types de Vikings</a>
                 </li>
                 <li>
-                    <a id="menu-Contact" href="#"><span class="fa-stack fa-lg pull-left"><i class="fa fa-connectdevelop fa-stack-1x "></i></span>Contact</a>
+                    <a id="menu-Print" href="/PrintTest"><span class="fa-stack fa-lg pull-left"><i class="fa fa-print fa-stack-1x "></i></span>Test impression</a>
                 </li>
             </ul>
         </sidebar>
@@ -90,7 +99,7 @@
     </header>
     
     <div id="wrapper">
-        <div class="page-wrap" >
+        <div class="page-wrap no-print" >
             @Html.MvcSiteMap().SiteMapPath()
         </div>
         <div id="content" >