This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyModel | |
{ | |
[DisplayFormat(DataFormatString = "{0:MM/dd/yy}", ApplyFormatInEditMode = true)] | |
public DateTime DateField { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model MaidBrigade.Web.Models.Foo | |
@using (Html.BeginForm()) | |
{ | |
@Html.ValidationSummary(true) | |
<fieldset><legend>Create @(ViewBag.Title)</legend> | |
@Html.Partial("_CreateOrEdit", Model) | |
<p> | |
@Html.ActionLink("Back to List", "Index") | |
<input type="submit" value="Create" class="btn primary" /> | |
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generic Controller base class | |
public abstract class GController<TModel> : Controller where TModel : ModelRoot | |
{ | |
private readonly Mvc4Context _context = new Mvc4Context(); | |
// Public accessors for dbContext | |
public Mvc4Context DbContext { get { return _context; } } | |
public virtual ViewResult Index() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Model with ForiegnKey | |
public class Foo : ModelBase | |
{ | |
public string SomeProperty { get; set; } | |
public int BarId { get; set; } | |
public Bar Bar { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$.ajaxSetup({ | |
cache: false | |
}); | |
return window.CrudHelpers = { | |
ajaxAdd: function(url, dataToSave, callback) { | |
return this.ajaxModify(url, dataToSave, "POST", "add", callback); | |
}, | |
ajaxUpdate: function(url, dataToSave, successCallback) { | |
dataToSave.ModifyDate = new Date(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.knockmeout.net/2011/03/guard-your-model-accept-or-cancel-edits.html | |
//wrapper to an observable that requires accept/cancel | |
$(function () { | |
ko.protectedObservable = function (initialValue) { | |
var result, _actualValue, _tempValue; | |
if (initialValue && typeof (initialValue) === "string" && initialValue.indexOf("/Date(") === 0) { | |
initialValue = new Date(parseInt(initialValue.match(/\d+/))).toString(); | |
} | |
_actualValue = ko.observable(initialValue); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.prototype.formatMMDDYYY = function() { | |
return this.getMonth() + 1 + '/' + this.getDate() + '/' + this.getFullYear(); | |
}; | |
Date.prototype.formatMMDD = function() { | |
return this.getMonth() + 1 + '/' + this.getDate(); | |
}; | |
Date.prototype.addDays = function(days) { | |
days = this.getDate() + days; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.clear_margin_padding() { | |
margin: 0 !important; | |
padding: 0 !important; | |
padding-left: 0px !important; | |
padding-right: 0px !important; | |
} | |
.rounded-corners (@radius: 5px) { | |
border-radius: @radius; | |
-webkit-border-radius: @radius; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="//dl.dropbox.com/u/148605/compass3/public/stylesheets/parkway_west.css" rel="stylesheet" type="text/css" /> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script> | |
<script type="text/javascript" language="javascript" src="//dl.dropbox.com/u/148605/compass3/public/javascripts/parkway_west.js" ></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body{ margin: 0; position: relative; } | |
.page-width { width: 960px; margin: 0 auto; } | |
/* BEGIN: side borders */ | |
#border-wrapper { | |
z-index: 100; | |
position: absolute; | |
width: 100%; | |
height: 100%; |