Commits

Tairan Wang committed 34c8ed3

use the bootstrap layout and bug fix.

Comments (0)

Files changed (6)

IntranetFAQ.Web/Controllers/FaqController.cs

 
         public ActionResult Index()
         {
-            List<Faq> faqList = faqContext.Faqs.ToList<Faq>();
+            List<Faq> faqList = (from faq in faqContext.Faqs
+                                     orderby faq.LastModified descending
+                                     select faq).ToList<Faq>();
             return View(faqList);
         }
 

IntranetFAQ.Web/Views/Faq/Create.cshtml

 {
     @Html.ValidationSummary(true)
     <fieldset>
-        <legend>Faq</legend>
+        <legend>Create</legend>
         <div class="control-group">
             @Html.LabelFor(model => model.Title)
             <div class="controls">
             </div>
         </div>
         <p>
-            <input type="submit" value="Create" />
+            <input type="submit" value="Save" class="btn btn-large" />
         </p>
     </fieldset>
 }
 <div>
     @Html.ActionLink("Back to List", "Index")
 </div>
+<script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"></script>
+<script type="text/javascript">    !window.jQuery && document.write(unescape('%3Cscript src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")"%3E%3C/script%3E'))</script>
 <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
 <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

IntranetFAQ.Web/Views/Faq/Details.cshtml

     ViewBag.Title = "Details";
     Layout = "~/Views/Shared/_Html5Boilerplate.cshtml";
 }
-<h2>
-    Details</h2>
 <fieldset>
-    <legend>Faq</legend>
-    <div class="display-label">
-        UserName</div>
-    <div class="display-field">
-        @Html.DisplayFor(model => model.UserName)
-    </div>
-    <div class="display-label">
-        Title</div>
-    <div class="display-field">
-        @Html.DisplayFor(model => model.Title)
-    </div>
-    <div class="display-label">
-        Content</div>
-    <div class="display-field">
+    <legend>Details</legend>
+    <h2>@Html.DisplayFor(model => model.Title)</h2>
+    <p>
         @Html.DisplayFor(model => model.Content)
-    </div>
-    <div class="display-label">
-        LastModified</div>
-    <div class="display-field">
-        @Html.DisplayFor(model => model.LastModified)
+    </p>
+    <div>
+        Post by <a href="mailto:@Html.DisplayFor(model => model.UserName)">@Html.DisplayFor(model => model.UserName)
+        </a>| Last modified date: @Html.DisplayFor(model => model.LastModified)
+        @if (User.Identity.Name == Model.UserName)
+        {
+            <div class="pull-right">
+                @Html.ActionLink("Edit", "Edit", new { id = Model.Id })
+            </div>
+        }
     </div>
 </fieldset>
 <p>
-    @Html.ActionLink("Edit", "Edit", new { id = Model.Id }) |
     @Html.ActionLink("Back to List", "Index")
 </p>

IntranetFAQ.Web/Views/Faq/Edit.cshtml

     ViewBag.Title = "Edit";
     Layout = "~/Views/Shared/_Html5Boilerplate.cshtml";
 }
-<h2>
-    Edit</h2>    
+  
 @using (Html.BeginForm("Edit", "Faq", FormMethod.Post, new { @class = "form-horizontal" }))
 {
     @Html.ValidationSummary(true)
     <fieldset>
-        <legend>Faq</legend>
+        <legend>Edit</legend>
         @Html.HiddenFor(model => model.Id)
         <div class="control-group">
-            @Html.LabelFor(model => model.UserName)
-            <div class="controls">
-                @Html.EditorFor(model => model.UserName)
-                @Html.ValidationMessageFor(model => model.UserName)
-            </div>
-        </div>
-        <div class="control-group">
             @Html.LabelFor(model => model.Title)
             <div class="controls">
                 @Html.EditorFor(model => model.Title)
                 @Html.ValidationMessageFor(model => model.Content)
             </div>
         </div>
-        <div class="control-group">
-            @Html.LabelFor(model => model.LastModified)
-            <div class="controls">
-                @Html.EditorFor(model => model.LastModified)
-                @Html.ValidationMessageFor(model => model.LastModified)
-            </div>
-        </div>
         <p>
-            <input type="submit" value="Save" />
+            <input type="submit" value="Save" class="btn btn-large" />
         </p>
     </fieldset>
 }
 <div>
     @Html.ActionLink("Back to List", "Index")
 </div>
+<script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"></script>
+<script type="text/javascript">    !window.jQuery && document.write(unescape('%3Cscript src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")"%3E%3C/script%3E'))</script>
 <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
 <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

IntranetFAQ.Web/Views/Faq/Index.cshtml

     ViewBag.Title = "Index";
     Layout = "~/Views/Shared/_Html5Boilerplate.cshtml";
 }
-@*
-<p>
-    @Html.ActionLink("Create New", "Create")
-</p>*@
+
+<div class="container"><div class="pull-right">@Html.ActionLink("Create New", "Create", "Faq", null, new { @class = "btn btn-large" })</div></div>
+
 @foreach (var item in Model)
 {
-    <div style="padding:5px">
+    <div>
         <h2>@Html.DisplayFor(modelItem => item.Title)</h2>
         <p>
             @Html.DisplayFor(modelItem => item.Content) 
             @Html.ActionLink("read more...", "Details", new { id = item.Id })
         </p>
-        <p>
-            Author: @Html.DisplayFor(modelItem => item.UserName) Last modified date: @Html.DisplayFor(modelItem => item.LastModified)</p>
-        @if (User.Identity.Name == item.UserName)
-        {
-            @Html.ActionLink("Edit", "Edit", new { id = item.Id })
-        }
-@*@Html.ActionLink("Delete", "Delete", new { id = item.Id })*@
+        <div>
+        Post by <a href="mailto:@item.UserName"> @Html.DisplayFor(modelItem => item.UserName) </a> | Last modified date: @Html.DisplayFor(modelItem => item.LastModified)
+            <div class="pull-right">
+            @if (User.Identity.Name == item.UserName)
+            {
+                @Html.ActionLink("Edit", "Edit", new { id = item.Id })
+            }
+            </div>
+        </div>        
     </div>
     <hr />
 }

IntranetFAQ.Web/Views/Shared/_Html5Boilerplate.cshtml

     <link rel="shortcut icon" href="@Url.Content("~/favicon.ico")">
     <link rel="apple-touch-icon" href="@Url.Content("~/apple-touch-icon.png")">
     <link rel="stylesheet" href="@Url.Content("~/Content/bootstrap.min.css")">
-    <link rel="stylesheet" href="@Url.Content("~/Content/style.css?v=2")">
-    @*<link rel="stylesheet" media="handheld" href="@Url.Content("~/Content/handheld.css?v=2")">*@
+    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+    <!--[if lt IE 9]>
+      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
     <script src="@Url.Content("~/Scripts/libs/modernizr-1.7.min.js")" type="text/javascript"></script>
-    <script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"></script>
-    <script type="text/javascript">!window.jQuery && document.write(unescape('%3Cscript src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")"%3E%3C/script%3E'))</script>
+    <style type="text/css">
+        body
+        {
+            margin-top: 60px;
+        }
+    </style>
 </head>
 <body>
     <div>
-        <header class="container">
-            <div id="title">
-                <h1>Frequently Asked Questions</h1>
-            </div>
-
-            <div id="logindisplay">
-               <strong>@User.Identity.Name</strong>
-            </div>
-
-            <div id="menucontainer">
-                <ul id="menu">
-                    <li>@Html.ActionLink("Home", "Index", "Faq")</li>
-                    <li>@Html.ActionLink("Create", "Create", "Faq")</li>
-                </ul>
-            </div>
+        <header>
+            <div class="navbar navbar-fixed-top">
+              <div class="navbar-inner">
+                <div class="container">
+                    <a class="brand">Frequently Asked Questions</a>
+                    <ul class="nav">
+                        <li>@Html.ActionLink("Home", "Index", "Faq")</li>                        
+                    </ul>
+                    <div class="pull-right"><strong style="color:White">@Html.DisplayFor(name => User.Identity.Name)</strong></div>
+                </div>
+              </div>
+            </div>            
 		</header>
-        <div class="container" style="background-color:White">
+        <div class="container">
             @RenderBody()
         </div>
         <footer>
 
 		</footer>
     </div>
-    
-    <script src="@Url.Content("~/Scripts/plugins.js")" type="text/javascript"></script>
-    <script src="@Url.Content("~/Scripts/script.js")" type="text/javascript"></script>
     <!--[if lt IE 7 ]>
 	<script src="@Url.Content("~/Scripts/libs/dd_belatedpng.js")"></script>
 	<script> DD_belatedPNG.fix('img, .png_bg');</script>