From 13c675d718a9f8487243a70e9e497ea9f7da9377 Mon Sep 17 00:00:00 2001 From: Claus Date: Wed, 28 Feb 2018 12:04:39 +0100 Subject: [PATCH] updating route to use the old url. removing leftover index.html. adding migration for renaming preview folder on disk. --- .gitignore | 1 + src/Umbraco.Core/IO/SystemDirectories.cs | 1 - .../RenamePreviewFolder.cs | 41 +++++ src/Umbraco.Core/Umbraco.Core.csproj | 1 + .../src/canvasdesigner/index.html | 165 ------------------ .../components/content/edit.controller.js | 4 +- src/Umbraco.Web/Mvc/BackOfficeArea.cs | 2 +- 7 files changed, 46 insertions(+), 169 deletions(-) create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTenZero/RenamePreviewFolder.cs delete mode 100644 src/Umbraco.Web.UI.Client/src/canvasdesigner/index.html diff --git a/.gitignore b/.gitignore index 6a4c95895d..1226db8c71 100644 --- a/.gitignore +++ b/.gitignore @@ -113,6 +113,7 @@ build/ApiDocs/* build/ApiDocs/Output/* src/Umbraco.Web.UI.Client/bower_components/* /src/Umbraco.Web.UI/Umbraco/preview +/src/Umbraco.Web.UI/Umbraco/preview.old #Ignore Rule for output of generated documentation files from Grunt docserve src/Umbraco.Web.UI.Client/docs/api diff --git a/src/Umbraco.Core/IO/SystemDirectories.cs b/src/Umbraco.Core/IO/SystemDirectories.cs index 9c815504c7..2a4a0709f3 100644 --- a/src/Umbraco.Core/IO/SystemDirectories.cs +++ b/src/Umbraco.Core/IO/SystemDirectories.cs @@ -203,7 +203,6 @@ namespace Umbraco.Core.IO { get { - //by default the packages folder should exist in the data folder return IOHelper.ReturnPath("umbracoPreviewPath", Data + IOHelper.DirSepChar + "preview"); } } diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTenZero/RenamePreviewFolder.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTenZero/RenamePreviewFolder.cs new file mode 100644 index 0000000000..248492a3ea --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTenZero/RenamePreviewFolder.cs @@ -0,0 +1,41 @@ +using System.IO; +using Umbraco.Core.IO; +using Umbraco.Core.Logging; +using Umbraco.Core.Persistence.SqlSyntax; +using File = System.IO.File; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTenZero +{ + /// + /// Renames the preview folder containing static html files to ensure it does not interfere with the MVC route + /// that is now supposed to render these views dynamically. We don't want to delete as people may have made + /// customizations to these files that would need to be migrated to the new .cshtml view files. + /// + [Migration("7.10.0", 1, Constants.System.UmbracoMigrationName)] + public class RenamePreviewFolder : MigrationBase + { + public RenamePreviewFolder(ISqlSyntaxProvider sqlSyntax, ILogger logger) + : base(sqlSyntax, logger) + { + } + + public override void Up() + { + var previewFolderPath = IOHelper.MapPath(SystemDirectories.Umbraco + "/preview"); + if (Directory.Exists(previewFolderPath)) + { + var newPath = previewFolderPath.Replace("preview", "preview.old"); + Directory.Move(previewFolderPath, newPath); + var readmeText = + $"Static html files used for preview and canvas editing functionality no longer live in this directory.\r\n" + + $"Instead they have been recreated as MVC views and can now be found in '~/Umbraco/Views/Preview'.\r\n" + + $"See issue: http://issues.umbraco.org/issue/UAASSCRUM-1405"; + File.WriteAllText(Path.Combine(newPath, "readme.txt"), readmeText); + } + } + + public override void Down() + { + } + } +} diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index bc58456e48..96670a390d 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -603,6 +603,7 @@ + diff --git a/src/Umbraco.Web.UI.Client/src/canvasdesigner/index.html b/src/Umbraco.Web.UI.Client/src/canvasdesigner/index.html deleted file mode 100644 index e5778a9d9b..0000000000 --- a/src/Umbraco.Web.UI.Client/src/canvasdesigner/index.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - Umbraco Canvas Designer - - - - - - - -
- -
- -
- -
- -
- -
- -
- - - - - -
- -
- -
-

Palette Style

-
- - - - - -
- -
- -
-
-

Select

-
-
-
    -
  • - {{configItem.name}} -
  • -
-
-
- -
-
-

{{configItem.name}}

-
-
-
-

- {{category}} - - -

-
-
-
{{item.name}}
-
-
-
-
-
-
- - - -
- -
- -
- -
-

Styles saved and published

-
- - - - - - - diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js index 8441963e87..4452e35835 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js @@ -242,10 +242,10 @@ // Chromes popup blocker will kick in if a window is opened // without the initial scoped request. This trick will fix that. // - var previewWindow = $window.open('previews/?init=true&id=' + content.id, 'umbpreview'); + var previewWindow = $window.open('preview/?init=true&id=' + content.id, 'umbpreview'); // Build the correct path so both /#/ and #/ work. - var redirect = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + '/previews/?id=' + content.id; + var redirect = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + '/preview/?id=' + content.id; //The user cannot save if they don't have access to do that, in which case we just want to preview //and that's it otherwise they'll get an unauthorized access message diff --git a/src/Umbraco.Web/Mvc/BackOfficeArea.cs b/src/Umbraco.Web/Mvc/BackOfficeArea.cs index b594b0272b..091ba5f283 100644 --- a/src/Umbraco.Web/Mvc/BackOfficeArea.cs +++ b/src/Umbraco.Web/Mvc/BackOfficeArea.cs @@ -22,7 +22,7 @@ namespace Umbraco.Web.Mvc { context.MapRoute( "Umbraco_preview", - GlobalSettings.UmbracoMvcArea + "/previews/{action}/{editor}", + GlobalSettings.UmbracoMvcArea + "/preview/{action}/{editor}", new {controller = "Preview", action = "Index", editor = UrlParameter.Optional}, new[] { "Umbraco.Web.Editors" });