From 03f64521cbf38f7225617ba4606f157e563649b5 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Wed, 29 May 2013 20:25:29 -1000 Subject: [PATCH] updated sln to have a simple website project in the Umbraco.UI.Client folder which will be the Belle development folder, its a website so it doesn't compile or anythng just a space to be able to edit files. We can probably also update it to launch IIS Express to point to the build folder for testing. Moved the back office scripts controller actions just to the normal back office controller. Tweaked some of the Belle POC so now it is loading and have created an index.html file which contains all the belle stuff so people won't have to worry about the container razor file. --- src/Umbraco.Core/Manifest/ManifestParser.cs | 3 +- .../AngularIntegration/RequireJsInitTests.cs | 19 ++ .../views/container.controller.js | 9 + .../MyPackage/Common/Js/MyPackage.js | 2 +- .../PropertyEditors/Js/PostcodeEditor.js | 2 +- .../PropertyEditors/Js/RegexEditor.js | 2 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 5 +- .../umbraco/Views/Default.cshtml | 18 +- src/Umbraco.Web.UI/umbraco/Views/Web.config | 55 ---- src/Umbraco.Web.UI/umbraco/Views/index.html | 234 +++++++++--------- .../umbraco/lib/require/require-1.0.8.js | 33 --- src/Umbraco.Web/Mvc/BackOfficeController.cs | 28 --- .../Mvc/BackOfficeScriptsController.cs | 48 ---- src/Umbraco.Web/UI/JavaScript/Main.js | 6 +- .../UI/JavaScript/RequireJsConfig.js | 39 ++- .../UI/JavaScript/RequireJsInit.cs | 17 +- .../UI/JavaScript/RequireJsInitialize.js | 14 +- src/Umbraco.Web/Umbraco.Web.csproj | 3 +- src/Umbraco.Web/WebBootManager.cs | 11 +- src/umbraco.sln | 30 ++- 20 files changed, 258 insertions(+), 320 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/views/container.controller.js delete mode 100644 src/Umbraco.Web.UI/umbraco/Views/Web.config delete mode 100644 src/Umbraco.Web.UI/umbraco/lib/require/require-1.0.8.js delete mode 100644 src/Umbraco.Web/Mvc/BackOfficeController.cs delete mode 100644 src/Umbraco.Web/Mvc/BackOfficeScriptsController.cs diff --git a/src/Umbraco.Core/Manifest/ManifestParser.cs b/src/Umbraco.Core/Manifest/ManifestParser.cs index eb1818335b..5dc4a1aec5 100644 --- a/src/Umbraco.Core/Manifest/ManifestParser.cs +++ b/src/Umbraco.Core/Manifest/ManifestParser.cs @@ -16,6 +16,7 @@ namespace Umbraco.Core.Manifest internal class ManifestParser { private readonly DirectoryInfo _pluginsDir; + //used to strip comments private static readonly Regex Comments = new Regex("(/\\*.*\\*/)", RegexOptions.Compiled); @@ -102,7 +103,7 @@ namespace Umbraco.Core.Manifest { if (m.IsNullOrWhiteSpace()) continue; - //remove any comments first + //remove any comments first, NOTE: I think JSON.Net will do this for us! but we'll leave it here for now Comments.Replace(m, match => ""); diff --git a/src/Umbraco.Tests/AngularIntegration/RequireJsInitTests.cs b/src/Umbraco.Tests/AngularIntegration/RequireJsInitTests.cs index dcd8b2d796..32950ce61e 100644 --- a/src/Umbraco.Tests/AngularIntegration/RequireJsInitTests.cs +++ b/src/Umbraco.Tests/AngularIntegration/RequireJsInitTests.cs @@ -14,6 +14,8 @@ namespace Umbraco.Tests.AngularIntegration public class RequireJsInitTests { + + [Test] public void Get_Default_Config() { @@ -42,5 +44,22 @@ namespace Umbraco.Tests.AngularIntegration Assert.IsTrue(result.Contains("require([World]")); } + [Test] + public void Parse_Main_With_JS_Function() + { + var result = RequireJsInit.ParseMain(@"{ + waitSeconds: 120, + paths: { + jquery: '../lib/jquery/jquery-1.8.2.min' + }, + shim: { + 'tinymce':""@@@@{exports:'tinyMCE',init:function() { this.tinymce.DOM.events.domLoaded = true; return this.tinymce; } }"" + } + }", "[World]"); + + Assert.IsFalse(result.Contains("@@@@")); + Assert.IsTrue(result.Contains("'tinymce':{exports:'tinyMCE',init:function()")); + } + } } diff --git a/src/Umbraco.Web.UI.Client/views/container.controller.js b/src/Umbraco.Web.UI.Client/views/container.controller.js new file mode 100644 index 0000000000..af0bded5c3 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/views/container.controller.js @@ -0,0 +1,9 @@ +'use strict'; + +define(['angular'], function(angular) { + + //Handles the initial loading of the index.html main app from our razor page + angular.module('umbraco').controller("ContainerController", function($scope) { + $scope.applicationView = "views/index.html"; + }); +}); \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Common/Js/MyPackage.js b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Common/Js/MyPackage.js index 287e54b6a3..4c7a3a4cd3 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Common/Js/MyPackage.js +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Common/Js/MyPackage.js @@ -1,6 +1,6 @@ 'use strict'; -define(['myApp'], function (app) { +define(['app'], function (app) { app.directive('valPostcode', function () { diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/PostcodeEditor.js b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/PostcodeEditor.js index d1d0aae38d..5ad3b3d694 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/PostcodeEditor.js +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/PostcodeEditor.js @@ -1,6 +1,6 @@ 'use strict'; -define(['myApp'], function (app) { +define(['namespaceMgr'], function () { Umbraco.Sys.registerNamespace("MyPackage.PropertyEditors"); diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js index a7b6716526..b76b7840e6 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js @@ -1,6 +1,6 @@ 'use strict'; -define(['myApp'], function (app) { +define(['namespaceMgr'], function () { Umbraco.Sys.registerNamespace("MyPackage.PropertyEditors"); diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 051ff0cf5e..891c542536 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -565,7 +565,8 @@ - + + @@ -2096,7 +2097,7 @@ - + diff --git a/src/Umbraco.Web.UI/umbraco/Views/Default.cshtml b/src/Umbraco.Web.UI/umbraco/Views/Default.cshtml index 270f4de483..0b1764e1da 100644 --- a/src/Umbraco.Web.UI/umbraco/Views/Default.cshtml +++ b/src/Umbraco.Web.UI/umbraco/Views/Default.cshtml @@ -1,4 +1,6 @@ -@{ +@using Umbraco.Core +@inherits System.Web.Mvc.WebViewPage +@{ Layout = null; } @@ -14,7 +16,7 @@ @*Currently this needs to be loaded before anything*@ - + - + -
+
- - + + + @*We cannot use the data-main attribute above because we need to load in the application + via a server side JavaScript request, so we just request it after requirejs*@ + + diff --git a/src/Umbraco.Web.UI/umbraco/Views/Web.config b/src/Umbraco.Web.UI/umbraco/Views/Web.config deleted file mode 100644 index edac1a2296..0000000000 --- a/src/Umbraco.Web.UI/umbraco/Views/Web.config +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Umbraco.Web.UI/umbraco/Views/index.html b/src/Umbraco.Web.UI/umbraco/Views/index.html index e9f300fde1..d0ec2a0bb9 100644 --- a/src/Umbraco.Web.UI/umbraco/Views/index.html +++ b/src/Umbraco.Web.UI/umbraco/Views/index.html @@ -1,140 +1,142 @@ -
+
+
-
- - - -