diff --git a/app.js b/app.js index c9cae7f..45969d8 100644 --- a/app.js +++ b/app.js @@ -8,7 +8,7 @@ angular.module('myApp', [ 'myApp.site', 'myApp.build', 'myApp.configure', - 'myApp.create', + 'myApp.post', 'myApp.version', 'myApp.services' ]). diff --git a/index.html b/index.html index 464743f..5e10e7a 100644 --- a/index.html +++ b/index.html @@ -40,8 +40,8 @@
@@ -111,7 +111,7 @@ - + diff --git a/lib/deardesi-browser.js b/lib/deardesi-browser.js index 42935d0..b588b6d 100644 --- a/lib/deardesi-browser.js +++ b/lib/deardesi-browser.js @@ -368,7 +368,21 @@ }; fsapi.putFiles = function (files) { - var body = { files: files }; + var body = { files: files } + ; + + files.forEach(function (file) { + if (!file.contents || 'string' === typeof file.contents) { + return; + } + if (/\.json$/i.test(file.path)) { + file.contents = JSON.stringify(file.contents); + } + else if (/\.ya?ml$/i.test(file.path)) { + file.contents = exports.jsyaml.dump(file.contents); + } + }); + body = JSON.stringify(body); // this is more or less instant for a few MiB of posts return request.post('/api/fs/files', body).then(function (resp) { var response = JSON.parse(resp) diff --git a/views/create/create.js b/views/create/create.js deleted file mode 100644 index 22a97ea..0000000 --- a/views/create/create.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -angular.module('myApp.create', ['ngRoute']) - -.config(['$routeProvider', function($routeProvider) { - $routeProvider.when('/create', { - templateUrl: 'views/create/create.html', - controller: 'CreateCtrl as Create' - }); -}]) - -.controller('CreateCtrl', [function() { - var Desi = window.Desi || require('./deardesi').Desi - , scope = this - , desi = {} - ; - - Desi.init(desi).then(function () { - scope.run = function () { - return Desi.runDesi(desi).then(function () { Desi.otherStuff(); }) - .catch(function (e) { - console.error('A great and uncatchable error has befallen the land. Read ye here for das detalles..'); - console.error(e.message); - console.error(e); - throw e; - }); - }; - }); -}]); diff --git a/views/post/post.html b/views/post/post.html new file mode 100644 index 0000000..271ad84 --- /dev/null +++ b/views/post/post.html @@ -0,0 +1,145 @@ +