Style center content for forms

This commit is contained in:
2012-12-28 15:45:23 -05:00
parent 7eff2f343a
commit ce6fd9c215
23 changed files with 197 additions and 137 deletions
+4 -1
View File
@@ -7,7 +7,10 @@ namespace MileageTraker.Web.Attributes
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (filterContext != null)
if (filterContext != null
&& filterContext.HttpContext != null
&& filterContext.HttpContext.User != null
&& filterContext.HttpContext.User.Identity.Name != null)
{
using (var ds = new DataService())
{
+26 -17
View File
@@ -3,18 +3,11 @@ body {
padding-top: 60px;
}
#content > form {
.center-content {
display: block;
max-width: 400px;
padding: 10px;
margin: 0 auto 20px;
background-color: whitesmoke;
border: 1px solid #e5e5e5;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.brand
@@ -73,9 +66,14 @@ body {
margin-bottom: 10px;
}
.form-horizontal .form-actions {
padding-left: 160px;
margin-bottom: 0;
}
footer {
background-color: #101010;
color: #666;
border-top: whitesmoke 1px solid;
color: Gainsboro;
text-align: center;
padding: 4px;
}
@@ -176,9 +174,6 @@ dl.inline {
padding: 0 10px;
}
.navbar .brand {
}
.input-mini {
width: 60px !important;
}
@@ -204,6 +199,18 @@ dl.inline {
padding: 0;
}
h2 {
font-size: 23px;
line-height: 25px;
margin-bottom: 0;
padding: 0;
}
.center-content {
padding: 5px;
margin: 0 auto 10px;
}
#content {
padding: 0 10px;
}
@@ -218,9 +225,6 @@ dl.inline {
padding: 0 10px;
}
.navbar .brand {
}
fieldset legend {
margin-bottom: 0;
}
@@ -229,6 +233,7 @@ dl.inline {
float: left;
width: 95px;
text-align: right;
margin-top: 5px;
}
.form-horizontal .controls {
@@ -239,6 +244,10 @@ dl.inline {
margin-bottom: 10px;
}
.form-horizontal .form-actions {
padding-left: 110px;
}
.form-horizontal .control-group.endOdometer {
margin-bottom: 0;
}
+2
View File
@@ -1,8 +1,10 @@
using System.Web.Mvc;
using MileageTraker.Web.Attributes;
using MileageTraker.Web.DAL;
namespace MileageTraker.Web.Controllers
{
[UserActivity]
public class ControllerBase : Controller
{
protected readonly DataService DataService = new DataService();
-1
View File
@@ -9,7 +9,6 @@ using MileageTraker.Web.ViewModels.User;
namespace MileageTraker.Web.Controllers
{
[Authorize(Roles = "Administrator, Developer")]
[UserActivity]
public class UserController : ControllerBase
{
public ActionResult Index()
+5 -1
View File
@@ -129,7 +129,11 @@ $(function() {
$(function() {
// Add active class to nav
var idNavActiveRegex = { 'log-nav': /\/log/i, 'vehicle-nav': /\/vehicle/i };
var idNavActiveRegex = {
'log-nav': /\/log/i,
'vehicle-nav': /\/vehicle/i,
'user-nav': /\/user/i
};
$.each(idNavActiveRegex, function (id, regex) {
if (regex.test(document.URL)) {
$("#" + id).addClass('active');
+6
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.SqlTypes;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -99,6 +100,11 @@ namespace MileageTraker.Web.Utility
return value;
}
public static bool IsSqlMinValue(this DateTime dt)
{
return dt == SqlDateTime.MinValue.Value;
}
public static string ToVerboseStringHistoric(this TimeSpan ts)
{
if (ts.TotalDays == 0)
+8 -4
View File
@@ -3,10 +3,14 @@
ViewBag.Title = "Manage Account";
}
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
<p class="label label-success">@ViewBag.StatusMessage</p>
<p class="center-content label label-success">@ViewBag.StatusMessage</p>
<p>You're logged in as <strong>@User.Identity.Name</strong>.</p>
<div class="center-content well">
@Html.Partial("_ChangePasswordPartial")
<p>You're logged in as <strong>@User.Identity.Name</strong>.</p>
@Html.Partial("_ChangePasswordPartial")
</div>
@@ -8,6 +8,8 @@
<fieldset>
<legend></legend>
@Html.EditorForModel()
<input type="submit" value="Change password" class="btn btn-primary" />
<div class="form-actions">
<input type="submit" value="Change password" class="btn btn-primary" />
</div>
</fieldset>
}
+11 -11
View File
@@ -8,13 +8,17 @@
<link href="@Url.Content("~/Content/VehicleColors.css")" rel="stylesheet" type="text/css" />
}
<h2 class="center-content">@ViewBag.Title</h2>
<p class="alert center-content">Please <strong>confirm</strong> - entry not complete until <strong>confirm</strong> clicked</p>
@* ReSharper disable Mvc.ActionNotResolved *@
@using (Html.BeginForm("Action", "CreateLog", FormMethod.Post))
@using (Html.BeginForm("Action", "CreateLog", FormMethod.Post, new { @class = "form-horizontal well center-content" } ))
{
@* ReSharper restore Mvc.ActionNotResolved *@
<fieldset>
<legend>@ViewBag.Title</legend>
<p class="alert">Please <strong>confirm</strong> - entry not complete until <strong>confirm</strong> clicked</p>
<legend></legend>
@if (Model.Miles == 0)
{
<p class="alert"><span class="label label-warning">Warning</span> No mileage being logged - <strong>is this a duplicate?</strong></p>
@@ -95,14 +99,10 @@
</dl>
@Html.HiddenFor(model => model.Date)
<dl class="dl-horizontal">
<dt>
<input type="submit" name="Edit" value="Back" class="btn" />
</dt>
<dd>
<input type="submit" name="Confirm" value="Confirm" class="btn btn-primary" />
</dd>
</dl>
<div class="form-actions">
<input type="submit" name="Confirm" value="Confirm" class="btn btn-primary" />
<input type="submit" name="Edit" value="Back" class="btn" />
</div>
</fieldset>
}
+6 -6
View File
@@ -4,16 +4,16 @@
ViewBag.Title = "Enter Mileage Log";
}
@using (Html.BeginForm("Index", "CreateLog", FormMethod.Post, new { @class = "form-horizontal" }))
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Index", "CreateLog", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
{
<fieldset>
<legend>@ViewBag.Title</legend>
<legend></legend>
@Html.Partial("_ValidationSummary")
@Html.EditorForModel()
<div class="control-group">
<div class="controls">
<input type="submit" value="Submit" class="btn btn-primary" />
</div>
<div class="form-actions">
<input type="submit" value="Submit" class="btn btn-primary" />
</div>
</fieldset>
}
+12 -14
View File
@@ -1,19 +1,17 @@
@model MileageTraker.Web.ViewModels.CreateLog.CreateLogViewModel
@{
ViewBag.Title = "Success";
}
@{
<h4>@ViewBag.Title</h4>
<p>
You've successfully created an entry
for <strong>@Html.DisplayTextFor(m => m.EmployeeName)</strong>
traveling to <strong>@Html.DisplayTextFor(m => m.CityName)</strong>
on <strong>@Html.Encode(Model.Date.ToShortDateString())</strong>
in Vehicle Id <strong>@Html.DisplayTextFor(m => m.VehicleId)</strong>
</p>
<p>
@Html.ActionLink("Create another", "Index", null, new { @class = "btn" })
</p>
}
<p class="alert alert-success center-content">
You've successfully created an entry
for <strong>@Html.DisplayTextFor(m => m.EmployeeName)</strong>
traveling to <strong>@Html.DisplayTextFor(m => m.CityName)</strong>
on <strong>@Html.Encode(Model.Date.ToShortDateString())</strong>
in Vehicle Id <strong>@Html.DisplayTextFor(m => m.VehicleId)</strong>
ending in <strong>@Html.DisplayTextFor(m => m.EndOdometer)</strong>
miles on the odometer.
</p>
<p class="center-content">
@Html.ActionLink("Create another", "Index", null, new { @class = "btn" })
</p>
+4 -5
View File
@@ -6,17 +6,16 @@
@{ Html.RenderPartial("BackToLogs"); }
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Create", "Log", FormMethod.Post, new { @class = "form-horizontal" })) {
@using (Html.BeginForm("Create", "Log", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
{
@Html.Partial("_ValidationSummary")
<fieldset>
<legend></legend>
@Html.EditorForModel()
<div class="control-group">
<div class="controls">
<div class="form-actions">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</div>
</fieldset>
}
+13 -9
View File
@@ -6,15 +6,19 @@
@{ Html.RenderPartial("BackToLogs"); }
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
<h3>Are you sure you wish to delete this log?</h3>
<div class="center-content label label-warning">Are you sure you wish to delete this log?</div>
@Html.DisplayForModel()
<div class="center-content well">
@using (Html.BeginForm()) {
<p>
<input type="submit" value="Delete" class="btn btn-warning" />
@Html.ActionLink("Cancel", "Details", new { id = Model.LogId }, new { @class = "btn" })
</p>
}
@Html.DisplayForModel()
@using (Html.BeginForm("Delete", "Log", FormMethod.Post, new { @class = "form-horizontal" }))
{
<div class="form-actions">
<input type="submit" value="Delete" class="btn btn-warning" />
@Html.ActionLink("Cancel", "Details", new { id = Model.LogId }, new { @class = "btn" })
</div>
}
</div>
+5 -3
View File
@@ -6,7 +6,7 @@
@{ Html.RenderPartial("BackToLogs"); }
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
<div>
<ul class="pager">
@@ -22,9 +22,11 @@
</ul>
</div>
<div class="center-content well">
@Html.DisplayForModel()
</div>
<div class="btn-toolbar">
<div class="center-content btn-toolbar">
@Html.ActionLink("Edit", "Edit", new { id = Model.LogId }, new { @class = "btn" })
@Html.ActionLink("Delete", "Delete", new { id = Model.LogId }, new { @class = "btn" })
</div>
</div>
+4 -6
View File
@@ -6,9 +6,9 @@
@{ Html.RenderPartial("BackToLogs"); }
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Edit", "Log", FormMethod.Post, new { @class = "form-horizontal" }))
@using (Html.BeginForm("Edit", "Log", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
{
@Html.Partial("_ValidationSummary")
<fieldset>
@@ -16,10 +16,8 @@
@Html.EditorForModel()
<div class="control-group">
<div class="controls">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
<div class="form-actions">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</fieldset>
}
+3 -2
View File
@@ -2,7 +2,8 @@
ViewBag.Title = "No Logs";
}
<h2>@ViewBag.Title</h2>
<div>
<h2 class="center-content">@ViewBag.Title</h2>
<div class="center-content well">
No logs have been added. @Html.ActionLink("Create Log", "Create", null, new { @class = "btn" }).
</div>
+4 -5
View File
@@ -6,18 +6,17 @@
@{ Html.RenderPartial("BackToUsers"); }
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Create", "User", FormMethod.Post, new { @class = "form-horizontal" })) {
@using (Html.BeginForm("Create", "User", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
{
@Html.Partial("_ValidationSummary")
<fieldset>
<legend></legend>
@Html.EditorForModel()
@Html.Partial("_Roles", Model)
<div class="control-group">
<div class="controls">
<div class="form-actions">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</div>
</fieldset>
}
+47 -17
View File
@@ -1,4 +1,5 @@
@model MileageTraker.Web.Models.User
@using MileageTraker.Web.Utility
@model MileageTraker.Web.Models.User
@{
ViewBag.Title = "User Details";
@@ -6,25 +7,54 @@
@{ Html.RenderPartial("BackToUsers"); }
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
@Html.DisplayFor(m => m.Email)
@Html.DisplayFor(m => m.Username)
<div class="center-content well">
<dl class="dl-horizontal roles">
<dt>
@Html.DisplayNameFor(m => m.Roles)
</dt>
<dd>
@Html.Encode(string.Join(", ", Roles.Provider.GetRolesForUser(Model.Username)))
</dd>
</dl>
@Html.DisplayFor(m => m.Email)
@Html.DisplayFor(m => m.Username)
@Html.DisplayFor(m => m.IsLockedOut)
@if (Model.IsLockedOut) {
@Html.DisplayFor(m => m.LastLockoutDate)
}
<dl class="dl-horizontal roles">
<dt>
@Html.DisplayNameFor(m => m.Roles)
</dt>
<dd>
@{ var roles = Roles.Provider.GetRolesForUser(Model.Username); }
@if (roles.Length > 0)
{
@Html.Encode(string.Join(", ", roles))
}
else
{
<span class='label label-warning'>No Role</span>
}
</dd>
</dl>
<div class="btn-toolbar">
@Html.DisplayFor(m => m.IsLockedOut)
@if (Model.IsLockedOut) {
@Html.DisplayFor(m => m.LastLockoutDate)
}
<dl class="dl-horizontal lastActivity">
<dt>
@Html.DisplayNameFor(m => m.LastActivityDate)
</dt>
<dd>
@if (!Model.LastActivityDate.IsSqlMinValue())
{
@Html.Encode(Model.LastActivityDate)
<span class="muted">(@Html.Encode((DateTime.Now - Model.LastActivityDate).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>No Activity</span>
}
</dd>
</dl>
</div>
<div class="btn-toolbar center-content">
@Html.ActionLink("Edit", "Edit", new { id = Model.UserId }, new { @class = "btn" })
</div>
+4 -6
View File
@@ -6,9 +6,9 @@
@{ Html.RenderPartial("BackToUsers"); }
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Edit", "User", FormMethod.Post, new { @class = "form-horizontal" }))
@using (Html.BeginForm("Edit", "User", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
{
@Html.Partial("_ValidationSummary")
@@ -17,10 +17,8 @@
@Html.EditorForModel()
<div class="control-group">
<div class="controls">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
<div class="form-actions">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</fieldset>
}
+15 -11
View File
@@ -27,20 +27,24 @@
}
@if (item.IsLockedOut) {
<span class='label label-warning' title="@string.Format("Locked out on {0:d}", item.LastLockoutDate)">Locked Out</span>
}
@if (!item.IsApproved)
{
<span class='label label-inverse'>Account Disabled</span>
}</text> ),
grid.Column("FullName", "Full Name"),
grid.Column("Roles", format:
@<text>
@{ var roles = Roles.Provider.GetRolesForUser(item.Username); }
@if (roles.Length > 0)
{
@Html.Encode(string.Join(", ", roles))
}
else
{
<span class='label label-warning'>No Role</span>
}
</text>),
@<text>
@{ var roles = Roles.Provider.GetRolesForUser(item.Username); }
@if (roles.Length > 0)
{
@Html.Encode(string.Join(", ", roles))
}
else
{
<span class='label label-warning'>No Role</span>
}
</text>),
grid.Column(format:
@<div class='btn-group'>
@Html.ActionLink("Edit", "Edit", new { id = item.UserId }, new { @class = "btn btn-mini" })
+4 -6
View File
@@ -6,19 +6,17 @@
@{ Html.RenderPartial("BackToVehicles"); }
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Create", "Vehicle", FormMethod.Post, new { @class = "form-horizontal" }))
@using (Html.BeginForm("Create", "Vehicle", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
{
@Html.Partial("_ValidationSummary")
<fieldset>
<legend></legend>
@Html.EditorForModel()
<div class="control-group">
<div class="controls">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
<div class="form-actions">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</fieldset>
}
+7 -5
View File
@@ -10,10 +10,12 @@
@{ Html.RenderPartial("BackToVehicles"); }
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
<div class="center-content well">
@Html.DisplayForModel()
@Html.DisplayForModel()
<div class="btn-toolbar">
@Html.ActionLink("Edit", "Edit", new { id = Model.VehicleId }, new { @class = "btn" })
</div>
<div class="center-content btn-toolbar">
@Html.ActionLink("Edit", "Edit", new { id = Model.VehicleId }, new { @class = "btn" })
</div>
+4 -6
View File
@@ -6,18 +6,16 @@
@{ Html.RenderPartial("BackToVehicles"); }
<h2>@ViewBag.Title</h2>
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Edit", "Vehicle", FormMethod.Post, new { @class = "form-horizontal" }))
@using (Html.BeginForm("Edit", "Vehicle", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
{
@Html.Partial("_ValidationSummary")
<fieldset>
<legend></legend>
@Html.EditorForModel()
<div class="control-group">
<div class="controls">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
<div class="form-actions">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</fieldset>
}