diff --git a/.jshintrc b/.jshintrc index 8fe58ca6..952163d3 100644 --- a/.jshintrc +++ b/.jshintrc @@ -14,7 +14,7 @@ "regexp": true, "undef": true, "unused": true, - "strict": true, + "strict": false, "trailing": true, "smarttabs": true, "globals": { diff --git a/Makefile b/Makefile index fdde9c5e..e61596cc 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,9 @@ install: ./node_modules/protractor/bin/webdriver-manager update run: + @cp node_modules/angular/angular.min.js examples/blog/build/angular.min.js @cp node_modules/sinon/pkg/sinon-server-1.14.1.js examples/blog/build/sinon-server.js + @cp node_modules/angular/angular.js examples/blog/build/angular.js @./node_modules/webpack-dev-server/bin/webpack-dev-server.js --colors --devtool cheap-module-inline-source-map --content-base examples/blog --port 8000 build: diff --git a/examples/blog/config.js b/examples/blog/config.js index ecfb8325..b7a48996 100644 --- a/examples/blog/config.js +++ b/examples/blog/config.js @@ -281,8 +281,10 @@ nga.field('name'), nga.field('published', 'boolean').validation({ required: true // as this boolean is required, ng-admin will use a checkbox instead of a dropdown - }) - ]); + }), + nga.field('image', 'file') + .uploadInformation({ url: 'http://localhost:3333/upload' }) + ]) tag.showView() .fields([ diff --git a/examples/blog/fakerest-init.js b/examples/blog/fakerest-init.js index 570456b3..e9a403bb 100644 --- a/examples/blog/fakerest-init.js +++ b/examples/blog/fakerest-init.js @@ -7,14 +7,6 @@ restServer.init(apiData); restServer.toggleLogging(); // logging is off by default, enable it - // use sinon.js to monkey-patch XmlHttpRequest - sinon.FakeXMLHttpRequest.useFilters = true; - sinon.FakeXMLHttpRequest.addFilter(function (method, url) { - // Do not catch webpack sync, config.js transformation but catch /upload in test env - return url.indexOf('/socket.io/') !== -1 || url.indexOf('config.js') !== -1 - || (!testEnv && url.indexOf('/upload') !== -1); - }); - var server = sinon.fakeServer.create(); server.autoRespond = true; server.autoRespondAfter = 0; // answer immediately @@ -28,4 +20,11 @@ } }); } + + // use sinon.js to monkey-patch XmlHttpRequest + sinon.FakeXMLHttpRequest.useFilters = true; + sinon.FakeXMLHttpRequest.addFilter(function (method, url) { + // do not fake other urls than http://localhost:3000/* + return url.indexOf(restServer.baseUrl) === -1; + }); }()); diff --git a/examples/blog/index.html b/examples/blog/index.html index 53fb2193..09b1d9be 100644 --- a/examples/blog/index.html +++ b/examples/blog/index.html @@ -8,11 +8,14 @@
+ + - + +