From f9c4bd9b5af8c3285842515b5659ef03f21a66d2 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 3 Jul 2018 21:45:17 +0200 Subject: Ajax instead of form for avatar post. --- public/css/app.css | 4 ++++ public/js/app.js | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'public') diff --git a/public/css/app.css b/public/css/app.css index 4f0c90a..c26b6bb 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -10423,3 +10423,7 @@ a.text-dark:focus { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); } +.alert { + display: none; +} + diff --git a/public/js/app.js b/public/js/app.js index e0e3ac0..00c8898 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -149,7 +149,7 @@ module.exports = __webpack_require__(42); /* 12 */ /***/ (function(module, exports, __webpack_require__) { -eval("/**\n * First we will load all of this project's JavaScript dependencies which\n * includes Vue and other libraries. It is a great starting point when\n * building robust, powerful web applications using Vue and Laravel.\n */\n\nwindow.openpgp = __webpack_require__(13);\nwindow.Vue = __webpack_require__(14);\n__webpack_require__(17);\n__webpack_require__(40);\n__webpack_require__(41);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9yZXNvdXJjZXMvYXNzZXRzL2pzL2FwcC5qcz9iMTVmIl0sIm5hbWVzIjpbIndpbmRvdyIsIm9wZW5wZ3AiLCJyZXF1aXJlIiwiVnVlIl0sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0FBTUFBLE9BQU9DLE9BQVAsR0FBaUIsbUJBQUFDLENBQVEsRUFBUixDQUFqQjtBQUNBRixPQUFPRyxHQUFQLEdBQWEsbUJBQUFELENBQVEsRUFBUixDQUFiO0FBQ0EsbUJBQUFBLENBQVEsRUFBUjtBQUNBLG1CQUFBQSxDQUFRLEVBQVI7QUFDQSxtQkFBQUEsQ0FBUSxFQUFSIiwiZmlsZSI6IjEyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBGaXJzdCB3ZSB3aWxsIGxvYWQgYWxsIG9mIHRoaXMgcHJvamVjdCdzIEphdmFTY3JpcHQgZGVwZW5kZW5jaWVzIHdoaWNoXG4gKiBpbmNsdWRlcyBWdWUgYW5kIG90aGVyIGxpYnJhcmllcy4gSXQgaXMgYSBncmVhdCBzdGFydGluZyBwb2ludCB3aGVuXG4gKiBidWlsZGluZyByb2J1c3QsIHBvd2VyZnVsIHdlYiBhcHBsaWNhdGlvbnMgdXNpbmcgVnVlIGFuZCBMYXJhdmVsLlxuICovXG5cbndpbmRvdy5vcGVucGdwID0gcmVxdWlyZSgnb3BlbnBncCcpO1xud2luZG93LlZ1ZSA9IHJlcXVpcmUoJ3Z1ZScpO1xucmVxdWlyZSgnLi9ib290c3RyYXAnKTtcbnJlcXVpcmUoJy4vcHJvZmlsZScpO1xucmVxdWlyZSgnLi9jaGF0Jyk7XG5cblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gLi9yZXNvdXJjZXMvYXNzZXRzL2pzL2FwcC5qcyJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///12\n"); +eval("/**\n * First we will load all of this project's JavaScript dependencies which\n * includes Vue and other libraries. It is a great starting point when\n * building robust, powerful web applications using Vue and Laravel.\n */\n\nwindow.openpgp = __webpack_require__(13);\nwindow.Vue = __webpack_require__(14);\n__webpack_require__(17);\n__webpack_require__(47);\n__webpack_require__(40);\n__webpack_require__(41);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9yZXNvdXJjZXMvYXNzZXRzL2pzL2FwcC5qcz9iMTVmIl0sIm5hbWVzIjpbIndpbmRvdyIsIm9wZW5wZ3AiLCJyZXF1aXJlIiwiVnVlIl0sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0FBTUFBLE9BQU9DLE9BQVAsR0FBaUIsbUJBQUFDLENBQVEsRUFBUixDQUFqQjtBQUNBRixPQUFPRyxHQUFQLEdBQWEsbUJBQUFELENBQVEsRUFBUixDQUFiO0FBQ0EsbUJBQUFBLENBQVEsRUFBUjtBQUNBLG1CQUFBQSxDQUFRLEVBQVI7QUFDQSxtQkFBQUEsQ0FBUSxFQUFSO0FBQ0EsbUJBQUFBLENBQVEsRUFBUiIsImZpbGUiOiIxMi5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRmlyc3Qgd2Ugd2lsbCBsb2FkIGFsbCBvZiB0aGlzIHByb2plY3QncyBKYXZhU2NyaXB0IGRlcGVuZGVuY2llcyB3aGljaFxuICogaW5jbHVkZXMgVnVlIGFuZCBvdGhlciBsaWJyYXJpZXMuIEl0IGlzIGEgZ3JlYXQgc3RhcnRpbmcgcG9pbnQgd2hlblxuICogYnVpbGRpbmcgcm9idXN0LCBwb3dlcmZ1bCB3ZWIgYXBwbGljYXRpb25zIHVzaW5nIFZ1ZSBhbmQgTGFyYXZlbC5cbiAqL1xuXG53aW5kb3cub3BlbnBncCA9IHJlcXVpcmUoJ29wZW5wZ3AnKTtcbndpbmRvdy5WdWUgPSByZXF1aXJlKCd2dWUnKTtcbnJlcXVpcmUoJy4vYm9vdHN0cmFwJyk7XG5yZXF1aXJlKCcuL3NldHVwJyk7XG5yZXF1aXJlKCcuL3Byb2ZpbGUnKTtcbnJlcXVpcmUoJy4vY2hhdCcpO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIC4vcmVzb3VyY2VzL2Fzc2V0cy9qcy9hcHAuanMiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///12\n"); /***/ }), /* 13 */ @@ -335,7 +335,7 @@ eval("\n\n/**\n * Syntactic sugar for invoking a function and expanding an array /* 40 */ /***/ (function(module, exports) { -eval("$(\"#avatarFile\").on(\"change\", function () {\n var preview = document.querySelector('#image-preview');\n var file = document.querySelector(\"#avatarFile\").files[0];\n var reader = new FileReader();\n\n reader.addEventListener(\"load\", function () {\n preview.src = reader.result;\n }, false);\n\n if (file) {\n reader.readAsDataURL(file);\n }\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9yZXNvdXJjZXMvYXNzZXRzL2pzL3Byb2ZpbGUuanM/MWEwMCJdLCJuYW1lcyI6WyIkIiwib24iLCJwcmV2aWV3IiwiZG9jdW1lbnQiLCJxdWVyeVNlbGVjdG9yIiwiZmlsZSIsImZpbGVzIiwicmVhZGVyIiwiRmlsZVJlYWRlciIsImFkZEV2ZW50TGlzdGVuZXIiLCJzcmMiLCJyZXN1bHQiLCJyZWFkQXNEYXRhVVJMIl0sIm1hcHBpbmdzIjoiQUFBQUEsRUFBRSxhQUFGLEVBQWlCQyxFQUFqQixDQUFvQixRQUFwQixFQUE4QixZQUFNO0FBQ2hDLFFBQUlDLFVBQVVDLFNBQVNDLGFBQVQsQ0FBdUIsZ0JBQXZCLENBQWQ7QUFDQSxRQUFJQyxPQUFPRixTQUFTQyxhQUFULENBQXVCLGFBQXZCLEVBQXNDRSxLQUF0QyxDQUE0QyxDQUE1QyxDQUFYO0FBQ0EsUUFBSUMsU0FBUyxJQUFJQyxVQUFKLEVBQWI7O0FBRUFELFdBQU9FLGdCQUFQLENBQXdCLE1BQXhCLEVBQWdDLFlBQU07QUFDbENQLGdCQUFRUSxHQUFSLEdBQWNILE9BQU9JLE1BQXJCO0FBQ0gsS0FGRCxFQUVHLEtBRkg7O0FBSUEsUUFBSU4sSUFBSixFQUFVO0FBQ05FLGVBQU9LLGFBQVAsQ0FBcUJQLElBQXJCO0FBQ0g7QUFDSixDQVpEIiwiZmlsZSI6IjQwLmpzIiwic291cmNlc0NvbnRlbnQiOlsiJChcIiNhdmF0YXJGaWxlXCIpLm9uKFwiY2hhbmdlXCIsICgpID0+IHtcbiAgICB2YXIgcHJldmlldyA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJyNpbWFnZS1wcmV2aWV3Jyk7XG4gICAgdmFyIGZpbGUgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKFwiI2F2YXRhckZpbGVcIikuZmlsZXNbMF07XG4gICAgdmFyIHJlYWRlciA9IG5ldyBGaWxlUmVhZGVyKCk7XG5cbiAgICByZWFkZXIuYWRkRXZlbnRMaXN0ZW5lcihcImxvYWRcIiwgKCkgPT4ge1xuICAgICAgICBwcmV2aWV3LnNyYyA9IHJlYWRlci5yZXN1bHQ7XG4gICAgfSwgZmFsc2UpO1xuXG4gICAgaWYgKGZpbGUpIHtcbiAgICAgICAgcmVhZGVyLnJlYWRBc0RhdGFVUkwoZmlsZSk7XG4gICAgfVxufSk7XG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIC4vcmVzb3VyY2VzL2Fzc2V0cy9qcy9wcm9maWxlLmpzIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///40\n"); +eval("$(\"#avatarFile\").on(\"change\", function () {\n var preview = document.querySelector('#image-preview');\n var file = document.querySelector(\"#avatarFile\").files[0];\n var reader = new FileReader();\n\n reader.addEventListener(\"load\", function () {\n preview.src = reader.result;\n }, false);\n\n if (file) {\n reader.readAsDataURL(file);\n }\n});\n\n$(\"#avatarForm\").submit(function (e) {\n var url = \"/avatar\";\n var data = new FormData();\n $.each(jQuery('#avatarFile')[0].files, function (i, file) {\n data.append('avatar', file);\n });\n\n e.preventDefault();\n $.ajax({\n url: url,\n data: data,\n cache: false,\n contentType: false,\n processData: false,\n method: 'POST',\n type: 'POST',\n success: function success(data) {\n $(\"#avatarUploadSucceededAlert\").show();\n $(\"#avatarUploadSucceededMessage\").text(data.success);\n },\n error: function error() {\n $(\"#avatarUploadFailedAlert\").show();\n }\n });\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,ey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hdGFyVXBsb2FkRmFpbGVkQWxlcnRcIikuc2hvdygpO1xuICAgICAgICB9XG4gICAgfSk7XG59KTtcblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gLi9yZXNvdXJjZXMvYXNzZXRzL2pzL3Byb2ZpbGUuanMiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///40\n"); /***/ }), /* 41 */ @@ -349,5 +349,15 @@ eval("// var openpgp = window.openpgp;\n\n// var options = {\n// userIds: [{ eval("// removed by extract-text-webpack-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9yZXNvdXJjZXMvYXNzZXRzL3Nhc3MvYXBwLnNjc3M/NTEwNiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsImZpbGUiOiI0Mi5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIHJlbW92ZWQgYnkgZXh0cmFjdC10ZXh0LXdlYnBhY2stcGx1Z2luXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9yZXNvdXJjZXMvYXNzZXRzL3Nhc3MvYXBwLnNjc3Ncbi8vIG1vZHVsZSBpZCA9IDQyXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///42\n"); +/***/ }), +/* 43 */, +/* 44 */, +/* 45 */, +/* 46 */, +/* 47 */ +/***/ (function(module, exports) { + +eval("$.ajaxSetup({\n headers: {\n 'X-CSRF-Token': $('input[name=\"_token\"]').val()\n }\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9yZXNvdXJjZXMvYXNzZXRzL2pzL3NldHVwLmpzPzkzMWMiXSwibmFtZXMiOlsiJCIsImFqYXhTZXR1cCIsImhlYWRlcnMiLCJ2YWwiXSwibWFwcGluZ3MiOiJBQUFBQSxFQUFFQyxTQUFGLENBQVk7QUFDUkMsYUFBUztBQUNMLHdCQUFnQkYsRUFBRSxzQkFBRixFQUEwQkcsR0FBMUI7QUFEWDtBQURELENBQVoiLCJmaWxlIjoiNDcuanMiLCJzb3VyY2VzQ29udGVudCI6WyIkLmFqYXhTZXR1cCh7XG4gICAgaGVhZGVyczoge1xuICAgICAgICAnWC1DU1JGLVRva2VuJzogJCgnaW5wdXRbbmFtZT1cIl90b2tlblwiXScpLnZhbCgpXG4gICAgfVxufSk7XG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIC4vcmVzb3VyY2VzL2Fzc2V0cy9qcy9zZXR1cC5qcyJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///47\n"); + /***/ }) /******/ ]); \ No newline at end of file -- cgit v1.2.3