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

Commit e80d101

Browse files
authored
Merge pull request #93 from umco/develop
Release 0.5.0
2 parents 2ddb60e + 91971a3 commit e80d101

30 files changed

+524
-485
lines changed

LICENSE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Copyright © 2014 Umbrella Inc, Our Umbraco and other contributors
1+
Copyright © 2017 UMCO, Our Umbraco and other contributors
2+
Copyright © 2014 Umbrella Inc
23

34
Permission is hereby granted, free of charge, to any person obtaining a copy of
45
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
[![Build status](https://img.shields.io/appveyor/ci/UMCO/umbraco-doc-type-grid-editor.svg)](https://ci.appveyor.com/project/UMCO/umbraco-doc-type-grid-editor)
44
[![NuGet release](https://img.shields.io/nuget/v/Our.Umbraco.DocTypeGridEditor.svg)](https://www.nuget.org/packages/Our.Umbraco.DocTypeGridEditor)
55
[![Our Umbraco project page](https://img.shields.io/badge/our-umbraco-orange.svg)](https://our.umbraco.org/projects/backoffice-extensions/doc-type-grid-editor)
6-
[![Chat on Gitter](https://img.shields.io/badge/gitter-join_chat-green.svg)](https://gitter.im/leekelleher/umbraco-doc-type-grid-editor)
76

87

9-
A grid editor for Umbraco 7 that allows you to use Doc Types as a blue print for cell data.
8+
A grid editor for Umbraco 7 that allows you to use Doc Types as a blue print for grid-cell data.
109

1110

1211
## Getting Started
1312

1413
### Installation
1514

16-
> *Note:* Doc Type Grid Editor has been developed against **Umbraco v7.3.0** and will support that version and above.
15+
> *Note:* Doc Type Grid Editor has been developed against **Umbraco v7.4.0** and will support that version and above.
1716
1817
Doc Type Grid Editor can be installed from either Our Umbraco package repository, or build manually from the source-code.
1918

@@ -35,7 +34,8 @@ We also have a [MyGet package repository](https://www.myget.org/gallery/umbraco-
3534

3635
If you prefer, you can compile Doc Type Grid Editor yourself, you'll need:
3736

38-
* Visual Studio 2012 (or above)
37+
* [Visual Studio 2017 (or above, including Community Editions)](https://www.visualstudio.com/downloads/)
38+
* Microsoft Build Tools 2015 (aka [MSBuild 15](https://www.microsoft.com/en-us/download/details.aspx?id=48159))
3939

4040
To clone it locally click the "Clone in Windows" button above or run the following git commands.
4141

@@ -93,6 +93,8 @@ Have a question?
9393

9494
## License
9595

96-
Copyright © 2014 Umbrella Inc, Our Umbraco and [other contributors](https://github.com/umco/umbraco-doc-type-grid-editor/graphs/contributors)
96+
Copyright © 2017 UMCO, Our Umbraco and [other contributors](https://github.com/umco/umbraco-doc-type-grid-editor/graphs/contributors)
97+
98+
Copyright © 2014 Umbrella Inc
9799

98100
Licensed under the [MIT License](LICENSE.md)

appveyor.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
image: Visual Studio 2017
2+
13
# version format
2-
version: 0.4.0.{build}
4+
version: 0.5.0.{build}
35

46
# UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha
57
# example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta
@@ -9,8 +11,11 @@ init:
911
cache:
1012
- src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
1113

14+
before_build:
15+
- nuget restore src
16+
1217
build_script:
13-
- build-appveyor.cmd
18+
- build-appveyor.cmd
1419

1520
artifacts:
1621
- path: artifacts\*.nupkg
@@ -19,8 +24,8 @@ artifacts:
1924
deploy:
2025
# MyGet Deployment for builds & releases
2126
- provider: NuGet
22-
server: https://www.myget.org/F/umbraco-packages/
23-
symbol_server: https://nuget.symbolsource.org/MyGet/umbraco-packages
27+
server: https://www.myget.org/F/umbraco-packages/api/v2/package
28+
symbol_server: https://www.myget.org/F/umbraco-packages/symbols/api/v2/package
2429
api_key:
2530
secure: 36/Ax5O+e6wENlhoTwgvoEBZV3FG4XjF429SNTej2qsGTAL+cdfA1kT/tm1St8vx
2631
artifact: /.*\.nupkg/
@@ -42,7 +47,7 @@ deploy:
4247
- provider: NuGet
4348
server:
4449
api_key:
45-
secure: eSLiOXbGVrxSG+X7PV6qTTUZ5VzS9EFj5+EufaWPfd+QXkF6gc8rZ4mGoHIVp/fL
50+
secure: 0+oAleUTnr9UuJrhLW5rphRR+QGz00XX1Ui3k5kwyr2kUdEamiQ3F+gW0q8MJbDT
4651
artifact: /.*\.nupkg/
4752
on:
4853
branch: master

build-appveyor.cmd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ ECHO APPVEYOR_REPO_TAG: %APPVEYOR_REPO_TAG%
33
ECHO APPVEYOR_BUILD_NUMBER : %APPVEYOR_BUILD_NUMBER%
44
ECHO APPVEYOR_BUILD_VERSION : %APPVEYOR_BUILD_VERSION%
55

6-
CALL src\.nuget\NuGet.exe restore src\Our.Umbraco.DocTypeGridEditor.sln
7-
CALL "%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" build\package.proj
6+
CALL build\tools\NuGet.exe restore src\Our.Umbraco.DocTypeGridEditor.sln
7+
CALL "%programfiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\MsBuild.exe" build\package.proj
8+
REM CALL "%programfiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64\MsBuild.exe" build\package.proj

build/package.proj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<PropertyGroup>
1919
<ProjectName>Our.Umbraco.DocTypeGridEditor</ProjectName>
2020
<PackageName>Doc Type Grid Editor</PackageName>
21-
<MinUmbracoVersion>7.3.0</MinUmbracoVersion>
21+
<MinUmbracoVersion>7.4.0</MinUmbracoVersion>
2222
<Readme>Doc Type Grid Editor is an advanced grid editor for Umbraco 7</Readme>
2323
<AuthorName>Matt Brailsford, Lee Kelleher</AuthorName>
2424
<AuthorUrl>https://github.com/umco/umbraco-doc-type-grid-editor/graphs/contributors</AuthorUrl>
@@ -31,7 +31,7 @@
3131
<PropertyGroup>
3232
<PackageId>Our.Umbraco.DocTypeGridEditor</PackageId>
3333
<NuGetPackageName>Doc Type Grid Editor for Umbraco</NuGetPackageName>
34-
<Copyright>Copyright &#169; 2015 Matt Brailsford, Lee Kelleher</Copyright>
34+
<Copyright>Copyright &#169; 2017 UMCO</Copyright>
3535
<Owners>Matt Brailsford, Lee Kelleher</Owners>
3636
<IconUrl>https://our.umbraco.org/media/wiki/145708/635623742802070736_dtgepng.png</IconUrl>
3737
<Tags>umbraco grid document type editor</Tags>
@@ -195,7 +195,7 @@
195195
OutputDirectory="$(ArtifactsDir)"
196196
Files="@(PackageFiles)" />
197197

198-
<MSBuild.NuGet.Tasks.Pack NuGetExePath="$(RootDir)\src\.nuget\NuGet.exe"
198+
<MSBuild.NuGet.Tasks.Pack NuGetExePath="$(RootDir)\build\tools\NuGet.exe"
199199
ManifestFile="$(BuildNuGetDir)\package.nuspec"
200200
BasePath="$(BuildNuGetDir)"
201201
Version="$(ProductVersion)"

build/tools/NuGet.exe

4.82 MB
Binary file not shown.

docs/developers-guide.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ With the **Doc Type Grid Editor** then, we bridge that gap, allowing you to reus
3131
Before you get started, there are a number of things you will need:
3232

3333
1. .NET 4.5+
34-
2. Umbraco 7.2.0+
34+
2. Umbraco 7.4.0+
3535
3. The **Doc Type Grid Editor** package installed
3636

3737
---
@@ -44,20 +44,25 @@ The **Doc Type Grid Editor** is configured via the grid.editors.config.js config
4444

4545
```javascript
4646
[
47-
...
48-
{
49-
"name": "Doc Type",
50-
"alias": "docType",
51-
"view": "/App_Plugins/../doctypegrideditor.html",
52-
"render": "/App_Plugins/../doctypegrideditor.cshtml",
53-
"icon": "icon-item-arrangement",
54-
"config": {
55-
"allowedDocTypes": [...],
56-
"enablePreview": true,
57-
"viewPath": "/Views/Partials/"
58-
},
59-
...
60-
]
47+
...
48+
{
49+
"name": "Doc Type",
50+
"alias": "docType",
51+
"view": "/App_Plugins/DocTypeGridEditor/Views/doctypegrideditor.html",
52+
"render": "/App_Plugins/DocTypeGridEditor/Render/DocTypeGridEditor.cshtml",
53+
"icon": "icon-item-arrangement",
54+
"config": {
55+
"allowedDocTypes": [...],
56+
"nameTemplate": "",
57+
"enablePreview": true,
58+
"viewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/",
59+
"previewViewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/Previews/",
60+
"previewCssFilePath": "",
61+
"previewJsFilePath": ""
62+
}
63+
},
64+
...
65+
]
6166
```
6267

6368
![Doc Type Grid Editor - JSON configuration](img/screenshot-07.png)
@@ -155,7 +160,7 @@ If you are not the type of developer that likes to put business logic in your vi
155160
Simply create your controller inheriting from the above class, giving it a class name of `{DocTypeAlias}SurfaceController` and an action name of `{DocTypeAlias}` and the **Doc Type Grid Editor** will automatically wire it up for you and use it at render time.
156161

157162
```csharp
158-
public class TestDocTypeSurfaceController
163+
public class TestDocTypeSurfaceController
159164
: DocTypeGridEditorSurfaceController
160165
{
161166
public ActionResult TestDocType()

src/.nuget/NuGet.Config

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/.nuget/NuGet.exe

-1.59 MB
Binary file not shown.

src/Our.Umbraco.DocTypeGridEditor.sln

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio 14
3-
VisualStudioVersion = 14.0.25420.1
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27004.2009
45
MinimumVisualStudioVersion = 10.0.40219.1
56
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Our.Umbraco.DocTypeGridEditor", "Our.Umbraco.DocTypeGridEditor\Our.Umbraco.DocTypeGridEditor.csproj", "{4BD1DB40-1B39-4966-8740-D6A39D658598}"
67
EndProject
7-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{CEE9961C-D747-40CD-B0B2-868D6B46833E}"
8-
ProjectSection(SolutionItems) = preProject
9-
.nuget\NuGet.Config = .nuget\NuGet.Config
10-
EndProjectSection
11-
EndProject
12-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{D588B45D-9E67-4136-8271-2B8724C8165F}"
13-
ProjectSection(SolutionItems) = preProject
14-
..\CONTRIBUTING.md = ..\CONTRIBUTING.md
15-
..\LICENSE.md = ..\LICENSE.md
16-
..\README.md = ..\README.md
17-
EndProjectSection
18-
EndProject
198
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build Package", "Build Package", "{42CE1449-272B-453B-B162-4558FD38BF41}"
209
ProjectSection(SolutionItems) = preProject
2110
..\appveyor.yml = ..\appveyor.yml
@@ -29,6 +18,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build Package", "Build Pack
2918
EndProjectSection
3019
EndProject
3120
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8412A31B-D80C-42DE-9589-4BD08F43F86B}"
21+
ProjectSection(SolutionItems) = preProject
22+
..\CONTRIBUTING.md = ..\CONTRIBUTING.md
23+
..\LICENSE.md = ..\LICENSE.md
24+
..\README.md = ..\README.md
25+
EndProjectSection
26+
EndProject
27+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documentation", "Documentation", "{29E2BB68-801F-456D-B691-4E93F884FCD5}"
28+
ProjectSection(SolutionItems) = preProject
29+
..\docs\developers-guide.md = ..\docs\developers-guide.md
30+
EndProjectSection
3231
EndProject
3332
Global
3433
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -45,8 +44,10 @@ Global
4544
HideSolutionNode = FALSE
4645
EndGlobalSection
4746
GlobalSection(NestedProjects) = preSolution
48-
{CEE9961C-D747-40CD-B0B2-868D6B46833E} = {8412A31B-D80C-42DE-9589-4BD08F43F86B}
49-
{D588B45D-9E67-4136-8271-2B8724C8165F} = {8412A31B-D80C-42DE-9589-4BD08F43F86B}
5047
{42CE1449-272B-453B-B162-4558FD38BF41} = {8412A31B-D80C-42DE-9589-4BD08F43F86B}
48+
{29E2BB68-801F-456D-B691-4E93F884FCD5} = {8412A31B-D80C-42DE-9589-4BD08F43F86B}
49+
EndGlobalSection
50+
GlobalSection(ExtensibilityGlobals) = postSolution
51+
SolutionGuid = {03435AB1-C9D8-46BD-9C91-2D4FCF44D57E}
5152
EndGlobalSection
5253
EndGlobal
Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
using System.Web.Mvc;
1+
using System;
2+
using System.Web.Mvc;
3+
using Newtonsoft.Json;
24
using Our.Umbraco.DocTypeGridEditor.Web.Attributes;
35
using Our.Umbraco.DocTypeGridEditor.Web.Mvc;
46
using Umbraco.Core;
5-
using Umbraco.Core.Events;
6-
using Umbraco.Core.Models;
7-
using Umbraco.Core.Services;
7+
using Umbraco.Core.Sync;
8+
using Umbraco.Web.Cache;
9+
using Umbraco.Web.Routing;
810

911
namespace Our.Umbraco.DocTypeGridEditor
1012
{
@@ -14,40 +16,63 @@ protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplic
1416
{
1517
GlobalFilters.Filters.Add(new DocTypeGridEditorPreviewAttribute());
1618

17-
if (!DefaultDocTypeGridEditorSurfaceControllerResolver.HasCurrent)
19+
if (DefaultDocTypeGridEditorSurfaceControllerResolver.HasCurrent == false)
1820
{
1921
DefaultDocTypeGridEditorSurfaceControllerResolver.Current = new DefaultDocTypeGridEditorSurfaceControllerResolver();
2022
}
2123
}
2224

2325
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
2426
{
25-
DataTypeService.Saved += ExpireDataTypeCache;
26-
ContentTypeService.SavedContentType += ExpireContentTypeCache;
27-
}
28-
29-
private void ExpireDataTypeCache(IDataTypeService sender, SaveEventArgs<IDataTypeDefinition> e)
30-
{
31-
foreach (var dataType in e.SavedEntities)
27+
DataTypeCacheRefresher.CacheUpdated += (sender, e) =>
3228
{
33-
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(
34-
string.Concat("Our.Umbraco.DocTypeGridEditor.Web.Extensions.ContentTypeServiceExtensions.GetAliasById_", dataType.Key));
29+
if (e.MessageType == MessageType.RefreshByJson)
30+
{
31+
var payload = JsonConvert.DeserializeAnonymousType((string)e.MessageObject, new[] { new { Id = default(int), UniqueId = default(Guid) } });
32+
if (payload != null)
33+
{
34+
foreach (var item in payload)
35+
{
36+
applicationContext.ApplicationCache.RuntimeCache.ClearCacheItem(
37+
string.Concat("Our.Umbraco.DocTypeGridEditor.Web.Extensions.ContentTypeServiceExtensions.GetAliasById_", item.UniqueId));
3538

36-
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(
37-
string.Concat("Our.Umbraco.DocTypeGridEditor.Helpers.DocTypeGridEditorHelper.GetPreValuesCollectionByDataTypeId_", dataType.Id));
38-
}
39-
}
39+
applicationContext.ApplicationCache.RuntimeCache.ClearCacheItem(
40+
string.Concat("Our.Umbraco.DocTypeGridEditor.Helpers.DocTypeGridEditorHelper.GetPreValuesCollectionByDataTypeId_", item.Id));
41+
}
42+
}
43+
}
44+
};
4045

41-
private void ExpireContentTypeCache(IContentTypeService sender, SaveEventArgs<IContentType> e)
42-
{
43-
foreach (var contentType in e.SavedEntities)
46+
ContentTypeCacheRefresher.CacheUpdated += (sender, e) =>
4447
{
45-
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(
46-
string.Concat("Our.Umbraco.DocTypeGridEditor.Helpers.DocTypeGridEditorHelper.GetContentTypesByAlias_", contentType.Alias));
48+
if (e.MessageType == MessageType.RefreshByJson)
49+
{
50+
var payload = JsonConvert.DeserializeAnonymousType((string)e.MessageObject, new[] { new { Alias = default(string) } });
51+
if (payload != null)
52+
{
53+
foreach (var item in payload)
54+
{
55+
applicationContext.ApplicationCache.RuntimeCache.ClearCacheItem(
56+
string.Concat("Our.Umbraco.DocTypeGridEditor.Helpers.DocTypeGridEditorHelper.GetContentTypesByAlias_", item.Alias));
4757

48-
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(
49-
string.Concat("Our.Umbraco.DocTypeGridEditor.Helpers.DocTypeGridEditorHelper.GetContentTypeAliasByGuid_", contentType.Key));
50-
}
58+
// NOTE: Unsure how to get the doctype GUID, without hitting the database?
59+
// So we end up clearing the entire cache for this key. [LK:2018-01-30]
60+
applicationContext.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(
61+
"Our.Umbraco.DocTypeGridEditor.Helpers.DocTypeGridEditorHelper.GetContentTypeAliasByGuid_");
62+
}
63+
}
64+
}
65+
};
66+
67+
PublishedContentRequest.Prepared += (sender, e) =>
68+
{
69+
// Check if it's a dtgePreview request and is set to redirect.
70+
// If so reset the redirect url to an empty string to stop the redirect happening in preview mode.
71+
if (sender is PublishedContentRequest request && request.Uri.Query.InvariantContains("dtgePreview") && request.IsRedirect)
72+
{
73+
request.SetRedirect(string.Empty);
74+
}
75+
};
5176
}
5277
}
53-
}
78+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using Newtonsoft.Json.Linq;
3+
4+
namespace Our.Umbraco.DocTypeGridEditor.Extensions
5+
{
6+
internal static class JsonExtensions
7+
{
8+
public static void Rename(this JToken token, string newName)
9+
{
10+
var parent = token.Parent;
11+
12+
if (parent == null)
13+
throw new InvalidOperationException("The parent is missing.");
14+
15+
var newToken = new JProperty(newName, token);
16+
parent.Replace(newToken);
17+
}
18+
}
19+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static bool ViewExists(
99
ControllerContext controllerContext,
1010
string viewName, bool isPartial = false)
1111
{
12-
var result = !isPartial
12+
var result = isPartial == false
1313
? viewEngines.FindView(controllerContext, viewName, null)
1414
: viewEngines.FindPartialView(controllerContext, viewName);
1515

0 commit comments

Comments
 (0)