From 5ab4f05ec6bf32efd4a670d101d06d94baf7a0d5 Mon Sep 17 00:00:00 2001 From: fatchan Date: Tue, 1 Oct 2019 06:49:46 +0000 Subject: [PATCH] allow arrays of errors and messages for modals now tthat the compileileclient mixin is fixed --- gulp/res/css/style.css | 4 ++-- gulp/res/js/modal.js | 8 ++++---- helpers/dynamic.js | 6 ------ views/mixins/modal.pug | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/gulp/res/css/style.css b/gulp/res/css/style.css index 8714e0b3..3a77658f 100644 --- a/gulp/res/css/style.css +++ b/gulp/res/css/style.css @@ -340,9 +340,9 @@ td, th { } .nomarks { - list-style: none; margin: 5px; - padding: 0; + padding: 0 15px; + /*list-style: none;*/ } .modal-bg { diff --git a/gulp/res/js/modal.js b/gulp/res/js/modal.js index 7657b5fb..cef68b05 100644 --- a/gulp/res/js/modal.js +++ b/gulp/res/js/modal.js @@ -1,5 +1,5 @@ function pug_escape(e){var a=""+e,t=pug_match_html.exec(a);if(!t)return e;var r,c,n,s="";for(r=t.index,c=0;r]/;function modal(locals) {var pug_html = "", pug_mixins = {}, pug_interp;;var locals_for_with = (locals || {});(function (errors, messages, modal) {pug_mixins["modal"] = pug_interp = function(data){ +var pug_match_html=/["&<>]/;function modal(locals) {var pug_html = "", pug_mixins = {}, pug_interp;;var locals_for_with = (locals || {});(function (modal) {pug_mixins["modal"] = pug_interp = function(data){ var block = (this && this.block), attributes = (this && this.attributes) || {}; pug_html = pug_html + "\u003Cdiv class=\"modal-bg\"\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"modal\"\u003E\u003Cdiv class=\"row\"\u003E\u003Cp class=\"bold\"\u003E" + (pug_escape(null == (pug_interp = data.title) ? "" : pug_interp)) + "\u003C\u002Fp\u003E\u003Ca class=\"close postform-style\" id=\"modalclose\"\u003EX\u003C\u002Fa\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cul class=\"nomarks\"\u003E"; if (data.message) { @@ -8,7 +8,7 @@ pug_html = pug_html + "\u003Cli\u003E" + (pug_escape(null == (pug_interp = data. if (data.error) { pug_html = pug_html + "\u003Cli\u003E" + (pug_escape(null == (pug_interp = data.error) ? "" : pug_interp)) + "\u003C\u002Fli\u003E"; } -if (messages) { +if (data.messages) { // iterate data.messages ;(function(){ var $$obj = data.messages; @@ -28,7 +28,7 @@ pug_html = pug_html + "\u003Cli\u003E" + (pug_escape(null == (pug_interp = msg) }).call(this); } -if (errors) { +if (data.errors) { // iterate data.errors ;(function(){ var $$obj = data.errors; @@ -50,4 +50,4 @@ pug_html = pug_html + "\u003Cli\u003E" + (pug_escape(null == (pug_interp = error } pug_html = pug_html + "\u003C\u002Ful\u003E\u003C\u002Fdiv\u003E\u003C\u002Fdiv\u003E"; }; -pug_mixins["modal"](modal);}.call(this,"errors" in locals_for_with?locals_for_with.errors:typeof errors!=="undefined"?errors:undefined,"messages" in locals_for_with?locals_for_with.messages:typeof messages!=="undefined"?messages:undefined,"modal" in locals_for_with?locals_for_with.modal:typeof modal!=="undefined"?modal:undefined));;return pug_html;} \ No newline at end of file +pug_mixins["modal"](modal);}.call(this,"modal" in locals_for_with?locals_for_with.modal:typeof modal!=="undefined"?modal:undefined));;return pug_html;} \ No newline at end of file diff --git a/helpers/dynamic.js b/helpers/dynamic.js index dfaddd5b..f43d0d65 100644 --- a/helpers/dynamic.js +++ b/helpers/dynamic.js @@ -3,12 +3,6 @@ module.exports = (req, res, code, page, data) => { res.status(code); if (req.headers['x-using-xhr'] != null) { - if (data.messages) { - data.message = data.messages.join('\n'); - } - if (data.errors) { - data.message = data.errors.join('\n'); - } return res.json(data); } else { return res.render(page, data); diff --git a/views/mixins/modal.pug b/views/mixins/modal.pug index 0b08ed8c..8316b327 100644 --- a/views/mixins/modal.pug +++ b/views/mixins/modal.pug @@ -10,10 +10,10 @@ mixin modal(data) li #{data.message} if data.error li #{data.error} - if messages + if data.messages each msg in data.messages li #{msg} - if errors + if data.errors each error in data.errors li #{error}