Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit ccc3ecc

Browse files
committed
Code formatting / tidy-up
1 parent e8d128d commit ccc3ecc

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

src/Our.Umbraco.DocTypeGridEditor/Extensions/ContentTypeServiceExtensions.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using Umbraco.Core;
3+
using Umbraco.Core.Cache;
34
using Umbraco.Core.Services;
45

56
namespace Our.Umbraco.DocTypeGridEditor.Extensions
@@ -8,9 +9,11 @@ internal static class ContentTypeServiceExtensions
89
{
910
public static string GetAliasByGuid(this IContentTypeService contentTypeService, Guid id)
1011
{
11-
return (string)ApplicationContext.Current.ApplicationCache.RuntimeCache.GetCacheItem(
12+
return ApplicationContext.Current.ApplicationCache.RuntimeCache.GetCacheItem<string>(
1213
string.Concat("Our.Umbraco.DocTypeGridEditor.Web.Extensions.ContentTypeServiceExtensions.GetAliasById_", id),
13-
() => ApplicationContext.Current.DatabaseContext.Database
14+
() => ApplicationContext.Current
15+
.DatabaseContext
16+
.Database
1417
.ExecuteScalar<string>("SELECT [cmsContentType].[alias] FROM [cmsContentType] INNER JOIN [umbracoNode] ON [cmsContentType].[nodeId] = [umbracoNode].[id] WHERE [umbracoNode].[uniqueID] = @0", id));
1518
}
1619
}

src/Our.Umbraco.DocTypeGridEditor/Extensions/ViewEnginesCollectionExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ internal static class ViewEnginesCollectionExtensions
77
public static bool ViewExists(
88
this ViewEngineCollection viewEngines,
99
ControllerContext controllerContext,
10-
string viewName, bool isPartial = false)
10+
string viewName,
11+
bool isPartial = false)
1112
{
1213
var result = isPartial == false
1314
? viewEngines.FindView(controllerContext, viewName, null)

src/Our.Umbraco.DocTypeGridEditor/Helpers/DocTypeGridEditorHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ private static IEnumerable<JsonDbRow> GetPropertyDataRows(string docTypeAlias)
234234
public class ContentTypeContainer
235235
{
236236
public PublishedContentType PublishedContentType { get; set; }
237+
237238
public IContentType ContentType { get; set; }
238239
}
239240
}

src/Our.Umbraco.DocTypeGridEditor/Web/Extensions/HtmlHelperExtensions.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ public static HtmlString RenderDocTypeGridEditorItem(
1717
IPublishedContent content,
1818
string editorAlias = "",
1919
string viewPath = "",
20-
string previewViewPath = "")
20+
string previewViewPath = "",
21+
bool isPreview = false)
2122
{
2223
if (content == null)
2324
return new HtmlString(string.Empty);
2425

25-
var controllerName = string.Concat(content.DocumentTypeAlias, "Surface");
26+
var controllerName = $"{content.DocumentTypeAlias}Surface";
2627

2728
if (string.IsNullOrWhiteSpace(viewPath) == false)
2829
viewPath = viewPath.EnsureEndsWith('/');
@@ -91,21 +92,21 @@ public static HtmlString RenderDocTypeGridEditorItem(
9192

9293
// Check for preview view
9394
if (string.IsNullOrWhiteSpace(previewViewPath) == false
94-
&& helper.ViewContext.RequestContext.HttpContext.Request.QueryString["dtgePreview"] == "1")
95+
&& isPreview)
9596
{
96-
var fullPreviewViewPath = string.Concat(previewViewPath, editorAlias, ".cshtml");
97+
var fullPreviewViewPath = $"{previewViewPath}{editorAlias}.cshtml";
9798
if (ViewEngines.Engines.ViewExists(helper.ViewContext, fullPreviewViewPath, true))
9899
{
99100
return helper.Partial(fullPreviewViewPath, content);
100101
}
101102

102-
fullPreviewViewPath = string.Concat(previewViewPath, content.DocumentTypeAlias, ".cshtml");
103+
fullPreviewViewPath = $"{previewViewPath}{content.DocumentTypeAlias}.cshtml";
103104
if (ViewEngines.Engines.ViewExists(helper.ViewContext, fullPreviewViewPath, true))
104105
{
105106
return helper.Partial(fullPreviewViewPath, content);
106107
}
107108

108-
fullPreviewViewPath = string.Concat(previewViewPath, "Default.cshtml");
109+
fullPreviewViewPath = $"{previewViewPath}Default.cshtml";
109110
if (ViewEngines.Engines.ViewExists(helper.ViewContext, fullPreviewViewPath, true))
110111
{
111112
return helper.Partial(fullPreviewViewPath, content);
@@ -115,19 +116,19 @@ public static HtmlString RenderDocTypeGridEditorItem(
115116
// Check for view path view
116117
if (string.IsNullOrWhiteSpace(viewPath) == false)
117118
{
118-
var fullViewPath = string.Concat(viewPath, editorAlias, ".cshtml");
119+
var fullViewPath = $"{viewPath}{editorAlias}.cshtml";
119120
if (ViewEngines.Engines.ViewExists(helper.ViewContext, fullViewPath, true))
120121
{
121122
return helper.Partial(fullViewPath, content);
122123
}
123124

124-
fullViewPath = string.Concat(viewPath, content.DocumentTypeAlias, ".cshtml");
125+
fullViewPath = $"{viewPath}{content.DocumentTypeAlias}.cshtml";
125126
if (ViewEngines.Engines.ViewExists(helper.ViewContext, fullViewPath, true))
126127
{
127128
return helper.Partial(fullViewPath, content);
128129
}
129130

130-
fullViewPath = string.Concat(viewPath, "Default.cshtml");
131+
fullViewPath = $"{viewPath}Default.cshtml";
131132
if (ViewEngines.Engines.ViewExists(helper.ViewContext, fullViewPath, true))
132133
{
133134
return helper.Partial(fullViewPath, content);

0 commit comments

Comments
 (0)