Removes remaining yepnop dependencies

This commit is contained in:
per ploug
2014-05-05 12:59:34 +02:00
parent 27e6b8c80c
commit dbbe3fe5fb
19 changed files with 51 additions and 140 deletions

View File

@@ -24,11 +24,9 @@ namespace Umbraco.Tests.AngularIntegration
[Test]
public void Parse_Main()
{
var noCache = Resources.JsNoCache;
noCache = noCache.Replace("##rnd##", "(new Date).getTime()");
var result = JsInitialization.ParseMain(new[] { noCache, "[World]", "Hello" });
var result = JsInitialization.ParseMain(new[] {"[World]", "Hello" });
Assert.AreEqual(noCache + @"
Assert.AreEqual(@"
yepnope({
load: [
'lib/jquery/jquery-2.0.3.min.js',

View File

@@ -1,12 +1,12 @@
#Belle
Umbraco 7 UI, codename "Belle" Built on AngularJS, RequireJS and Twitter Bootstrap
Umbraco 7 UI, codename "Belle" Built on AngularJS, bower, Lazyload.js and Twitter Bootstrap
##Introduction
Slides from the initial demonstration of Belle done at the Umbraco DK Fest can be found here:
http://rawgithub.com/umbraco/Belle/master/Presentation/index.html
http://rawgithub.com/umbraco/Umbraco.Web.Ui.Client/build/master/Presentation/index.html
##Running the site with mocked data
@@ -63,23 +63,23 @@ after building Belle files are located in /build/belle, with all files following
conventions:
###Folders
- */belle/lib:* Dependencies
- */belle/js:* Application javascript files
- */belle/views/common/:* Main application views
- */belle/views/[sectioname]/pagename Editors html
- */belle/views/propertyeditors:* Property Editors html
- */Umbraco.Web.Ui.Client/build/lib:* Dependencies
- */Umbraco.Web.Ui.Client/build/js:* Application javascript files
- */Umbraco.Web.Ui.Client/build/views/common/:* Main application views
- */Umbraco.Web.Ui.Client/build/views/[sectioname]/pagename Editors html
- */Umbraco.Web.Ui.Client/build/views/propertyeditors:* Property Editors html
###Files
- */belle/js/app.js:* Main umbraco application / modules
- */belle/js/loader.js:* yepnope configuration for dependencies
- */belle/js/routes.js:* Application routes
- */belle/js/umbraco.controllers.js:* Application controllers
- */belle/js/umbraco.services.js:* Application services
- */belle/js/umbraco.filters.js:* Application filters
- */belle/js/umbraco.directives.js:* Application directives
- */belle/js/umbraco.resources.js:* Application resources, like content, media, users, members etc
- */belle/js/umbraco.mocks.js:* Fake Application resources, for running the app without a server
- */Umbraco.Web.Ui.Client/build/js/app.js:* Main umbraco application / modules
- */Umbraco.Web.Ui.Client/build/js/loader.js:* lazyload configuration for dependencies
- */Umbraco.Web.Ui.Client/build/js/routes.js:* Application routes
- */Umbraco.Web.Ui.Client/build/js/umbraco.controllers.js:* Application controllers
- */Umbraco.Web.Ui.Client/build/js/umbraco.services.js:* Application services
- */Umbraco.Web.Ui.Client/build/js/umbraco.filters.js:* Application filters
- */Umbraco.Web.Ui.Client/build/js/umbraco.directives.js:* Application directives
- */Umbraco.Web.Ui.Client/build/js/umbraco.resources.js:* Application resources, like content, media, users, members etc
- */Umbraco.Web.Ui.Client/build/js/umbraco.mocks.js:* Fake Application resources, for running the app without a server
##Getting started
The current app is built, following conventions from angularJs and bootstrap. To get started with the applicaton you will need to atleast know the basics of these frameworks

View File

@@ -4,7 +4,7 @@
#Belle
Umbraco 7 UI, codename "Belle" Built on AngularJS, YepNope and Twitter Bootstrap
Umbraco 7 UI, codename "Belle" Built on AngularJS, Lazyload.js and Twitter Bootstrap
##Introduction
Slides from the initial demonstration of Belle done at the Umbraco DK Fest can be found here:

View File

@@ -70,7 +70,7 @@ Folder containing various sample projects on how to use the external api, good f
The central application script, which handles what modules to inject, app.js is for production, app.dev.js is for testing
###loader.js
yepnope.js based loader for async loading javascript files, this file specifies what files to load on application start
lazyload.js based loader for async loading javascript files, this file specifies what files to load on application start
###routes.js
Routing setup for /umbraco/ pages, by default it contains a mvc-like convention based pattern, which means that we not very often need to modify this.

View File

@@ -1,3 +0,0 @@
(function() {
//this is empty for mock sesions
})();

View File

@@ -1,2 +0,0 @@
/*yepnope1.5.x|WTFPL*/
(function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}})(this,document);

View File

@@ -14,8 +14,8 @@ Umbraco.Sys.ServerVariables = {
"macroApiBaseUrl": "/umbraco/Api/Macro/",
"authenticationApiBaseUrl": "/umbraco/UmbracoApi/Authentication/",
//For this we'll just provide a file that exists during the mock session since we don't really have legay js tree stuff
"legacyTreeJs": "/belle/lib/yepnope/empty.js",
"serverVarsJs": "/belle/lib/yepnope/empty.js",
"legacyTreeJs": "/belle/lib/lazyload/empty.js",
"serverVarsJs": "/belle/lib/lazyload/empty.js",
"imagesApiBaseUrl": "/umbraco/UmbracoApi/Images/",
"entityApiBaseUrl": "/umbraco/UmbracoApi/Entity/",
"dashboardApiBaseUrl": "/umbraco/UmbracoApi/Dashboard/",

View File

@@ -1,8 +1,5 @@
yepnope({
load: [
LazyLoad.js( [
'lib/jquery/jquery-2.0.3.min.js',
/* 1.1.5 */
'lib/angular/1.1.5/angular.min.js',
'lib/angular/1.1.5/angular-cookies.min.js',
@@ -11,12 +8,9 @@ yepnope({
'lib/angular/1.1.5/angular-sanitize.min.js',
'lib/underscore/underscore.js',
'js/umbraco.installer.js'
],
complete: function () {
], function () {
jQuery(document).ready(function () {
angular.bootstrap(document, ['ngSanitize', 'umbraco.install']);
});
}
});
);

View File

@@ -18,7 +18,7 @@
</div>
<div id="overlay"></div>
<script src="lib/yepnope/yepnope.min.js"></script>
<script src="lib/lazyload/lazyload.min.js"></script>
<script src="js/install.loader.js"></script>
</body>
</html>

View File

@@ -25,7 +25,7 @@ module.exports = function(karma) {
'lib/underscore/underscore.js',
'lib/umbraco/Extensions.js',
'lib/yepnope/yepnope.min.js',
'lib/lazyload/lazyload.min.js',
'test/config/app.unit.js',
@@ -94,15 +94,8 @@ module.exports = function(karma) {
// CLI --report-slower-than 500
reportSlowerThan: 500,
// compile coffee scripts
preprocessors: {
'**/*.coffee': 'coffee'
},
plugins: [
'karma-jasmine',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-phantomjs-launcher'
]
});

View File

@@ -54,7 +54,7 @@
</script>
@*And finally we can load in our angular app*@
<script type="text/javascript" src="lib/yepnope/yepnope.min.js"></script>
<script type="text/javascript" src="lib/lazyload/lazyload.min.js"></script>
<script type="text/javascript" src="@Url.Action("Application", "BackOffice")"></script>
</body>

View File

@@ -1,8 +1,5 @@
yepnope({
load: [
LazyLoad.js( [
'lib/jquery/jquery-2.0.3.min.js',
/* 1.1.5 */
'lib/angular/1.1.5/angular.min.js',
'lib/angular/1.1.5/angular-cookies.min.js',
@@ -11,12 +8,9 @@ yepnope({
'lib/angular/1.1.5/angular-sanitize.min.js',
'lib/underscore/underscore.js',
'js/umbraco.installer.js'
],
complete: function () {
], function () {
jQuery(document).ready(function () {
angular.bootstrap(document, ['ngSanitize', 'umbraco.install']);
});
}
});
);

View File

@@ -54,7 +54,7 @@
"umbracoBaseUrl": "@ViewBag.UmbracoBaseFolder"
};
</script>
<script src="lib/yepnope/yepnope.min.js"></script>
<script src="lib/lazyload/lazyload.min.js"></script>
<script src="js/install.loader.js"></script>
</body>
</html>

View File

@@ -45,24 +45,13 @@ namespace Umbraco.Web.UI.JavaScript
public string GetJavascriptInitialization(HttpContextBase httpContext, JArray umbracoInit, JArray additionalJsFiles = null)
{
var result = GetJavascriptInitializationArray(httpContext, umbracoInit, additionalJsFiles);
var noCache = Resources.JsNoCache;
//if debugging, add timestamp, if in production we tell yepNope to append umb+cdf version
//this is needed even tho cdf does this on its serverside merged js
//as assetsService.load() also need to append these versions to ensure cache bursting on updates + pack installs
if (httpContext.IsDebuggingEnabled)
noCache = noCache.Replace("##rnd##", "(new Date).getTime()");
else
{
//create a unique hash code of the current umb version and the current cdf version
var versionHash = UrlHelperExtensions.GetCacheBustHash();
var version = "'" + versionHash + "'";
noCache = noCache.Replace("##rnd##", version);
}
//create a unique hash code of the current umb version and the current cdf version
var versionHash = UrlHelperExtensions.GetCacheBustHash();
var version = "'" + versionHash + "'";
return ParseMain(
result.ToString(),
IOHelper.ResolveUrl(SystemDirectories.Umbraco));
return ParseMain(
result.ToString(),
IOHelper.ResolveUrl(SystemDirectories.Umbraco));
}
public JArray GetJavascriptInitializationArray(HttpContextBase httpContext, JArray umbracoInit, JArray additionalJsFiles = null)

View File

@@ -1,15 +0,0 @@
yepnope.addFilter(function (resourceObj) {
var url = resourceObj.url.toLowerCase();
var rnd = ##rnd##;
var op = "?";
if(url.indexOf("lib/") === 0 || url.indexOf("js/umbraco.") === 0 || url.indexOf("dependencyhandler.axd") > 0) {
return resourceObj;
}
if(url.indexOf("?") > 0){
op = "&";
}
resourceObj.url = resourceObj.url + op + "umb__rnd=" + rnd;
return resourceObj;
});

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -62,15 +62,11 @@ namespace Umbraco.Web.UI.JavaScript {
/// <summary>
/// Looks up a localized string similar to [
/// &apos;lib/jquery/jquery-ui-1.10.3.custom.min.js&apos;,
/// &apos;lib/jquery/jquery-2.0.3.min.js&apos;,
/// &apos;lib/angular/1.1.5/angular.min.js&apos;,
/// &apos;lib/underscore/underscore.js&apos;,
///
/// /*
/// &apos;lib/jquery/jquery-ui-1.10.3.custom.min.js&apos;,
/// &apos;lib/jquery/jquery.ui.core.min.js&apos;,
/// &apos;lib/jquery/jquery.ui.widget.min.js&apos;,
/// &apos;lib/jquery/jquery.ui.mouse.min.js&apos;,
/// &apos;lib/jquery/jquery.ui.sortable.min.js&apos;,
/// */
///
/// &apos;lib/angular/1.1.5/angular-cookies.min.js&apos;,
/// &apos;lib/angular/1.1.5/angular-mobile.js&apos;,
@@ -78,7 +74,9 @@ namespace Umbraco.Web.UI.JavaScript {
///
/// &apos;lib/angular/angular-ui-sortable.js&apos;,
///
/// &apos;lib/jquery/jquery.u [rest of string was truncated]&quot;;.
/// &apos;lib/jquery/jquery.upload/js/jquery.fileupload.js&apos;,
/// &apos;lib/jquery/jquery.upload/js/load-image.min.js&apos;,
/// &apos;lib/jquery/jquery.upload/js/ [rest of string was truncated]&quot;;.
/// </summary>
internal static string JsInitialize {
get {
@@ -87,46 +85,15 @@ namespace Umbraco.Web.UI.JavaScript {
}
/// <summary>
/// Looks up a localized string similar to yepnope.addFilter(function (resourceObj) {
/// var url = resourceObj.url;
/// var rnd = ##rnd##;
/// var _op = &quot;?&quot;;
/// if(url.indexOf(&quot;lib/&quot;) === 0 || url.indexOf(&quot;js/umbraco.&quot;) === 0){
/// return resourceObj;
/// }
/// if(url.indexOf(&quot;?&quot;) &gt; 0){
/// _op = &quot;&amp;&quot;;
/// }
/// Looks up a localized string similar to LazyLoad.js(&quot;##JsInitialize##&quot;, function () {
/// //we need to set the legacy UmbClientMgr path
/// UmbClientMgr.setUmbracoPath(&apos;&quot;##UmbracoPath##&quot;&apos;);
///
/// resourceObj.url = resourceObj.url + _op + &quot;umb__rnd=&quot; + rnd;
/// return resourceObj;
/// jQuery(document).ready(function () {
/// angular.bootstrap(document, [&apos;umbraco&apos;]);
/// });
///});.
/// </summary>
internal static string JsNoCache {
get {
return ResourceManager.GetString("JsNoCache", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &quot;##JsNoCache##&quot;
///yepnope({
/// load: [
/// &apos;lib/jquery/jquery-2.0.3.min.js&apos;,
/// &apos;lib/angular/1.1.5/angular.min.js&apos;,
/// &apos;lib/underscore/underscore.js&apos;,
/// ],
/// complete: function () {
/// yepnope({
/// load: &quot;##JsInitialize##&quot;,
/// complete: function () {
///
/// //we need to set the legacy UmbClientMgr path
/// UmbClientMgr.setUmbracoPath(&apos;&quot;##UmbracoPath##&quot;&apos;);
///
/// jQuery(document).ready(function () {
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string Main {
get {
return ResourceManager.GetString("Main", resourceCulture);

View File

@@ -121,9 +121,6 @@
<data name="JsInitialize" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>jsinitialize.js;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="JsNoCache" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>jsnocache.js;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="Main" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Main.js;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>

View File

@@ -1840,7 +1840,6 @@
<EmbeddedResource Include="UI\JavaScript\Main.js" />
<EmbeddedResource Include="UI\JavaScript\JsInitialize.js" />
<EmbeddedResource Include="UI\JavaScript\ServerVariables.js" />
<EmbeddedResource Include="UI\JavaScript\JsNoCache.js" />
<Content Include="umbraco.presentation\umbraco\controls\Tree\CustomTreeService.asmx" />
<Content Include="umbraco.presentation\umbraco\developer\RelationTypes\EditRelationType.aspx" />
<Content Include="umbraco.presentation\umbraco\developer\RelationTypes\NewRelationType.aspx" />