A few small tweaks to the C# part of the Grid editor for coding standards

This commit is contained in:
Jeavon Leopold
2014-11-10 14:43:43 +00:00
parent 306a30265e
commit c0c624d62e
2 changed files with 13 additions and 13 deletions

View File

@@ -17,7 +17,7 @@ namespace Umbraco.Web
public static MvcHtmlString GetGridHtml(this IPublishedProperty property, string framework = "bootstrap3")
{
var view = "Grid/" + framework;
return new MvcHtmlString(renderPartialViewToString(view, property.Value));
return new MvcHtmlString(RenderPartialViewToString(view, property.Value));
}
public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem)
@@ -33,20 +33,22 @@ namespace Umbraco.Web
public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem, string propertyAlias, string framework)
{
var view = "Grid/" + framework;
var model = contentItem.GetProperty(propertyAlias).Value;
var model = contentItem.GetProperty(propertyAlias).Value;
return new MvcHtmlString(renderPartialViewToString(view, model));
return new MvcHtmlString(RenderPartialViewToString(view, model));
}
private static string renderPartialViewToString(string viewName, object model)
private static string RenderPartialViewToString(string viewName, object model)
{
using (var sw = new StringWriter())
{
var cc = new ControllerContext();
cc.RequestContext = new RequestContext(UmbracoContext.Current.HttpContext, new RouteData()
{
Route = RouteTable.Routes["Umbraco_default"]
});
var cc = new ControllerContext
{
RequestContext =
new RequestContext(
UmbracoContext.Current.HttpContext,
new RouteData() { Route = RouteTable.Routes["Umbraco_default"] })
};
var routeHandler = new RenderRouteHandler(ControllerBuilder.Current.GetControllerFactory(), UmbracoContext.Current);
var routeDef = routeHandler.GetUmbracoRouteDefinition(cc.RequestContext, UmbracoContext.Current.PublishedContentRequest);
@@ -66,6 +68,5 @@ namespace Umbraco.Web
return sw.GetStringBuilder().ToString();
}
}
}
}

View File

@@ -23,12 +23,11 @@ namespace Umbraco.Web.PropertyEditors
protected override PreValueEditor CreatePreValueEditor()
{
return new gridPreValueEditor();
return new GridPreValueEditor();
}
}
internal class gridPreValueEditor : PreValueEditor
internal class GridPreValueEditor : PreValueEditor
{
[PreValueField("items", "Grid", "views/propertyeditors/grid/grid.prevalues.html", Description = "Grid configuration")]
public string Items { get; set; }