This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 84c3b97377b654384f512b634f3d51bc2b392d0a Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Jul 24 17:49:00 2017 +0200 suppression de code mort --- pollen-ui-riot-js/src/main/web/js/FormHelper.js | 106 --------------------- pollen-ui-riot-js/src/main/web/js/PollForm.js | 1 - pollen-ui-riot-js/src/main/web/tag/SignUp.tag.html | 1 - 3 files changed, 108 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/js/FormHelper.js b/pollen-ui-riot-js/src/main/web/js/FormHelper.js deleted file mode 100644 index 25b3347c..00000000 --- a/pollen-ui-riot-js/src/main/web/js/FormHelper.js +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * #%L - * Pollen :: UI (Riot Js) - * %% - * Copyright (C) 2009 - 2017 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -let logger = require("./Logger"); - -class FormHelper { - - static formToMap(form) { - - let moment = require("moment"); - - let result = {}; - Array.prototype.forEach.call(form.elements, (e) => { - if (e.name) { - if (e.type === "checkbox") { - result[e.name] = !!e.checked; - } else if (e.type === "datetime-local") { - if (e.value !== "") { - result[e.name] = moment(e.value).format("YYYY-MM-DDTHH:mm"); - logger.info("date::: " + e.value + " -- " + result[e.name]); - } - } else if (e.type === "radio") { - Array.prototype.forEach.call(form.elements[e.name], function(r) { - if (r.checked) { - result[e.name] = r.value; - } - }); - } else if (e.tagName === "SELECT") { - if (e.multiple) { - let list = result[e.name] = []; - Array.prototype.forEach.call(e.selectedOptions, function(o) { - list.push(o.value); - }); - } else { - result[e.name] = e.value; - } - } else { - result[e.name] = e.value; - } - } - }); - return result; - } - - static fillForm(form, context, defaults = {}) { - - let moment = require("moment"); - - let formData = context._formData || context; - Array.prototype.forEach.call(form.elements, (e) => { - if (e.name) { - let value = - formData[e.name] || formData["_" + e.name] || - context[e.name] || context["_" + e.name] || - defaults[e.name] || ""; - - if (e.type === "checkbox") { - e.checked = !!value; - } else if (e.type === "datetime-local") { - let d = new Date(value); - if (!isNaN(d.getTime())) { - e.value = moment(d).format("YYYY-MM-DDThh:mm"); - //e.value = d.toISOString().replace("Z", ""); - } - } else if (e.type === "radio") { - Array.prototype.forEach.call(form.elements[e.name], function(r) { - if (r.value === value) { - r.checked = true; - } - }); - } else if (e.tagName === "SELECT") { - if (e.multiple) { - let values = new Set(Array.isArray(value) ? value : [value]); - Array.prototype.forEach.call(e.options, function(o) { - o.selected = values.has(o.value); - }); - } else { - e.value = value; - } - } else { - e.value = value; - } - } - }); - } - -} - -module.exports = FormHelper; diff --git a/pollen-ui-riot-js/src/main/web/js/PollForm.js b/pollen-ui-riot-js/src/main/web/js/PollForm.js index e7135964..15c5ca98 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollForm.js +++ b/pollen-ui-riot-js/src/main/web/js/PollForm.js @@ -39,7 +39,6 @@ class PollForm { "voters" ]; this.pollService = require("./PollService"); - this.FormHelper = require("./FormHelper"); this.pageTracker = require("./PageTracker"); this.step = -1; this.maxStepReached = -1; diff --git a/pollen-ui-riot-js/src/main/web/tag/SignUp.tag.html b/pollen-ui-riot-js/src/main/web/tag/SignUp.tag.html index 52c6e6ee..9c99febc 100644 --- a/pollen-ui-riot-js/src/main/web/tag/SignUp.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/SignUp.tag.html @@ -103,7 +103,6 @@ require("./components/HumanInput.tag.html"); <script type="es6"> let authService = require("../js/AuthService"); let session = require("../js/Session"); - let FormHelper = require("../js/FormHelper"); this.installBundle(session, "signup"); this.errors = {}; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.