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 b5bd7a6b6ce48f8323bc569a3a79e391ac9400a9 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed May 16 14:01:16 2018 +0200 Maj vers webpack 4 --- pollen-ui-riot-js/.eslintrc | 3 + pollen-ui-riot-js/package.json | 38 +++--- pollen-ui-riot-js/src/main/js/riotjs-loader.js | 61 --------- pollen-ui-riot-js/src/main/web/css/blaze.css | 2 +- pollen-ui-riot-js/src/main/web/index.js | 18 ++- pollen-ui-riot-js/src/main/web/js/AuthService.js | 6 +- pollen-ui-riot-js/src/main/web/js/Choice.js | 2 +- pollen-ui-riot-js/src/main/web/js/ChoiceService.js | 6 +- .../src/main/web/js/CommentService.js | 6 +- .../src/main/web/js/ConfigurationService.js | 6 +- .../src/main/web/js/FavoriteListService.js | 6 +- .../src/main/web/js/FeedbackService.js | 6 +- pollen-ui-riot-js/src/main/web/js/FetchService.js | 7 +- pollen-ui-riot-js/src/main/web/js/I18nHelper.js | 10 +- pollen-ui-riot-js/src/main/web/js/Logger.js | 2 +- pollen-ui-riot-js/src/main/web/js/Message.js | 4 +- pollen-ui-riot-js/src/main/web/js/PageTracker.js | 4 +- pollen-ui-riot-js/src/main/web/js/Pagination.js | 2 +- pollen-ui-riot-js/src/main/web/js/Poll.js | 35 +++--- pollen-ui-riot-js/src/main/web/js/PollForm.js | 27 ++-- pollen-ui-riot-js/src/main/web/js/PollService.js | 6 +- pollen-ui-riot-js/src/main/web/js/PollenBus.js | 5 +- .../src/main/web/js/ResourceService.js | 7 +- pollen-ui-riot-js/src/main/web/js/ResultService.js | 6 +- pollen-ui-riot-js/src/main/web/js/Session.js | 23 ++-- pollen-ui-riot-js/src/main/web/js/Singleton.js | 2 +- pollen-ui-riot-js/src/main/web/js/UIHelper.js | 13 +- pollen-ui-riot-js/src/main/web/js/UserService.js | 6 +- .../src/main/web/js/VoteCountingTypeService.js | 6 +- pollen-ui-riot-js/src/main/web/js/VoteService.js | 6 +- .../src/main/web/js/VoterListService.js | 10 +- .../src/main/web/tag/Authorization.tag.html | 9 +- .../src/main/web/tag/ContentLoader.tag.html | 21 ++-- .../src/main/web/tag/FilterLoginProvider.tag.js | 8 +- .../src/main/web/tag/HeaderI18n.tag.html | 2 +- .../src/main/web/tag/PageChanged.tag.js | 2 +- .../src/main/web/tag/Pagination.tag.html | 11 +- pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html | 9 +- .../src/main/web/tag/PollenFooter.tag.html | 21 ++-- .../src/main/web/tag/PollenHeader.tag.html | 46 +++---- .../src/main/web/tag/PollenMessageManager.tag.html | 9 +- .../src/main/web/tag/PollenWaiter.tag.html | 7 +- .../src/main/web/tag/Privacy.tag.html | 5 +- pollen-ui-riot-js/src/main/web/tag/QrCode.tag.html | 9 +- .../src/main/web/tag/SignCheck.tag.html | 21 ++-- pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html | 29 ++--- .../src/main/web/tag/SignInAction.tag.js | 5 +- pollen-ui-riot-js/src/main/web/tag/SignUp.tag.html | 50 ++++---- .../src/main/web/tag/UserProfile.tag.html | 123 ++++++++++--------- .../src/main/web/tag/admin/GtuCard.tag.html | 18 +-- .../src/main/web/tag/admin/Gtus.tag.html | 20 +-- .../src/main/web/tag/admin/LoginProviders.tag.html | 32 ++--- .../src/main/web/tag/admin/UserCard.tag.html | 28 +++-- .../src/main/web/tag/admin/UserEditModal.tag.html | 32 ++--- .../src/main/web/tag/admin/Users.tag.html | 16 +-- .../src/main/web/tag/components/Avatar.tag.html | 13 +- .../src/main/web/tag/components/Card.tag.html | 6 +- .../src/main/web/tag/components/Checkbox.tag.html | 7 +- .../main/web/tag/components/GtuValidation.tag.html | 14 ++- .../src/main/web/tag/components/Search.tag.html | 10 +- .../tag/components/UserEmailAddressList.tag.html | 27 ++-- .../main/web/tag/components/date-picker.tag.html | 14 ++- .../web/tag/components/date-time-picker.tag.html | 10 +- .../main/web/tag/components/time-picker.tag.html | 9 +- .../web/tag/favoriteList/ChildListCard.tag.html | 15 +-- .../tag/favoriteList/ChildListEditModal.tag.html | 23 ++-- .../web/tag/favoriteList/FavoriteList.tag.html | 32 ++--- .../web/tag/favoriteList/FavoriteListCard.tag.html | 15 +-- .../favoriteList/FavoriteListEditModal.tag.html | 19 +-- .../web/tag/favoriteList/FavoriteLists.tag.html | 32 ++--- .../web/tag/favoriteList/ImportCsvModal.tag.html | 20 +-- .../web/tag/favoriteList/ImportLdapModal.tag.html | 22 ++-- .../main/web/tag/favoriteList/MemberCard.tag.html | 15 +-- .../web/tag/favoriteList/MemberEditModal.tag.html | 25 ++-- .../src/main/web/tag/poll/CheckEmails.tag.html | 16 +-- .../src/main/web/tag/poll/Choice.tag.html | 31 ++--- .../src/main/web/tag/poll/ChoiceView.tag.html | 13 +- .../src/main/web/tag/poll/Choices.tag.html | 14 ++- .../src/main/web/tag/poll/Comments.tag.html | 63 +++++----- .../src/main/web/tag/poll/Description.tag.html | 28 +++-- .../src/main/web/tag/poll/EditPoll.tag.html | 38 +++--- .../src/main/web/tag/poll/EditVote.tag.html | 44 +++---- .../src/main/web/tag/poll/Podium.tag.html | 95 -------------- .../src/main/web/tag/poll/Poll.tag.html | 75 ++++++------ .../src/main/web/tag/poll/PollCard.tag.html | 19 +-- .../src/main/web/tag/poll/Polls.tag.html | 26 ++-- .../src/main/web/tag/poll/Report.tag.html | 16 +-- .../src/main/web/tag/poll/Results.tag.html | 42 ++++--- .../src/main/web/tag/poll/Settings.tag.html | 136 +++++++++++---------- .../src/main/web/tag/poll/Summary.tag.html | 58 ++++----- .../src/main/web/tag/poll/Votes.tag.html | 40 +++--- .../src/main/web/tag/poll/VotesTable.tag.html | 23 ++-- .../src/main/web/tag/popup/ConfirmPopup.tag.html | 7 +- .../src/main/web/tag/popup/FeedbackModal.tag.html | 37 +++--- .../src/main/web/tag/popup/GtuChangeModal.tag.html | 10 +- .../main/web/tag/popup/InformationPopup.tag.html | 4 +- .../src/main/web/tag/popup/Modal.tag.html | 8 +- .../src/main/web/tag/popup/NewPassword.tag.html | 12 +- .../src/main/web/tag/popup/QrCodeButton.tag.html | 2 +- .../main/web/tag/popup/ResendValidation.tag.html | 12 +- .../web/tag/voteCountingType/BordaConfig.tag.html | 12 +- .../voteCountingType/BordaDetailResult.tag.html | 22 ++-- .../CondorcetDetailResult.tag.html | 20 +-- .../voteCountingType/CoombsDetailResult.tag.html | 24 ++-- .../tag/voteCountingType/CumulativeConfig.tag.html | 4 +- .../InstantRunoffDetailResult.tag.html | 20 +-- .../MajorityJudgmentConfig.tag.html | 13 +- .../MajorityJudgmentDetailResult.tag.html | 18 +-- .../MaxChoicesNumberConfig.tag.html | 11 +- .../tag/voterList/ImportFavoritListModal.tag.html | 14 +-- .../src/main/web/tag/voterList/VoterList.tag.html | 43 +++---- .../main/web/tag/voterList/VoterListCard.tag.html | 23 ++-- .../web/tag/voterList/VoterListEditModal.tag.html | 22 ++-- .../web/tag/voterList/VoterListMemberCard.tag.html | 17 +-- .../voterList/VoterListMemberEditModal.tag.html | 24 ++-- pollen-ui-riot-js/webpack.config.js | 39 +++--- 116 files changed, 1169 insertions(+), 1228 deletions(-) diff --git a/pollen-ui-riot-js/.eslintrc b/pollen-ui-riot-js/.eslintrc index b63cb0c6..e0ef3902 100644 --- a/pollen-ui-riot-js/.eslintrc +++ b/pollen-ui-riot-js/.eslintrc @@ -19,6 +19,9 @@ "mocha": false }, "plugins": [ "riot" ], + "parserOptions": { + "sourceType": "module" + }, "rules" : { "comma-dangle": [ diff --git a/pollen-ui-riot-js/package.json b/pollen-ui-riot-js/package.json index 9489a657..7b2d1d98 100644 --- a/pollen-ui-riot-js/package.json +++ b/pollen-ui-riot-js/package.json @@ -24,35 +24,37 @@ } ], "scripts": { - "start": "webpack-dev-server --hot --inline --host 0.0.0.0 --public ${POLLEN_UI_CONTEXT:-localhost:8080}", - "package": "webpack --bail" + "start": "webpack-dev-server --mode development --hot --inline --host 0.0.0.0 --public ${POLLEN_UI_CONTEXT:-localhost:8080}", + "package": "webpack --config webpack.config.js --mode production" }, "devDependencies": { - "babel": "^6.5.2", - "babel-cli": "^6.18.0", - "babel-core": "^6.25.0", - "babel-loader": "^6.2.5", - "copy-webpack-plugin": "^4.3.1", - "eslint": "^3.16.0", + "@babel/core": "7.0.0-beta.46", + "@babel/preset-env": "7.0.0-beta.46", + "babel-loader": "^8.0.0-beta.0", + "copy-webpack-plugin": "^4.5.1", + "eslint": "^4.18.2", "eslint-plugin-riot": "^0.1.7", - "json-loader": "^0.5.4", + "json-loader": "^0.5.7", "loader-utils": "^0.2.6", - "riot-compiler": "^3.4.0", - "webpack": "^2.7.0", - "webpack-dev-server": "^2.11.1" + "riot-compiler": "^3.5.1", + "riot-hot-reload": "^1.0.0", + "riot-tag-loader": "^2.0.2", + "webpack": "^4.8.3", + "webpack-cli": "^2.0.14", + "webpack-dev-server": "^3.1.4" }, "dependencies": { "console.history": "^1.5.0", "font-awesome": "4.7.0", "html2canvas": "^0.5.0-beta4", - "moment": "^2.20.1", - "moment-timezone": "^0.5.14", + "moment": "^2.22.1", + "moment-timezone": "^0.5.17", "nprogress": "^0.2.0", "object.values": "^1.0.4", - "qrcode-generator": "^1.3.0", + "qrcode-generator": "^1.4.0", "remarkable": "^1.7.1", - "riot": "^3.8.1", - "riot-route": "^3.1.2", - "tooltip.js": "^1.1.7" + "riot": "^3.10.0", + "riot-route": "^3.1.3", + "tooltip.js": "^1.2.0" } } diff --git a/pollen-ui-riot-js/src/main/js/riotjs-loader.js b/pollen-ui-riot-js/src/main/js/riotjs-loader.js deleted file mode 100644 index ab2e5717..00000000 --- a/pollen-ui-riot-js/src/main/js/riotjs-loader.js +++ /dev/null @@ -1,61 +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% - */ -"use strict"; - -let riot = require("riot-compiler"); -let loaderUtils = require("loader-utils"); - -module.exports = function(source) { - - let content = source; - let options = loaderUtils.parseQuery(this.query); - - if (this.cacheable) { - this.cacheable(); - } - - Object.keys(options).forEach(function(key) { - switch (options[key]) { - case "true": - options[key] = true; - break; - case "false": - options[key] = false; - break; - case "null": - options[key] = null; - break; - default: // "undefined" - options[key] = undefined; - break; - } - }); - - try { - return riot.compile(content, options); - } catch (e) { - if (e instanceof Error) { - throw e; - } else { - throw new Error(e); - } - } -}; diff --git a/pollen-ui-riot-js/src/main/web/css/blaze.css b/pollen-ui-riot-js/src/main/web/css/blaze.css index 7547e833..cfd6286f 100644 --- a/pollen-ui-riot-js/src/main/web/css/blaze.css +++ b/pollen-ui-riot-js/src/main/web/css/blaze.css @@ -878,7 +878,7 @@ select.c-field:not([multiple]) { .c-card__item--brand { background-color:var(--brand); - color:var(--background);; + color:var(--background); } .c-card__item--info { diff --git a/pollen-ui-riot-js/src/main/web/index.js b/pollen-ui-riot-js/src/main/web/index.js index 1a5e3107..4aa7db2c 100644 --- a/pollen-ui-riot-js/src/main/web/index.js +++ b/pollen-ui-riot-js/src/main/web/index.js @@ -18,13 +18,19 @@ // * along with this program. If not, see <http://www.gnu.org/licenses/>. // * #L% // */ -require("console.history"); -riot.mixin(require("./js/I18nHelper")); -riot.mixin(require("./js/UIHelper")); -riot.mixin({logger: require("./js/Logger")}); +// import history from "console.history"; +import riot from "riot"; +import "riot-hot-reload"; +import i18nHelper from "./js/I18nHelper"; +import uiHelper from "./js/UIHelper"; +import logger from "./js/Logger"; +import route from "riot-route/lib/tag"; +import "./tag/Pollen.tag.html"; + +riot.mixin(i18nHelper); +riot.mixin(uiHelper); +riot.mixin({logger: logger}); -require("./tag/Pollen.tag.html"); riot.mount("*"); -let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; route.start(true); diff --git a/pollen-ui-riot-js/src/main/web/js/AuthService.js b/pollen-ui-riot-js/src/main/web/js/AuthService.js index 19d110ca..c256164a 100644 --- a/pollen-ui-riot-js/src/main/web/js/AuthService.js +++ b/pollen-ui-riot-js/src/main/web/js/AuthService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class AuthService extends FetchService { @@ -118,4 +118,4 @@ class AuthService extends FetchService { } } -module.exports = singleton(AuthService); +export default singleton(AuthService); diff --git a/pollen-ui-riot-js/src/main/web/js/Choice.js b/pollen-ui-riot-js/src/main/web/js/Choice.js index cc5b223b..8121a347 100644 --- a/pollen-ui-riot-js/src/main/web/js/Choice.js +++ b/pollen-ui-riot-js/src/main/web/js/Choice.js @@ -28,4 +28,4 @@ class Choice { } } -module.exports = Choice; +export default Choice; diff --git a/pollen-ui-riot-js/src/main/web/js/ChoiceService.js b/pollen-ui-riot-js/src/main/web/js/ChoiceService.js index 94c0d6e5..82d5d810 100644 --- a/pollen-ui-riot-js/src/main/web/js/ChoiceService.js +++ b/pollen-ui-riot-js/src/main/web/js/ChoiceService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class ChoiceService extends FetchService { @@ -67,4 +67,4 @@ class ChoiceService extends FetchService { } } -module.exports = singleton(ChoiceService); +export default singleton(ChoiceService); diff --git a/pollen-ui-riot-js/src/main/web/js/CommentService.js b/pollen-ui-riot-js/src/main/web/js/CommentService.js index e482d11b..e04371bd 100644 --- a/pollen-ui-riot-js/src/main/web/js/CommentService.js +++ b/pollen-ui-riot-js/src/main/web/js/CommentService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class CommentService extends FetchService { @@ -76,4 +76,4 @@ class CommentService extends FetchService { } } -module.exports = singleton(CommentService); +export default singleton(CommentService); diff --git a/pollen-ui-riot-js/src/main/web/js/ConfigurationService.js b/pollen-ui-riot-js/src/main/web/js/ConfigurationService.js index 54777d38..88847aa1 100644 --- a/pollen-ui-riot-js/src/main/web/js/ConfigurationService.js +++ b/pollen-ui-riot-js/src/main/web/js/ConfigurationService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class ConfigurationService extends FetchService { @@ -34,4 +34,4 @@ class ConfigurationService extends FetchService { } } -module.exports = singleton(ConfigurationService); +export default singleton(ConfigurationService); diff --git a/pollen-ui-riot-js/src/main/web/js/FavoriteListService.js b/pollen-ui-riot-js/src/main/web/js/FavoriteListService.js index 92037c55..3a444a26 100644 --- a/pollen-ui-riot-js/src/main/web/js/FavoriteListService.js +++ b/pollen-ui-riot-js/src/main/web/js/FavoriteListService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class FavoriteListService extends FetchService { @@ -113,4 +113,4 @@ class FavoriteListService extends FetchService { } -module.exports = singleton(FavoriteListService); +export default singleton(FavoriteListService); diff --git a/pollen-ui-riot-js/src/main/web/js/FeedbackService.js b/pollen-ui-riot-js/src/main/web/js/FeedbackService.js index 9678daf3..3fcd8632 100644 --- a/pollen-ui-riot-js/src/main/web/js/FeedbackService.js +++ b/pollen-ui-riot-js/src/main/web/js/FeedbackService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class FeedbackService extends FetchService { @@ -30,4 +30,4 @@ class FeedbackService extends FetchService { } -module.exports = singleton(FeedbackService); +export default singleton(FeedbackService); diff --git a/pollen-ui-riot-js/src/main/web/js/FetchService.js b/pollen-ui-riot-js/src/main/web/js/FetchService.js index 93778d5f..c28b04d6 100644 --- a/pollen-ui-riot-js/src/main/web/js/FetchService.js +++ b/pollen-ui-riot-js/src/main/web/js/FetchService.js @@ -19,7 +19,8 @@ * #L% */ -let bus = require("./PollenBus.js"); +import bus from "./PollenBus.js"; +import session from "./Session"; class FetchService { @@ -32,7 +33,7 @@ class FetchService { if (!(body instanceof FormData)) { headers["Content-Type"] = "application/json;charset=UTF-8"; } - let session = require("./Session"); + headers["X-Pollen-UI-context"] = JSON.stringify(session.pollenUIContext); headers["Content-Language"] = session.locale; let loadEvent = {}; @@ -136,4 +137,4 @@ class FetchService { } } -module.exports = FetchService; +export default FetchService; diff --git a/pollen-ui-riot-js/src/main/web/js/I18nHelper.js b/pollen-ui-riot-js/src/main/web/js/I18nHelper.js index 44d05500..2f5f74d5 100644 --- a/pollen-ui-riot-js/src/main/web/js/I18nHelper.js +++ b/pollen-ui-riot-js/src/main/web/js/I18nHelper.js @@ -18,7 +18,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -module.exports = { +export default { installBundle(session, value, callback) { this.bundle = session.i18n; @@ -41,21 +41,21 @@ module.exports = { generateBundle(locale, value) { let bundle = this.bundle[locale]; - this.__ = {}; + this._t = {}; Object.keys(bundle).forEach((key) => { if (key.startsWith(value + "_")) { let realKey = key.substring(value.length + 1); - this.__[realKey] = bundle[key]; + this._t[realKey] = bundle[key]; if (this.debug) { - this.logger.debug(realKey + " -> " + this.__[realKey]); + this.logger.debug(realKey + " -> " + this._t[realKey]); } } }); }, _l(key, ...params) { - return this.i18nformat(this.__[key], params) || key; + return this.i18nformat(this._t[key], params) || key; }, translateErrors(errors) { diff --git a/pollen-ui-riot-js/src/main/web/js/Logger.js b/pollen-ui-riot-js/src/main/web/js/Logger.js index 98bcf0f8..099afad4 100644 --- a/pollen-ui-riot-js/src/main/web/js/Logger.js +++ b/pollen-ui-riot-js/src/main/web/js/Logger.js @@ -19,7 +19,7 @@ * #L% */ -module.exports = { +export default { log(message) { // eslint-disable-next-line no-console console.log(message); diff --git a/pollen-ui-riot-js/src/main/web/js/Message.js b/pollen-ui-riot-js/src/main/web/js/Message.js index 4f6d598d..339ccbc6 100644 --- a/pollen-ui-riot-js/src/main/web/js/Message.js +++ b/pollen-ui-riot-js/src/main/web/js/Message.js @@ -18,7 +18,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let values = require("object.values"); +import values from "object.values"; if (!Object.values) { values.shim(); } @@ -44,4 +44,4 @@ class Message { } } -module.exports = Message; +export default Message; diff --git a/pollen-ui-riot-js/src/main/web/js/PageTracker.js b/pollen-ui-riot-js/src/main/web/js/PageTracker.js index 580f75fc..d21f53a1 100644 --- a/pollen-ui-riot-js/src/main/web/js/PageTracker.js +++ b/pollen-ui-riot-js/src/main/web/js/PageTracker.js @@ -18,7 +18,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); +import singleton from "./Singleton"; class PageTracker { @@ -94,4 +94,4 @@ class PageTracker { } } -module.exports = singleton(PageTracker); +export default singleton(PageTracker); diff --git a/pollen-ui-riot-js/src/main/web/js/Pagination.js b/pollen-ui-riot-js/src/main/web/js/Pagination.js index 8102f88f..94aec6af 100644 --- a/pollen-ui-riot-js/src/main/web/js/Pagination.js +++ b/pollen-ui-riot-js/src/main/web/js/Pagination.js @@ -29,4 +29,4 @@ class Pagination { } -module.exports = Pagination; +export default Pagination; diff --git a/pollen-ui-riot-js/src/main/web/js/Poll.js b/pollen-ui-riot-js/src/main/web/js/Poll.js index f22ccbce..8f4ed9a3 100644 --- a/pollen-ui-riot-js/src/main/web/js/Poll.js +++ b/pollen-ui-riot-js/src/main/web/js/Poll.js @@ -18,19 +18,17 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let pollService = require("./PollService"); -let voteService = require("./VoteService"); -let Choice = require("./Choice"); -let choiceService = require("./ChoiceService"); -let voteCountingTypeService = require("./VoteCountingTypeService"); -let resultService = require("./ResultService"); -let commentService = require("./CommentService"); -let Pagination = require("./Pagination"); -let resourceService = require("./ResourceService"); -let bus = require("./PollenBus.js"); -let Message = require("./Message"); -let pageTracker = require("./PageTracker"); +import singleton from "./Singleton"; +import pollService from "./PollService"; +import voteService from "./VoteService"; +import Choice from "./Choice"; +import choiceService from "./ChoiceService"; +import voteCountingTypeService from "./VoteCountingTypeService"; +import resultService from "./ResultService"; +import commentService from "./CommentService"; +import resourceService from "./ResourceService"; +import bus from "./PollenBus.js"; +import pageTracker from "./PageTracker"; class Poll { @@ -94,8 +92,7 @@ class Poll { this.choices = result; bus.trigger("poll", this); return Promise.resolve(this); - } - ); + }); } return Promise.reject("Init poll after load choices"); } @@ -222,7 +219,8 @@ class Poll { if (this.resultIsVisible) { return Promise.all([ choiceService.getChoices(this.id, this.getPermission()), - resultService.getResults(this.id, this.getPermission())]).then(resultsArray => { + resultService.getResults(this.id, this.getPermission())]) + .then(resultsArray => { this.choices = resultsArray[0]; this.choiceCount = this.choices.length; this.results = resultsArray[1]; @@ -234,8 +232,7 @@ class Poll { bus.trigger("poll", this); return Promise.resolve(this); - } - ); + }); } return Promise.resolve(this); }); @@ -417,4 +414,4 @@ class Poll { } -module.exports = singleton(Poll); +export default singleton(Poll); 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 044a101c..f6401828 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollForm.js +++ b/pollen-ui-riot-js/src/main/web/js/PollForm.js @@ -18,16 +18,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let Choice = require("./Choice"); -let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; -let voteCountingTypeService = require("./VoteCountingTypeService"); -let choiceService = require("./ChoiceService"); -let resourceService = require("./ResourceService"); -let pollService = require("./PollService"); -let voterListService = require("./VoterListService"); -let bus = require("./PollenBus"); -let logger = require("./Logger"); +import singleton from "./Singleton"; +import Choice from "./Choice"; +import voteCountingTypeService from "./VoteCountingTypeService"; +import choiceService from "./ChoiceService"; +import resourceService from "./ResourceService"; +import pollService from "./PollService"; +import voterListService from "./VoterListService"; +import bus from "./PollenBus"; +import logger from "./Logger"; +import pageTracker from "./PageTracker"; class PollForm { @@ -38,8 +38,9 @@ class PollForm { "options", "voters" ]; - this.pollService = require("./PollService"); - this.pageTracker = require("./PageTracker"); + + this.pollService = pollService; + this.pageTracker = pageTracker; this.step = -1; this.maxStepReached = -1; this.isInit = false; @@ -334,4 +335,4 @@ class PollForm { } -module.exports = singleton(PollForm); +export default singleton(PollForm); diff --git a/pollen-ui-riot-js/src/main/web/js/PollService.js b/pollen-ui-riot-js/src/main/web/js/PollService.js index c1537c8b..472edb1f 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollService.js +++ b/pollen-ui-riot-js/src/main/web/js/PollService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class PollService extends FetchService { @@ -130,4 +130,4 @@ class PollService extends FetchService { } } -module.exports = singleton(PollService); +export default singleton(PollService); diff --git a/pollen-ui-riot-js/src/main/web/js/PollenBus.js b/pollen-ui-riot-js/src/main/web/js/PollenBus.js index f6565904..6a98fb6e 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollenBus.js +++ b/pollen-ui-riot-js/src/main/web/js/PollenBus.js @@ -18,7 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); +import singleton from "./Singleton"; +import riot from "riot"; class PollenBus { @@ -28,4 +29,4 @@ class PollenBus { } -module.exports = singleton(PollenBus); +export default singleton(PollenBus); diff --git a/pollen-ui-riot-js/src/main/web/js/ResourceService.js b/pollen-ui-riot-js/src/main/web/js/ResourceService.js index 34417a67..f37bda2b 100644 --- a/pollen-ui-riot-js/src/main/web/js/ResourceService.js +++ b/pollen-ui-riot-js/src/main/web/js/ResourceService.js @@ -18,9 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); -let logger = require("./Logger"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class ResourceService extends FetchService { @@ -84,4 +83,4 @@ class ResourceService extends FetchService { } } -module.exports = singleton(ResourceService); +export default singleton(ResourceService); diff --git a/pollen-ui-riot-js/src/main/web/js/ResultService.js b/pollen-ui-riot-js/src/main/web/js/ResultService.js index fff4c503..8a0c12d3 100644 --- a/pollen-ui-riot-js/src/main/web/js/ResultService.js +++ b/pollen-ui-riot-js/src/main/web/js/ResultService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class ResultService extends FetchService { @@ -35,4 +35,4 @@ class ResultService extends FetchService { } -module.exports = singleton(ResultService); +export default singleton(ResultService); diff --git a/pollen-ui-riot-js/src/main/web/js/Session.js b/pollen-ui-riot-js/src/main/web/js/Session.js index e4fe09e0..980c3cb7 100644 --- a/pollen-ui-riot-js/src/main/web/js/Session.js +++ b/pollen-ui-riot-js/src/main/web/js/Session.js @@ -19,13 +19,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let authService = require("./AuthService"); -let resourceService = require("./ResourceService"); -let configurationService = require("./ConfigurationService"); -let bus = require("./PollenBus.js"); -let logger = require("./Logger"); -let pageTracker = require("./PageTracker"); +import singleton from "./Singleton"; +import authService from "./AuthService"; +import resourceService from "./ResourceService"; +import configurationService from "./ConfigurationService"; +import bus from "./PollenBus.js"; +import logger from "./Logger"; +import pageTracker from "./PageTracker"; +import riot from "riot"; +import fr from "../i18n/fr.json"; +import en from "../i18n/en.json"; class Session { @@ -54,8 +57,8 @@ class Session { }; // pour contenir les traductions this.i18n = { - fr: require("../i18n/fr.json"), - en: require("../i18n/en.json") + fr: fr, + en: en }; // pour contenir l"utillisateur connecté this.user = null; @@ -238,4 +241,4 @@ class Session { } -module.exports = singleton(Session); +export default singleton(Session); diff --git a/pollen-ui-riot-js/src/main/web/js/Singleton.js b/pollen-ui-riot-js/src/main/web/js/Singleton.js index 05f422d6..588ab2ff 100644 --- a/pollen-ui-riot-js/src/main/web/js/Singleton.js +++ b/pollen-ui-riot-js/src/main/web/js/Singleton.js @@ -20,7 +20,7 @@ */ let singletons = window.__singletons__ = new Map(); -module.exports = (Klass) => { +export default (Klass) => { let instance = singletons.get(Klass); if (!instance) { instance = new Klass(); diff --git a/pollen-ui-riot-js/src/main/web/js/UIHelper.js b/pollen-ui-riot-js/src/main/web/js/UIHelper.js index 646b1155..2360caad 100644 --- a/pollen-ui-riot-js/src/main/web/js/UIHelper.js +++ b/pollen-ui-riot-js/src/main/web/js/UIHelper.js @@ -18,11 +18,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let session = require("./Session.js"); -let moment = require("moment"); -var momentTZ = require("moment-timezone"); +import session from "./Session.js"; +import moment from "moment"; +import bus from "./PollenBus.js"; +import momentTZ from "moment-timezone"; -module.exports = { +export default { getWindowDimensions() { var w = window, d = document, @@ -77,7 +78,7 @@ module.exports = { return this.formatDate(date, "YYYY-MM-DDTHH:mm:ss.SSS"); }, - bus: require("./PollenBus.js"), + bus: bus, listen(events, callback) { this.bus.on(events, callback); @@ -89,7 +90,7 @@ module.exports = { checkSize(resource) { if (resource && resource.size && resource.size > window.pollenConf.resourceMaxSize) { return this.info( - this.__.fileSizeMax_title, + this._t.fileSizeMax_title, this._l("fileSizeMax_message", resource.name, this.formatSize(resource.size), this.formatSize(window.pollenConf.resourceMaxSize)), undefined, "error").then(() => false); diff --git a/pollen-ui-riot-js/src/main/web/js/UserService.js b/pollen-ui-riot-js/src/main/web/js/UserService.js index 45103037..10b9f78e 100644 --- a/pollen-ui-riot-js/src/main/web/js/UserService.js +++ b/pollen-ui-riot-js/src/main/web/js/UserService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class UserService extends FetchService { @@ -141,4 +141,4 @@ class UserService extends FetchService { } } -module.exports = singleton(UserService); +export default singleton(UserService); diff --git a/pollen-ui-riot-js/src/main/web/js/VoteCountingTypeService.js b/pollen-ui-riot-js/src/main/web/js/VoteCountingTypeService.js index 2bd90a00..2ed375aa 100644 --- a/pollen-ui-riot-js/src/main/web/js/VoteCountingTypeService.js +++ b/pollen-ui-riot-js/src/main/web/js/VoteCountingTypeService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class VoteCountingTypeService extends FetchService { @@ -43,4 +43,4 @@ class VoteCountingTypeService extends FetchService { } -module.exports = singleton(VoteCountingTypeService); +export default singleton(VoteCountingTypeService); diff --git a/pollen-ui-riot-js/src/main/web/js/VoteService.js b/pollen-ui-riot-js/src/main/web/js/VoteService.js index 05b155d7..f5a93374 100644 --- a/pollen-ui-riot-js/src/main/web/js/VoteService.js +++ b/pollen-ui-riot-js/src/main/web/js/VoteService.js @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; class VoteService extends FetchService { @@ -61,4 +61,4 @@ class VoteService extends FetchService { } } -module.exports = singleton(VoteService); +export default singleton(VoteService); diff --git a/pollen-ui-riot-js/src/main/web/js/VoterListService.js b/pollen-ui-riot-js/src/main/web/js/VoterListService.js index f233fbac..452bd878 100644 --- a/pollen-ui-riot-js/src/main/web/js/VoterListService.js +++ b/pollen-ui-riot-js/src/main/web/js/VoterListService.js @@ -18,10 +18,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let singleton = require("./Singleton"); -let FetchService = require("./FetchService"); -let values = require("object.values"); -let FavoriteListService = require("./FavoriteListService"); +import singleton from "./Singleton"; +import FetchService from "./FetchService"; +import values from "object.values"; +import FavoriteListService from "./FavoriteListService"; if (!Object.values) { values.shim(); } @@ -354,4 +354,4 @@ class VoterListService extends FetchService { } } -module.exports = singleton(VoterListService); +export default singleton(VoterListService); diff --git a/pollen-ui-riot-js/src/main/web/tag/Authorization.tag.html b/pollen-ui-riot-js/src/main/web/tag/Authorization.tag.html index e2f0ffcf..b5f17f33 100644 --- a/pollen-ui-riot-js/src/main/web/tag/Authorization.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/Authorization.tag.html @@ -8,12 +8,12 @@ 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% @@ -24,8 +24,9 @@ </div> <script type="es6"> - let session = require("../js/Session"); - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi + import session from "../js/Session"; + import route from "riot-route/lib/tag"; + this.authorized = false; this.routeArguments = []; diff --git a/pollen-ui-riot-js/src/main/web/tag/ContentLoader.tag.html b/pollen-ui-riot-js/src/main/web/tag/ContentLoader.tag.html index ad215974..078c083e 100644 --- a/pollen-ui-riot-js/src/main/web/tag/ContentLoader.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/ContentLoader.tag.html @@ -10,35 +10,38 @@ 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% */ + <ContentLoader> <div ref="container"> </div> <script type="es6"> + import session from "../js/Session"; + this.updateContent = () => { - let session = require("../js/Session"); let path = this.opts.path; if (typeof path === "function") { path = path(session.locale); } - fetch(path).then(response => { - return response.text(); - }) - .then(content => { - this.refs.container.innerHTML = content; - }); + fetch(path) + .then(response => { + return response.text(); + }) + .then(content => { + this.refs.container.innerHTML = content; + }); }; this.on("mount", this.updateContent); diff --git a/pollen-ui-riot-js/src/main/web/tag/FilterLoginProvider.tag.js b/pollen-ui-riot-js/src/main/web/tag/FilterLoginProvider.tag.js index 3c0ac46d..d878a6e4 100644 --- a/pollen-ui-riot-js/src/main/web/tag/FilterLoginProvider.tag.js +++ b/pollen-ui-riot-js/src/main/web/tag/FilterLoginProvider.tag.js @@ -18,10 +18,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let riot = require("riot"); -let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mis ; -let session = require("../js/Session"); -let userService = require("../js/UserService"); +import riot from "riot"; +import route from "riot-route/lib/tag"; +import session from "../js/Session"; +import userService from "../js/UserService"; riot.tag("filterloginProvider", false, function() { diff --git a/pollen-ui-riot-js/src/main/web/tag/HeaderI18n.tag.html b/pollen-ui-riot-js/src/main/web/tag/HeaderI18n.tag.html index ed3f289d..8016fac0 100644 --- a/pollen-ui-riot-js/src/main/web/tag/HeaderI18n.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/HeaderI18n.tag.html @@ -31,7 +31,7 @@ </div> <script type="es6"> - let session = require("../js/Session"); + import session from "../js/Session"; this.locale = session.locale; this.installBundle(session, "header_i18n"); this.toEnglish = () => { diff --git a/pollen-ui-riot-js/src/main/web/tag/PageChanged.tag.js b/pollen-ui-riot-js/src/main/web/tag/PageChanged.tag.js index 322536d3..21e26850 100644 --- a/pollen-ui-riot-js/src/main/web/tag/PageChanged.tag.js +++ b/pollen-ui-riot-js/src/main/web/tag/PageChanged.tag.js @@ -18,7 +18,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let riot = require("riot"); +import riot from "riot"; riot.tag("pagechanged", false, function(opts) { diff --git a/pollen-ui-riot-js/src/main/web/tag/Pagination.tag.html b/pollen-ui-riot-js/src/main/web/tag/Pagination.tag.html index 5ac7e2e6..a7eb23a2 100644 --- a/pollen-ui-riot-js/src/main/web/tag/Pagination.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/Pagination.tag.html @@ -8,12 +8,12 @@ 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% @@ -24,7 +24,7 @@ <div class="pagination-config"> <div class="o-form-element page-size"> <label class="c-label"> - {__.resultsPerPage} + {_t.resultsPerPage} </label> <select class="c-field u-small" ref="pageSize" @@ -79,8 +79,9 @@ </div> <script type="es6"> + import session from "../js/Session"; + this.nbMaxPagesToShow = 5; - let session = require("../js/Session"); this.installBundle(session, "pagination"); this.pagesToShow = [0]; @@ -101,7 +102,7 @@ {value: 20, label: "20"}, {value: 50, label: "50"}, {value: 100, label: "100"}, - {value: -1, label: this.__.all} + {value: -1, label: this._t.all} ]; this.updatePagesToShow = () => { diff --git a/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html b/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html index 65ea4ee9..00a8d44a 100644 --- a/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html @@ -251,7 +251,11 @@ require("./popup/GtuChangeModal.tag.html"); <PollenMessageManager/> <script type="es6"> - this.session = require("../js/Session"); + import session from "../js/Session"; + import route from "riot-route/lib/tag"; + import Message from "../js/Message"; + + this.session = session; this.installBundle(this.session, "main"); this.session.start(); @@ -271,9 +275,6 @@ require("./popup/GtuChangeModal.tag.html"); this.updatePageTitle(); }); - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; - let Message = require("../js/Message"); - this.on("mount", () => { this.listen("locale", this.onLocaleChange); this.listen("unauthorize", () => { diff --git a/pollen-ui-riot-js/src/main/web/tag/PollenFooter.tag.html b/pollen-ui-riot-js/src/main/web/tag/PollenFooter.tag.html index c19a22a8..4e9de260 100644 --- a/pollen-ui-riot-js/src/main/web/tag/PollenFooter.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/PollenFooter.tag.html @@ -23,20 +23,21 @@ <PollenFooter> <div class="links"> <a href="https://gitlab.nuiton.org/chorem/pollen">{_l("doc", version)}</a> - <a href="http://doc.pollen.cl">{__.documentation}</a> - <a href="https://gitlab.nuiton.org/chorem/pollen/tags">{__.download}</a> - <a href="http://list.chorem.org/cgi-bin/mailman/listinfo/pollen-users">{__.contact}</a> - <a href="https://gitlab.nuiton.org/chorem/pollen">{__.participate}</a> - <a href="http://www.gnu.org/licenses/agpl.html">{__.license}</a> - <a if={session.isGtu} href="{session.configuration.endPoint}/v1/gtu" target="_blank">{__.gtu}</a> + <a href="http://doc.pollen.cl">{_t.documentation}</a> + <a href="https://gitlab.nuiton.org/chorem/pollen/tags">{_t.download}</a> + <a href="http://list.chorem.org/cgi-bin/mailman/listinfo/pollen-users">{_t.contact}</a> + <a href="https://gitlab.nuiton.org/chorem/pollen">{_t.participate}</a> + <a href="http://www.gnu.org/licenses/agpl.html">{_t.license}</a> + <a if={session.isGtu} href="{session.configuration.endPoint}/v1/gtu" target="_blank">{_t.gtu}</a> <a href="http://www.codelutin.com/" target="_blank">Code Lutin</a> - <a href="#legalNotices">{__.legalNotices}</a> - <a if={session.configuration.piwikUrl} href="#privacy">{__.privacy}</a> + <a href="#legalNotices">{_t.legalNotices}</a> + <a if={session.configuration.piwikUrl} href="#privacy">{_t.privacy}</a> </div> <script type="es6"> - this.session = require("../js/Session"); - let resourceService = require("../js/ResourceService"); + import session from "../js/Session"; + + this.session = session; this.installBundle(this.session, "footer"); this.version = POLLEN_VERSION; diff --git a/pollen-ui-riot-js/src/main/web/tag/PollenHeader.tag.html b/pollen-ui-riot-js/src/main/web/tag/PollenHeader.tag.html index ef13bb51..00cd2fbb 100644 --- a/pollen-ui-riot-js/src/main/web/tag/PollenHeader.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/PollenHeader.tag.html @@ -20,9 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% */ -require("./HeaderI18n.tag.html"); -require("./popup/FeedbackModal.tag.html"); -require("./components/Avatar.tag.html"); +import "./HeaderI18n.tag.html"; +import "./popup/FeedbackModal.tag.html"; +import "./components/Avatar.tag.html"; <PollenHeader> <a class="header-home instance-title" href="#" target="_top"></a> @@ -31,26 +31,26 @@ require("./components/Avatar.tag.html"); <div if={canCreatePoll}> <a class="header-link header-link--info" href="#poll/new/text" - title="{__.newPoll}"> + title="{_t.newPoll}"> <i class="fa fa-plus"></i> - <span class="action-label">{__.newPoll}</span> + <span class="action-label">{_t.newPoll}</span> </a> </div> <a class="header-link header-link--support" href="https://{session.locale}.liberapay.com/pollen/donate"> <i class="fa fa-heart"></i> - <span class="action-label">{__.supportUs}</span> + <span class="action-label">{_t.supportUs}</span> </a> - + <div class="dropdown" if="{admin}"> <a class="header-link"> <i class="fa fa-wrench"/> </a> <div class="dropdown-content right"> - <a href="#users">{__.users}</a> - <a href="#polls">{__.polls}</a> - <a href="#gtus">{__.gtu}</a> - <a href="#loginProviders">{__.loginProviders}</a> + <a href="#users">{_t.users}</a> + <a href="#polls">{_t.polls}</a> + <a href="#gtus">{_t.gtu}</a> + <a href="#loginProviders">{_t.loginProviders}</a> </div> </div> @@ -60,25 +60,25 @@ require("./components/Avatar.tag.html"); <span class="user-name action-label"> {user && user.name}</span> </a> <div class="dropdown-content right"> - <a href="#user/profile">{__.myProfile}</a> - <a href="#polls/created">{__.myPolls}</a> - <a href="#polls/invited">{__.myInvitedPolls}</a> - <a href="#polls/participated">{__.myParticipatedPolls}</a> - <a href="#favoriteLists">{__.myFavoriteLists}</a> + <a href="#user/profile">{_t.myProfile}</a> + <a href="#polls/created">{_t.myPolls}</a> + <a href="#polls/invited">{_t.myInvitedPolls}</a> + <a href="#polls/participated">{_t.myParticipatedPolls}</a> + <a href="#favoriteLists">{_t.myFavoriteLists}</a> <span role="separator" class="divider"></span> - <a onclick="{signOut}">{__.signout}</a> + <a onclick="{signOut}">{_t.signout}</a> </div> </div> <div if="{!user}"> - <a class="header-link" onclick="{signIn}" title="{__.signin}"> - <i class="fa fa-sign-in" aria-hidden="true" /><span class="action-label">{__.signin}</span> + <a class="header-link" onclick="{signIn}" title="{_t.signin}"> + <i class="fa fa-sign-in" aria-hidden="true" /><span class="action-label">{_t.signin}</span> </a> </div> <HeaderI18n/> - <a class="header-link" onclick="{openFeedback}" title={__.feedback}> + <a class="header-link" onclick="{openFeedback}" title={_t.feedback}> <i class="fa fa-exclamation" aria-hidden="true"></i> <i class="fa fa-question" aria-hidden="true"></i> </a> @@ -88,8 +88,10 @@ require("./components/Avatar.tag.html"); </div> <script type="es6"> - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; - this.session = require("../js/Session"); + import route from "riot-route/lib/tag"; + import session from "../js/Session"; + + this.session = session; this.installBundle(this.session, "header"); diff --git a/pollen-ui-riot-js/src/main/web/tag/PollenMessageManager.tag.html b/pollen-ui-riot-js/src/main/web/tag/PollenMessageManager.tag.html index e90ebeed..4b08f9b7 100644 --- a/pollen-ui-riot-js/src/main/web/tag/PollenMessageManager.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/PollenMessageManager.tag.html @@ -8,12 +8,12 @@ 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% @@ -29,8 +29,9 @@ </div> <script type="es6"> - let Message = require("../js/Message"); - let session = require("../js/Session"); + import Message from "../js/Message"; + import session from "../js/Session"; + this.installBundle(session, "error_manager"); this.messageIndex = 0; diff --git a/pollen-ui-riot-js/src/main/web/tag/PollenWaiter.tag.html b/pollen-ui-riot-js/src/main/web/tag/PollenWaiter.tag.html index 1f1222cb..00a58c95 100644 --- a/pollen-ui-riot-js/src/main/web/tag/PollenWaiter.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/PollenWaiter.tag.html @@ -8,12 +8,12 @@ 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% @@ -21,7 +21,8 @@ <PollenWaiter> <script> - let NProgress = require("nprogress"); + import NProgress from "nprogress"; + NProgress.configure({parent: "#" + this.opts.parentId}); let inProgress = new Set(); diff --git a/pollen-ui-riot-js/src/main/web/tag/Privacy.tag.html b/pollen-ui-riot-js/src/main/web/tag/Privacy.tag.html index 25105629..fe4937e5 100644 --- a/pollen-ui-riot-js/src/main/web/tag/Privacy.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/Privacy.tag.html @@ -22,7 +22,7 @@ <div class="container" > - <h1>{__.title}</h1> + <h1>{_t.title}</h1> <div class="main-content"> <iframe class="piwik-privacy" @@ -33,7 +33,8 @@ </div> <script type="es6"> - this.session = require("../js/Session"); + import session from "../js/Session"; + this.session = session; this.installBundle(this.session, "privacy"); </script> diff --git a/pollen-ui-riot-js/src/main/web/tag/QrCode.tag.html b/pollen-ui-riot-js/src/main/web/tag/QrCode.tag.html index 9bc1f012..7a851aa9 100644 --- a/pollen-ui-riot-js/src/main/web/tag/QrCode.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/QrCode.tag.html @@ -8,12 +8,12 @@ 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% @@ -21,6 +21,8 @@ <QrCode> <script type="es6"> + import qrcode from "qrcode-generator/qrcode.js"; + let typeNumberByCorrectionLevel = { L: [17, 32, 53, 78, 106, 134, 154, 192, 230, 271, 321, 367, 425, 458, 520, 586, 644, 718, 792, 858, @@ -40,9 +42,6 @@ 790, 842, 898, 958, 983, 1051, 1093, 1139, 1219, 1273] }; - - let qrcode = require("qrcode-generator/qrcode.js"); - this.updateQrcode = () => { if (this.opts.riotValue !== this.qrvalue) { this.qrValue = this.opts.riotValue; diff --git a/pollen-ui-riot-js/src/main/web/tag/SignCheck.tag.html b/pollen-ui-riot-js/src/main/web/tag/SignCheck.tag.html index 14c08b78..f54f3d98 100644 --- a/pollen-ui-riot-js/src/main/web/tag/SignCheck.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/SignCheck.tag.html @@ -21,41 +21,42 @@ #L% */ <SignCheck> - <h1><i class="fa fa-user"/> {__.title}</h1> + <h1><i class="fa fa-user"/> {_t.title}</h1> <div class="container"> <div show={waiting}> - {__.validating} + {_t.validating} <i class="fa fa-cog fa-spin fa-fw"></i> </div> <div show={success} class="c-alert c-alert--success"> - {__.validation_success} - <span if="{!session.isConnected()}">{__.validation_signin}</span> + {_t.validation_success} + <span if="{!session.isConnected()}">{_t.validation_signin}</span> </div> <div show={error} class="c-alert c-alert--error"> - {__.validation_error} + {_t.validation_error} </div> <div class="actions"> <a show={success && !session.isConnected()} class="c-button c-button--info pull-right" onclick={signin}> <i class="fa fa-sign-in" aria-hidden="true"></i> - {__.signin} + {_t.signin} </a> <a show={error} class="c-button c-button--info pull-right" href="#signup/validate"> <i class="fa fa-paper-plane" aria-hidden="true"></i> - {__.resendValidation} + {_t.resendValidation} </a> </div> </div> <script type="es6"> - let authService = require("../js/AuthService"); - this.session = require("../js/Session"); - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; + import authService from "../js/AuthService"; + import session from "../js/Session"; + import route from "riot-route/lib/tag"; + this.session = session; this.installBundle(this.session, "signcheck"); this.waiting = true; this.error = false; diff --git a/pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html b/pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html index f0d4f1c9..476b534f 100644 --- a/pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html @@ -20,42 +20,42 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% */ -require("./popup/NewPassword.tag.html"); -require("./SignUp.tag.html"); -require("./components/HumanInput.tag.html"); +import "./popup/NewPassword.tag.html"; +import "./SignUp.tag.html"; +import "./components/HumanInput.tag.html"; <SignIn> <div class="body-container colors-default sign-in-layer" show={openSignIn}> <div class="body-content"> - <h1 class="c-heading"><i class="fa fa-sign-in"></i> {__.title}</h1> + <h1 class="c-heading"><i class="fa fa-sign-in"></i> {_t.title}</h1> <form class="signin"> <HumanInput onsubmit={signIn}/> <div class="o-form-element"> - <label class="c-label" for="login">{__.login}</label> + <label class="c-label" for="login">{_t.login}</label> <input class="c-field {c-field--error : message}" type="email" id="login" name="login" ref="login" required - placeholder={__.login_placeholder}/> + placeholder={_t.login_placeholder}/> </div> <div class="o-form-element"> - <label class="c-label" for="password">{__.password}</label> + <label class="c-label" for="password">{_t.password}</label> <input class="c-field {c-field--error : message}" type="password" id="password" name="password" ref="password" required - placeholder={__.password_placeholder}> + placeholder={_t.password_placeholder}> </div> <div class="o-form-element align-right"> - <p><button class="c-button c-button--info" type="submit"><i class="fa fa-sign-in"></i> {__.title}</button></p> + <p><button class="c-button c-button--info" type="submit"><i class="fa fa-sign-in"></i> {_t.title}</button></p> <div class="c-hint--static c-hint--error">{message}</div> - <p><a onclick="{newPassword}">{__.lostpassword}</a></p> + <p><a onclick="{newPassword}">{_t.lostpassword}</a></p> </div> <div class="o-form-element align-center" if="{loginProviders.length > 0}"> - <p>{__.signinWithProvider}</p> + <p>{_t.signinWithProvider}</p> <p> <a each="{loginProvider in loginProviders}" class="provider-link" onclick="{signinWithProvider(loginProvider)}"> @@ -76,14 +76,15 @@ require("./components/HumanInput.tag.html"); </div> <script type="es6"> - this.session = require("../js/Session"); - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; + import session from "../js/Session"; + import authService from "../js/AuthService"; + this.session = session; this.installBundle(this.session, "signin"); this.message = ""; this.openSignIn = false; - this.authService = require("../js/AuthService"); + this.authService = authService; this.loginProviders = []; this.listen("userNoMoreConnected", () => { diff --git a/pollen-ui-riot-js/src/main/web/tag/SignInAction.tag.js b/pollen-ui-riot-js/src/main/web/tag/SignInAction.tag.js index e34ca1a8..182a5705 100644 --- a/pollen-ui-riot-js/src/main/web/tag/SignInAction.tag.js +++ b/pollen-ui-riot-js/src/main/web/tag/SignInAction.tag.js @@ -18,9 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -let riot = require("riot"); -let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; -let session = require("../js/Session"); +import riot from "riot"; +import route from "riot-route/lib/tag"; // a voir pourquoi le default doit être mi ; riot.tag("signinaction", false, function() { 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 82e52539..d07893a5 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 @@ -20,23 +20,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% */ -let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; -require("./popup/ResendValidation.tag.html"); -require("./components/HumanInput.tag.html"); -require("./components/GtuValidation.tag.html"); +import "./popup/ResendValidation.tag.html"; +import "./components/HumanInput.tag.html"; +import "./components/GtuValidation.tag.html"; <SignUp class="body-content"> <div class="container"> - <h1 class="c-heading"><i class="fa fa-user-plus"/> {__.title}</h1> + <h1 class="c-heading"><i class="fa fa-user-plus"/> {_t.title}</h1> <form ref="user" class="signup"> <HumanInput onsubmit="{signUp}"/> <div class="o-form-element"> - <label class="c-label" for="name">{__.name}</label> + <label class="c-label" for="name">{_t.name}</label> <input class="c-field {c-field--error : errors.name}" type="text" name="name" ref="name" - placeholder="{__.name_placeholder}" + placeholder="{_t.name_placeholder}" required maxlength="255"> <div if="{errors.name}" @@ -46,12 +45,12 @@ require("./components/GtuValidation.tag.html"); </div> <div class="o-form-element"> - <label class="c-label" for="email">{__.email}</label> + <label class="c-label" for="email">{_t.email}</label> <input class="c-field {c-field--error : errors.email}" type="email" name="email" ref="email" - placeholder="{__.email_placeholder}" + placeholder="{_t.email_placeholder}" required maxlength="255"> <div if="{errors.email}" @@ -61,12 +60,12 @@ require("./components/GtuValidation.tag.html"); </div> <div class="o-form-element"> - <label class="c-label" for="password">{__.password}</label> + <label class="c-label" for="password">{_t.password}</label> <input class="c-field {c-field--error : errors.password}" type="password" name="password" ref="password" - placeholder="{__.password_placeholder}" + placeholder="{_t.password_placeholder}" onblur="{checkPassword}" required maxlength="255"> @@ -77,12 +76,12 @@ require("./components/GtuValidation.tag.html"); </div> <div class="o-form-element"> - <label class="c-label" for="email">{__.repeat_password}</label> + <label class="c-label" for="email">{_t.repeat_password}</label> <input class="c-field {c-field--error : errors.repeatPassword}" type="password" name="repeatPassword" ref="repeatPassword" - placeholder="{__.repeat_password_placeholder}" + placeholder="{_t.repeat_password_placeholder}" onblur="{checkPassword}" onkeypress="{clearPasswordError}" required @@ -95,13 +94,13 @@ require("./components/GtuValidation.tag.html"); <GtuValidation ref="gtuValidation"/> - <a class="resend-validation" onclick="{resendValidation}">{__.resendValidation}</a> + <a class="resend-validation" onclick="{resendValidation}">{_t.resendValidation}</a> <div class="actions-right"> <button type="submit" class="c-button c-button--info"> <i class="fa fa-user-plus" aria-hidden="true"></i> - {__.title} + {_t.title} </button> </div> </form> @@ -110,8 +109,8 @@ require("./components/GtuValidation.tag.html"); <ResendValidation ref="resendValidation"/> <script type="es6"> - let authService = require("../js/AuthService"); - let session = require("../js/Session"); + import authService from "../js/AuthService"; + import session from "../js/Session"; this.installBundle(session, "signup"); this.errors = {}; @@ -136,14 +135,15 @@ require("./components/GtuValidation.tag.html"); gtuValidated: this.refs.gtuValidation.value() }; - authService.signUp(user).then(() => { - this.info(this.__.createAccount_title, this.__.createAccount_message, this.__.createAccount_action); - this.update(); - }) - .catch((errors) => { - this.errors = errors; - this.update(); - }); + authService.signUp(user) + .then(() => { + this.info(this._t.createAccount_title, this._t.createAccount_message, this._t.createAccount_action); + this.update(); + }) + .catch((errors) => { + this.errors = errors; + this.update(); + }); } }; diff --git a/pollen-ui-riot-js/src/main/web/tag/UserProfile.tag.html b/pollen-ui-riot-js/src/main/web/tag/UserProfile.tag.html index bf1f75a7..f3be0161 100644 --- a/pollen-ui-riot-js/src/main/web/tag/UserProfile.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/UserProfile.tag.html @@ -18,14 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./components/HumanInput.tag.html"); -require("./components/Avatar.tag.html"); +import "./components/HumanInput.tag.html"; +import "./components/Avatar.tag.html"; <UserProfile> <div class="container"> <h1> - <span class="title"><i class="fa fa-user"/> {__.title}</span> - <button class="c-button c-button--error title-button" title="{__.deleteAccount}" onclick="{deleteAccount}"> + <span class="title"><i class="fa fa-user"/> {_t.title}</span> + <button class="c-button c-button--error title-button" title="{_t.deleteAccount}" onclick="{deleteAccount}"> <i class="fa fa-trash"/> </button> </h1> @@ -35,15 +35,15 @@ require("./components/Avatar.tag.html"); <div class="column-content"> <form ref="identity-form" class="identity-form"> <HumanInput onsubmit={submitIdentity}/> - <h3 class="c-heading"><i class="fa fa-address-card"/> {__.identity}</h3> + <h3 class="c-heading"><i class="fa fa-address-card"/> {_t.identity}</h3> <div class="o-form-element"> - <label class="c-label" for="name">{__.name}</label> + <label class="c-label" for="name">{_t.name}</label> <input class="c-field {c-field--error : errors.name}" type="text" name="name" ref="name" value={user.name} - placeholder="{__.name_placeholder}" + placeholder="{_t.name_placeholder}" required maxlength="255"> <div if="{errors.name}" @@ -55,7 +55,7 @@ require("./components/Avatar.tag.html"); <button type="submit" class="c-button c-button--info"> <i class="fa fa-check" aria-hidden="true"></i> - {__.saveIdentity} + {_t.saveIdentity} </button> </div> </form> @@ -65,14 +65,14 @@ require("./components/Avatar.tag.html"); <form ref="password-form" class="password-form column-content"> <HumanInput onsubmit={submitPassword}/> - <h3 class="c-heading"><i class="fa fa-key"/> {__.passwordChange}</h3> + <h3 class="c-heading"><i class="fa fa-key"/> {_t.passwordChange}</h3> <div class="o-form-element" if="{user.withPassword}"> - <label class="c-label" for="oldPassword">{__.oldPassword}</label> + <label class="c-label" for="oldPassword">{_t.oldPassword}</label> <input class="c-field {c-field--error : errors.oldPassword}" type="password" name="oldPassword" ref="oldPassword" - placeholder="{__.oldPassword_placeholder}" + placeholder="{_t.oldPassword_placeholder}" required maxlength="255"> <div if="{errors.oldPassword}" @@ -82,12 +82,12 @@ require("./components/Avatar.tag.html"); </div> <div class="o-form-element"> - <label class="c-label" for="newPassword">{__.newPassword}</label> + <label class="c-label" for="newPassword">{_t.newPassword}</label> <input class="c-field {c-field--error : errors.newPassword}" type="password" name="newPassword" ref="newPassword" - placeholder="{__.newPassword_placeholder}" + placeholder="{_t.newPassword_placeholder}" onblur="{checkNewPassword}" required maxlength="255"> @@ -98,12 +98,12 @@ require("./components/Avatar.tag.html"); </div> <div class="o-form-element"> - <label class="c-label" for="email">{__.repeatPassword}</label> + <label class="c-label" for="email">{_t.repeatPassword}</label> <input class="c-field {c-field--error : errors.repeatPassword}" type="password" name="repeatPassword" ref="repeatPassword" - placeholder="{__.repeatPassword_placeholder}" + placeholder="{_t.repeatPassword_placeholder}" onblur="{checkPassword}" onkeypress="{clearPasswordError}" required @@ -119,14 +119,14 @@ require("./components/Avatar.tag.html"); <button type="submit" class="c-button c-button--info"> <i class="fa fa-check" aria-hidden="true"></i> - {__.savePassword} + {_t.savePassword} </button> </div> </form> </div> <div class="row-content"> <div class="providers column-content"> - <h3 class="c-heading"><i class="fa fa-sign-in"/> {__.loginProviders}</h3> + <h3 class="c-heading"><i class="fa fa-sign-in"/> {_t.loginProviders}</h3> <div class="user-credentials"> <div each="{credential, index in user.credentials}" class="user-credential {index % 2 == 0 ? 'even' : 'odd'}"> <i if="{authService.providerIcons[credential.provider]}" @@ -139,7 +139,7 @@ require("./components/Avatar.tag.html"); </div> <div class="o-form-element align-center" if="{loginProviders.length > 0}"> - <p>{__.linkProvider}</p> + <p>{_t.linkProvider}</p> <p> <a each="{loginProvider in loginProviders}" class="provider-link" onclick="{linkProvider(loginProvider)}"> @@ -151,28 +151,28 @@ require("./components/Avatar.tag.html"); </div> <div class="avatar column-content"> - <h3 class="c-heading"><i class="fa fa-id-badge"/> {__.avatar}</h3> + <h3 class="c-heading"><i class="fa fa-id-badge"/> {_t.avatar}</h3> <div class="avatar-container"> <div class="avatar-column"> <Avatar class="user-avatar" avatar="{user.avatar}" name={user && user.name || ""} rounded="true"/> </div> <div class="form-column"> <div class="o-form-element"> - <label class="c-label" for="avatar">{__.uploadAvatar}</label> + <label class="c-label" for="avatar">{_t.uploadAvatar}</label> <input type="file" accept="image/*" class="c-field -field--label" ref="avatar" onchange={onAvatarChange} /> </div> <div class="actions-right"> <button if="{user.avatar}" onclick="{deleteAvatar}" - class="c-button c-button--error"><i class="fa fa-trash"></i> {__.deleteAvatar}</button> + class="c-button c-button--error"><i class="fa fa-trash"></i> {_t.deleteAvatar}</button> <button class="c-button c-button--info" onclick="{uploadAvatar}" - disabled="{!avatarFile}"><i class="fa fa-upload"></i> {__.uploadAvatar}</button> + disabled="{!avatarFile}"><i class="fa fa-upload"></i> {_t.uploadAvatar}</button> </div> </div> </div> <div class="align-center" if="{loginProviders.length > 0}"> - {__.getProviderAvatar} + {_t.getProviderAvatar} <div> <a each="{loginProvider in loginProviders}" class="provider-link" onclick="{getProviderAvatar(loginProvider)}"> @@ -189,23 +189,28 @@ require("./components/Avatar.tag.html"); </div> <script type="es6"> + import route from "riot-route/lib/tag"; + import session from "../js/Session"; + import userService from "../js/UserService"; + import authService from "../js/AuthService"; + import resourceService from "../js/ResourceService"; + import Message from "../js/Message"; + this.loaded = false; - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; - this.session = require("../js/Session"); + this.session = session; this.installBundle(this.session, "userProfile"); this.errors = {}; this.user = this.session.getUser() || {}; - let userService = require("../js/UserService"); - this.authService = require("../js/AuthService"); - this.resourceService = require("../js/ResourceService"); - let Message = require("../js/Message"); + this.authService = authService; + this.resourceService = resourceService; this.loginProviders = []; this.avatarFile = null; - this.authService.getActiveLoginProviders().then((result) => { - this.loginProviders = result; - this.update(); - }); + this.authService.getActiveLoginProviders() + .then((result) => { + this.loginProviders = result; + this.update(); + }); this.onUserChange = (user) => { this.user = user || {}; @@ -216,13 +221,14 @@ require("./components/Avatar.tag.html"); e.preventDefault(); e.stopPropagation(); this.user.name = this.refs.name.value; - userService.saveUser(this.user).then(() => { - this.session.updateUser(); - this.bus.trigger("message", new Message(this._l("updatedIdentity"), "success")); - }).catch((err) => { - this.errors.name = err.name; - this.update(); - }); + userService.saveUser(this.user) + .then(() => { + this.session.updateUser(); + this.bus.trigger("message", new Message(this._l("updatedIdentity"), "success")); + }).catch((err) => { + this.errors.name = err.name; + this.update(); + }); }; this.checkPassword = () => { @@ -246,20 +252,21 @@ require("./components/Avatar.tag.html"); if (this.errors.repeatPassword === undefined) { let oldPassword = this.user.withPassword ? this.refs.oldPassword.value : null; let newPassword = this.refs.newPassword.value; - userService.changePassword(oldPassword, newPassword).then(() => { - if (this.user.withPassword) { - this.refs.oldPassword.value = ""; - } - this.refs.newPassword.value = ""; - this.refs.repeatPassword.value = ""; - this.update(); - this.session.updateUser(); - this.bus.trigger("message", new Message(this._l("updatedPassword"), "success")); - }) - .catch((errors) => { - this.errors = errors; - this.update(); - }); + userService.changePassword(oldPassword, newPassword) + .then(() => { + if (this.user.withPassword) { + this.refs.oldPassword.value = ""; + } + this.refs.newPassword.value = ""; + this.refs.repeatPassword.value = ""; + this.update(); + this.session.updateUser(); + this.bus.trigger("message", new Message(this._l("updatedPassword"), "success")); + }) + .catch((errors) => { + this.errors = errors; + this.update(); + }); } }; @@ -272,7 +279,7 @@ require("./components/Avatar.tag.html"); }; this.unlinkProvider = (credentialId, index) => () => { - this.confirm(this.__.unlinkProviderMessage).then((confirm) => { + this.confirm(this._t.unlinkProviderMessage).then((confirm) => { if (!confirm) { return Promise.reject(); } @@ -292,7 +299,7 @@ require("./components/Avatar.tag.html"); }; this.deleteAvatar = () => { - this.confirm(this.__.deleteAvatarMessage).then((confirm) => { + this.confirm(this._t.deleteAvatarMessage).then((confirm) => { if (!confirm) { return Promise.reject(); } @@ -320,7 +327,7 @@ require("./components/Avatar.tag.html"); this.checkSize(this.avatarFile).then(ok => { if (!this.avatarFile.type.startsWith("image/")) { this.info( - this.__.fileNotImage_title, + this._t.fileNotImage_title, this._l("fileNotImage_message", this.avatarFile.name), undefined, "error"); @@ -335,7 +342,7 @@ require("./components/Avatar.tag.html"); }; this.deleteAccount = () => { - this.confirm(this.__.deleteUserMessage, null, null, 10).then((confirm) => { + this.confirm(this._t.deleteUserMessage, null, null, 10).then((confirm) => { if (confirm) { userService.deleteUser(this.user.id).then(() => { this.bus.trigger("user", null); diff --git a/pollen-ui-riot-js/src/main/web/tag/admin/GtuCard.tag.html b/pollen-ui-riot-js/src/main/web/tag/admin/GtuCard.tag.html index 9c692f6c..17801f50 100644 --- a/pollen-ui-riot-js/src/main/web/tag/admin/GtuCard.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/admin/GtuCard.tag.html @@ -8,12 +8,12 @@ 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% @@ -22,7 +22,7 @@ <div class="card-actions"> <a class="error" - title={__.delete} + title={_t.delete} onclick={deleteGtu}> <i class="fa fa-times"></i> </a> @@ -42,7 +42,7 @@ <div class="gtu-badges"> <span class="c-badge c-badge--rounded c-badge--success" if={opts.gtu.current}> - <i class="fa fa-cog"/> {__.current} + <i class="fa fa-cog"/> {_t.current} </span> </div> @@ -50,19 +50,21 @@ href="{session.configuration.endPoint}/v1/resources/{opts.gtu.id}/download" target="_blank"> <i class="fa fa-download"></i> - {__.download} + {_t.download} </a> </div> <script type="es6"> - this.session = require("../../js/Session"); - let resourceService = require("../../js/ResourceService"); + import session from "../../js/Session"; + import resourceService from "../../js/ResourceService"; + + this.session = session; this.installBundle(this.session, "gtu"); this.deleteGtu = (e) => { e.preventDefault(); e.stopPropagation(); - this.confirm(this.__.deleteGtu).then((confirm) => { + this.confirm(this._t.deleteGtu).then((confirm) => { if (confirm) { resourceService.delete(this.opts.gtu.id).then(() => { this.opts.onGtuChange(); diff --git a/pollen-ui-riot-js/src/main/web/tag/admin/Gtus.tag.html b/pollen-ui-riot-js/src/main/web/tag/admin/Gtus.tag.html index a311585a..ee3e5a88 100644 --- a/pollen-ui-riot-js/src/main/web/tag/admin/Gtus.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/admin/Gtus.tag.html @@ -8,24 +8,24 @@ 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% --> -require("./GtuCard.tag.html"); +import "./GtuCard.tag.html"; <Gtus> <div class="container" show="{loaded}"> - <h1>{__.title}</h1> + <h1>{_t.title}</h1> <div class="main-content"> <div class="c-alert c-alert--info"> - {count === 0 ? __.noGtu : (count + " " + (count === 1 ? __.one : __.many))} + {count === 0 ? _t.noGtu : (count + " " + (count === 1 ? _t.one : _t.many))} </div> <div class="elements"> @@ -40,7 +40,7 @@ require("./GtuCard.tag.html"); class="c-button c-button--success" onclick="{addGtu}"> <i class="fa fa-upload"/> - {__.add} + {_t.add} </button> <input type="file" @@ -55,12 +55,12 @@ require("./GtuCard.tag.html"); </div> <script type="es6"> + import resourceService from "../../js/ResourceService"; + import session from "../../js/Session"; + this.loaded = false; - let session = require("../../js/Session"); this.installBundle(session, "gtus"); - let resourceService = require("../../js/ResourceService"); - this.gtus = []; this.count = 0; this.refresh = () => { @@ -79,7 +79,7 @@ require("./GtuCard.tag.html"); this.onGtuInputChange = () => { let gtuFile = this.refs.choiceGtu.files[0]; if (gtuFile) { - this.confirm(this.__.addGtu, this.__.add, "success").then(confirm => { + this.confirm(this._t.addGtu, this._t.add, "success").then(confirm => { if (confirm) { resourceService.create(gtuFile, "GTU").then(() => { this.refresh(); diff --git a/pollen-ui-riot-js/src/main/web/tag/admin/LoginProviders.tag.html b/pollen-ui-riot-js/src/main/web/tag/admin/LoginProviders.tag.html index 26ec8533..ba12b893 100644 --- a/pollen-ui-riot-js/src/main/web/tag/admin/LoginProviders.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/admin/LoginProviders.tag.html @@ -18,22 +18,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../components/HumanInput.tag.html"); +import "../components/HumanInput.tag.html"; <LoginProviders> <div class="container" show="{loaded}"> - <h1>{__.title}</h1> + <h1>{_t.title}</h1> <div class="main-content"> <table> <thead> <tr> - <th>{__.name}*</th> - <th>{__.key}*</th> - <th>{__.secret}*</th> - <th>{__.permissions}</th> - <th>{__.active}</th> + <th>{_t.name}*</th> + <th>{_t.key}*</th> + <th>{_t.secret}*</th> + <th>{_t.permissions}</th> + <th>{_t.active}</th> </tr> </thead> <tbody> @@ -60,19 +60,19 @@ require("../components/HumanInput.tag.html"); </tbody> </table> - <button class="c-button" onclick="{addProvider}" disabled="{editingRow != null}"><i class="fa fa-plus"></i> {__.newProvider}</button> + <button class="c-button" onclick="{addProvider}" disabled="{editingRow != null}"><i class="fa fa-plus"></i> {_t.newProvider}</button> </div> </div> <script type="es6"> this.loaded = false; - let session = require("../../js/Session"); - let Message = require("../../js/Message"); + import session from "../../js/Session"; + import Message from "../../js/Message"; + import authService from "../../js/AuthService"; + this.installBundle(session, "loginProviders"); this.editingRow = null; - - let authService = require("../../js/AuthService"); this.loginProviders = []; this.availableLoginProviders = []; Promise.all([authService.getAllLoginProviders(), authService.getAvailableLoginProviders()]).then(results => { @@ -103,7 +103,7 @@ require("../components/HumanInput.tag.html"); e.preventDefault(); e.stopPropagation(); let loginProvider = this.loginProviders[index]; - this.confirm(this.__.deleteMessage) + this.confirm(this._t.deleteMessage) .then((confirm) => { if (!confirm) { return Promise.reject(); @@ -128,15 +128,15 @@ require("../components/HumanInput.tag.html"); let oldProvider = loginProvider.name; if (!this.refs["name" + index].value) { - this.bus.trigger("message", new Message(this.__.emptyName, "error")); + this.bus.trigger("message", new Message(this._t.emptyName, "error")); return; } if (!this.refs["key" + index].value) { - this.bus.trigger("message", new Message(this.__.emptyKey, "error")); + this.bus.trigger("message", new Message(this._t.emptyKey, "error")); return; } if (!this.refs["secret" + index].value) { - this.bus.trigger("message", new Message(this.__.emptySecret, "error")); + this.bus.trigger("message", new Message(this._t.emptySecret, "error")); return; } diff --git a/pollen-ui-riot-js/src/main/web/tag/admin/UserCard.tag.html b/pollen-ui-riot-js/src/main/web/tag/admin/UserCard.tag.html index de2ba90f..5cfe0510 100644 --- a/pollen-ui-riot-js/src/main/web/tag/admin/UserCard.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/admin/UserCard.tag.html @@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../components/Card.tag.html"); -require("./UserEditModal.tag.html"); +import "../components/Card.tag.html"; +import "./UserEditModal.tag.html"; <UserCard> <Card avatar={opts.user.avatar} @@ -31,28 +31,28 @@ require("./UserEditModal.tag.html"); <i if={parent.opts.user.premium} class="premium winner fa fa-star" aria-hidden="true" - title={parent.__.premiumTo + ' ' + parent.formatDate(parent.opts.user.premiumTo, 'LL')}> + title={parent._t.premiumTo + ' ' + parent.formatDate(parent.opts.user.premiumTo, 'LL')}> </i> <i if={!parent.opts.user.premium && parent.opts.user.premiumTo} class="premium fa fa-star-o" aria-hidden="true" - title={parent.__.premiumOf + ' ' + parent.formatDate(parent.opts.user.premiumTo, 'LL')}></i> + title={parent._t.premiumOf + ' ' + parent.formatDate(parent.opts.user.premiumTo, 'LL')}></i> <i if={parent.session.configurationServer.usersCanCreatePoll === "USERS_SELECTED" && parent.opts.user.canCreatePoll} class="poll-creator fa fa-plus success" aria-hidden="true" - title={parent.__.pollCreator}></i> + title={parent._t.pollCreator}></i> <div class="user-email" if="{parent.opts.user.defaultEmailAddress}"> - <i class="fa fa-refresh" if={!parent.opts.user.emailIsValidate} title={parent.__.emailValidate}></i> + <i class="fa fa-refresh" if={!parent.opts.user.emailIsValidate} title={parent._t.emailValidate}></i> {parent.opts.user.defaultEmailAddress.emailAddress} </div> <div class="user-badges"> <span class="c-badge c-badge--rounded c-badge--success" if={parent.opts.user.administrator}> - <i class="fa fa-cog"/> {parent.__.administrator} + <i class="fa fa-cog"/> {parent._t.administrator} </span> <span class="c-badge c-badge--rounded c-badge--error" if={parent.opts.user.banned}> - <i class="fa fa-ban"/> {parent.__.banned} + <i class="fa fa-ban"/> {parent._t.banned} </span> </div> </yield> @@ -69,14 +69,14 @@ require("./UserEditModal.tag.html"); class="c-button c-button--ghost-info" onclick={cancelEdition}> <i class="fa fa-undo" aria-hidden="true"></i> - {__.cancel} + {_t.cancel} </button> </div> <div class="actions-right"> <button type="submit" class="c-button c-button--info"> <i class="fa fa-check" aria-hidden="true"></i> - {__.save} + {_t.save} </button> </div> </div> @@ -84,9 +84,11 @@ require("./UserEditModal.tag.html"); </form> <script type="es6"> - this.session = require("../../js/Session"); + import session from "../../js/Session"; + import userService from "../../js/UserService"; + + this.session = session; this.installBundle(this.session, "user"); - let userService = require("../../js/UserService"); this.editing = false; this.errors = {}; @@ -112,7 +114,7 @@ require("./UserEditModal.tag.html"); }; this.delete = () => { - this.confirm(this.__.deleteUserMessage).then((confirm) => { + this.confirm(this._t.deleteUserMessage).then((confirm) => { if (confirm) { userService.deleteUser(this.opts.user.id).then(() => { this.opts.onUserChange(); diff --git a/pollen-ui-riot-js/src/main/web/tag/admin/UserEditModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/admin/UserEditModal.tag.html index 05a2109b..eae5510e 100644 --- a/pollen-ui-riot-js/src/main/web/tag/admin/UserEditModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/admin/UserEditModal.tag.html @@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../popup/Modal.tag.html"); -require("../components/UserEmailAddressList.tag.html"); +import "../popup/Modal.tag.html"; +import "../components/UserEmailAddressList.tag.html"; <UserEditModal> <Modal ref="modal" - header={__.edit} - label={__.save} + header={_t.edit} + label={_t.save} type="success" onsubmit={save}> <div class="modal-content"> @@ -34,11 +34,11 @@ require("../components/UserEmailAddressList.tag.html"); </div> <button if="{parent.opts.user.avatar}" onclick="{parent.deleteAvatar}" - class="c-button c-button--error"><i class="fa fa-trash"></i> {parent.__.deleteAvatar}</button> + class="c-button c-button--error"><i class="fa fa-trash"></i> {parent._t.deleteAvatar}</button> </div> <div class="column user-info"> <div class="o-form-element"> - <label class="c-label" for="name">{parent.__.name}</label> + <label class="c-label" for="name">{parent._t.name}</label> <input type="text" id="name" ref="name" @@ -47,7 +47,7 @@ require("../components/UserEmailAddressList.tag.html"); maxlength="255"> </div> <div class="o-form-element"> - <label class="c-label" for="premiumTo">{parent.__.premiumTo}</label> + <label class="c-label" for="premiumTo">{parent._t.premiumTo}</label> <date-picker class="o-field o-field--icon-left" inputclass="c-field o-field--icon-left" iconleftclass="calendar" @@ -59,7 +59,7 @@ require("../components/UserEmailAddressList.tag.html"); </div> <div class="o-form-element"> <label class="c-toggle c-toggle--info"> - {parent.__.administrator} + {parent._t.administrator} <input type="checkbox" id="administrator" ref="administrator" @@ -71,7 +71,7 @@ require("../components/UserEmailAddressList.tag.html"); </div> <div class="o-form-element"> <label class="c-toggle c-toggle--info"> - {parent.__.banned} + {parent._t.banned} <input type="checkbox" id="banned" ref="banned" @@ -84,7 +84,7 @@ require("../components/UserEmailAddressList.tag.html"); <div class="o-form-element" if={parent.pollCreatorEnable}> <label class="c-toggle c-toggle--info"> - {parent.__.pollCreator} + {parent._t.pollCreator} <input type="checkbox" id="canCreatePoll" ref="canCreatePoll" @@ -100,12 +100,12 @@ require("../components/UserEmailAddressList.tag.html"); </Modal> <script type="es6"> - let session = require("../../js/Session"); - let Message = require("../../js/Message"); + import session from "../../js/Session"; + import Message from "../../js/Message"; + import userService from "../../js/UserService"; + import moment from "moment-timezone"; + this.installBundle(session, "user"); - let userService = require("../../js/UserService"); - let authService = require("../../js/AuthService"); - let moment = require("moment-timezone"); this.errors = {}; this.premiumTo = {}; @@ -137,7 +137,7 @@ require("../components/UserEmailAddressList.tag.html"); }; this.deleteAvatar = () => { - this.confirm(this.__.deleteAvatarMessage).then((confirm) => { + this.confirm(this._t.deleteAvatarMessage).then((confirm) => { if (!confirm) { return Promise.reject(); } diff --git a/pollen-ui-riot-js/src/main/web/tag/admin/Users.tag.html b/pollen-ui-riot-js/src/main/web/tag/admin/Users.tag.html index 9951917a..c0e00a14 100644 --- a/pollen-ui-riot-js/src/main/web/tag/admin/Users.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/admin/Users.tag.html @@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../components/LazyLoad.tag.html"); -require("../components/LoadingCard.tag.html"); -require("../components/Search.tag.html"); -require("./UserCard.tag.html"); +import "../components/LazyLoad.tag.html"; +import "../components/LoadingCard.tag.html"; +import "../components/Search.tag.html"; +import "./UserCard.tag.html"; <Users> <div class="container" show="{loaded}"> - <h1>{__.title}</h1> + <h1>{_t.title}</h1> <div class="main-content"> <div class="c-alert c-alert--info"> @@ -47,8 +47,10 @@ require("./UserCard.tag.html"); </div> <script type="es6"> + import session from "../../js/Session"; + import userService from "../../js/UserService"; + this.loaded = false; - let session = require("../../js/Session"); this.installBundle(session, "users"); this.pagination = { @@ -61,8 +63,6 @@ require("./UserCard.tag.html"); this.count = 0; this.filteredCount = 0; - let userService = require("../../js/UserService"); - this.getCountLabel = () => { let label; if (this.count === 0) { diff --git a/pollen-ui-riot-js/src/main/web/tag/components/Avatar.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/Avatar.tag.html index 83299791..6eb151c3 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/Avatar.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/Avatar.tag.html @@ -8,17 +8,17 @@ 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% --> -require("./LetterAvatar.tag.html"); +import "./LetterAvatar.tag.html"; <Avatar> <LetterAvatar class="avatar-letter" name={opts.name} rounded={opts.rounded} if={!opts.avatar} /> @@ -28,9 +28,12 @@ require("./LetterAvatar.tag.html"); </img> <script> - this.session = require("../../js/Session"); + import session from "../../js/Session"; + import resourceService from "../../js/ResourceService"; + + this.session = session; this.installBundle(this.session, "avatar"); - this.resourceService = require("../../js/ResourceService"); + this.resourceService = resourceService; this.avatarLoaded = false; </script> diff --git a/pollen-ui-riot-js/src/main/web/tag/components/Card.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/Card.tag.html index bad435f3..890b7932 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/Card.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/Card.tag.html @@ -18,18 +18,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./Avatar.tag.html"); +import "./Avatar.tag.html"; <Card> <div class="card-actions"> <a class="info" - title={parent.__.edit} + title={parent._t.edit} onclick={opts.onedit}> <i class="fa fa-pencil"></i> </a> <yield from="actions"/> <a class="error" - title={parent.__.delete} + title={parent._t.delete} onclick={opts.ondelete}> <i class="fa fa-times"></i> </a> diff --git a/pollen-ui-riot-js/src/main/web/tag/components/Checkbox.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/Checkbox.tag.html index c6cb6cc5..7b5e49b0 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/Checkbox.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/Checkbox.tag.html @@ -8,12 +8,12 @@ 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% @@ -37,10 +37,11 @@ </label> <script> + import session from "../../js/Session"; this.checked = this.opts.checkboxchecked; + this.session = session; if (this.opts.i18nprefix) { - this.session = require("../../js/Session"); this.installBundle(this.session, this.opts.i18nprefix); } diff --git a/pollen-ui-riot-js/src/main/web/tag/components/GtuValidation.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/GtuValidation.tag.html index e5bae6f2..0d324ed2 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/GtuValidation.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/GtuValidation.tag.html @@ -8,12 +8,12 @@ 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% @@ -25,18 +25,20 @@ ref="validationCheckbox" required onclick={validationClick}> - {__.before} + {_t.before} <a class="c-link" href="{session.configuration.endPoint}/v1/gtu" target="_blank"> - {__.link} + {_t.link} </a> - {__.after} + {_t.after} </label> </div> <script type="es6"> - this.session = require("../../js/Session"); + import session from "../../js/Session"; + + this.session = session; this.installBundle(this.session, "gtu_validation"); this.value = () => { diff --git a/pollen-ui-riot-js/src/main/web/tag/components/Search.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/Search.tag.html index 910d3d0c..571e7a06 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/Search.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/Search.tag.html @@ -8,12 +8,12 @@ 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% @@ -27,7 +27,7 @@ name="search" ref="search" oninput={search} - placeholder={__.label} + placeholder={_t.label} type="text"> <i class="fa fa-fw fa-times c-icon" if={refs && refs.search.value} @@ -36,8 +36,8 @@ </div> <script type="es6"> - - let session = require("../../js/Session"); + import session from "../../js/Session"; + this.installBundle(session, "search"); this.search = () => { diff --git a/pollen-ui-riot-js/src/main/web/tag/components/UserEmailAddressList.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/UserEmailAddressList.tag.html index 60fc3814..03a9adc1 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/UserEmailAddressList.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/UserEmailAddressList.tag.html @@ -8,18 +8,18 @@ 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% --> <UserEmailAddressList> - <h3 class="c-heading"><i class="fa fa-at"/> {__.emailAddresses}</h3> + <h3 class="c-heading"><i class="fa fa-at"/> {_t.emailAddresses}</h3> <div each="{emailAddress, index in opts.user.emailAddresses}" class="email-address {index % 2 == 0 ? 'even' : 'odd'}"> <span class="email-address-label {validation-pending : !emailAddress.validated} {default-address : parent.opts.user.defaultEmailAddress.id === emailAddress.id}"> {emailAddress.emailAddress} @@ -27,26 +27,26 @@ <button type="button" class="c-button u-small" if={!emailAddress.validated} - title="{parent.__.resendValidation}" + title="{parent._t.resendValidation}" onclick={parent.resendValidation(emailAddress.emailAddress)}> <i class="fa fa-paper-plane" aria-hidden="true"></i> </button> <button type="button" class="c-button u-small c-button--success" if={!emailAddress.validated && parent.opts.admin} - title="{parent.__.validate}" + title="{parent._t.validate}" onclick={validate(emailAddress.id, index)}> <i class="fa fa-check" aria-hidden="true"></i> </button> <button if="{parent.opts.user.defaultEmailAddress.id !== emailAddress.id && emailAddress.validated}" type="button" class="c-button u-small c-button--info" - title="{parent.__.defaultEmailAddress}" + title="{parent._t.defaultEmailAddress}" onclick="{parent.setDefaultEmailAddress(emailAddress.id, index)}"> <i class="fa fa-envelope"></i> </button> <button disabled="{parent.opts.user.defaultEmailAddress.id === emailAddress.id}" type="button" class="c-button u-small c-button--error" - title="{parent.__.deleteEmailAddress}" + title="{parent._t.deleteEmailAddress}" onclick="{parent.deleteEmailAddress(emailAddress.id, index)}"> <i class="fa fa-trash"></i> </button> @@ -58,10 +58,10 @@ type="email" name="email" ref="newEmailAddress" - placeholder="{__.newAddressPlaceholder}"> + placeholder="{_t.newAddressPlaceholder}"> </div> <button type="button" class="c-button c-button--success" - title="{__.addEmailAddress}" + title="{_t.addEmailAddress}" onclick="{submitEmailAddress}"> <i class="fa fa-plus" aria-hidden="true"></i> </button> @@ -73,11 +73,12 @@ </div> <script> - let session = require("../../js/Session"); - let Message = require("../../js/Message"); + import session from "../../js/Session"; + import Message from "../../js/Message"; + import userService from "../../js/UserService"; + import authService from "../../js/AuthService"; + this.installBundle(session, "emailAddressList"); - let userService = require("../../js/UserService"); - let authService = require("../../js/AuthService"); this.errors = {}; diff --git a/pollen-ui-riot-js/src/main/web/tag/components/date-picker.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/date-picker.tag.html index a0f93916..8bcffc5c 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/date-picker.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/date-picker.tag.html @@ -8,12 +8,12 @@ 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% @@ -25,7 +25,7 @@ required={opts.required} onclick="{open}" value={opts.date.date ? opts.date.date.format(session.dateInputSupported ? "YYYY-MM-DD" : format) : undefined} - placeholder="{__.dateplaceholder}" + placeholder="{_t.dateplaceholder}" readonly="{!session.dateInputSupported}" disabled={opts.disabled} onchange={onDateChange} @@ -51,14 +51,16 @@ <button type="button" class="c-calendar__date c-calendar__date--in-month { 'c-calendar__date--selected': day.selected, 'c-calendar__date--today': day.today }" disabled="{ day.disabled }" each="{ day in days }" onclick="{ select }">{ day.date.format(dayFormat) }</button> <button type="button" class="c-calendar__date { 'c-calendar__date--selected': day.selected, 'c-calendar__date--today': day.today }" disabled="{ day.disabled }" each="{ day in endBuffer }" onclick="{ select }">{ day.date.format(dayFormat) }</button> - <button type="button" class="c-button c-button--block c-button--primary" disabled="{ opts.date.min && opts.date.min.isAfter(moment(), "day") || opts.date.max && opts.date.max.isBefore(moment(), "day") }" onclick="{ setToday }">{__.today}</button> + <button type="button" class="c-button c-button--block c-button--primary" disabled="{ opts.date.min && opts.date.min.isAfter(moment(), "day") || opts.date.max && opts.date.max.isBefore(moment(), "day") }" onclick="{ setToday }">{_t.today}</button> </div> <script type="es6"> + import session from "../../js/Session"; + import moment from "moment-timezone"; - this.session = require("../../js/Session"); + this.session = session; this.format = "LL"; - this.moment = require("moment-timezone"); + this.moment = moment; this.moment.locale(this.session.locale); this.installBundle(this.session, "date-picker", locale => { diff --git a/pollen-ui-riot-js/src/main/web/tag/components/date-time-picker.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/date-time-picker.tag.html index 2fedb988..b7f13bb2 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/date-time-picker.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/date-time-picker.tag.html @@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./date-picker.tag.html"); -require("./time-picker.tag.html"); +import "./date-picker.tag.html"; +import "./time-picker.tag.html"; <date-time-picker> <div if={!session.dateTimeInputSupported} class="c-input-group date-time-field"> @@ -58,8 +58,10 @@ require("./time-picker.tag.html"); /> <script type="es6"> - this.session = require("../../js/Session"); - let moment = require("moment-timezone"); + import session from "../../js/Session"; + import moment from "moment-timezone"; + + this.session = session; moment.locale(this.session.locale); this.date = {date: this.opts.datetime ? moment(this.opts.datetime) : undefined}; this.time = {time: this.opts.datetime ? moment(this.opts.datetime) : undefined}; diff --git a/pollen-ui-riot-js/src/main/web/tag/components/time-picker.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/time-picker.tag.html index e683caa2..20d5d2f2 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/time-picker.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/time-picker.tag.html @@ -24,7 +24,7 @@ type="time" class="calendar-field {opts.inputclass}" value="{opts.time.time ? opts.time.time.format('LT') : undefined}" - placeholder="{__.timeplaceholder}" + placeholder="{_t.timeplaceholder}" disabled={opts.disabled} required={opts.required} onblur={onTimeChange}/> @@ -52,8 +52,11 @@ </div> <script type="es6"> - this.session = require("../../js/Session"); - this.moment = require("moment"); + import session from "../../js/Session"; + import moment from "moment"; + + this.session = session; + this.moment = moment; this.moment.locale(this.session.locale); this.installBundle(this.session, "time-picker", locale => { diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/ChildListCard.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/ChildListCard.tag.html index 8bf25dec..29e4b557 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/ChildListCard.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/ChildListCard.tag.html @@ -8,18 +8,18 @@ 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% --> -require("../components/Card.tag.html"); -require("./ChildListEditModal.tag.html"); +import "../components/Card.tag.html"; +import "./ChildListEditModal.tag.html"; <ChildListCard> @@ -44,9 +44,10 @@ require("./ChildListEditModal.tag.html"); favorite-list={opts.favoriteList}/> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import favoriteListService from "../../js/FavoriteListService"; + this.installBundle(session, "favoriteList_childList"); - let favoriteListService = require("../../js/FavoriteListService"); this.edit = () => { this.refs.editModal.open().then(() => { @@ -62,7 +63,7 @@ require("./ChildListEditModal.tag.html"); }; this.delete = () => { - this.confirm(this.__.deleteMessage).then((confirm) => { + this.confirm(this._t.deleteMessage).then((confirm) => { if (confirm) { favoriteListService.deleteChildList(this.opts.favoriteList.id, this.opts.childList.id).then(() => { if (this.opts.onChildListChange) { diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/ChildListEditModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/ChildListEditModal.tag.html index ae547b75..ad8fa2c8 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/ChildListEditModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/ChildListEditModal.tag.html @@ -8,30 +8,30 @@ 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% --> -require("../popup/Modal.tag.html"); +import "../popup/Modal.tag.html"; <ChildListEditModal> <Modal ref="modal" - header={opts.childList.id ? __.edit : __.new} - label={opts.childList.id ? __.save : __.add} + header={opts.childList.id ? _t.edit : _t.new} + label={opts.childList.id ? _t.save : _t.add} type="success" onsubmit={save}> <div class="o-form-element"> - <label class="c-label" for="childList">{parent.__.child}</label> + <label class="c-label" for="childList">{parent._t.child}</label> <select if={!parent.opts.childList.id} id="childList" ref="childList" - placeholder={parent.__.member_name_placeholder} + placeholder={parent._t.member_name_placeholder} required disabled={parent.opts.childList.id} class="c-field {c-field--error : parent.errors.child}"> @@ -46,7 +46,7 @@ require("../popup/Modal.tag.html"); disabled> </div> <div class="o-form-element"> - <label class="c-label" for="childListWeight">{parent.__.weight}</label> + <label class="c-label" for="childListWeight">{parent._t.weight}</label> <input type="number" id="childListWeight" ref="childListWeight" @@ -58,10 +58,11 @@ require("../popup/Modal.tag.html"); </Modal> <script type="es6"> - let session = require("../../js/Session"); - let Message = require("../../js/Message"); + import session from "../../js/Session"; + import Message from "../../js/Message"; + import favoriteListService from "../../js/FavoriteListService"; + this.installBundle(session, "favoriteList_childList"); - let favoriteListService = require("../../js/FavoriteListService"); this.favoriteLists = []; diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html index 06c44ee8..51c80413 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html @@ -18,14 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./MemberCard.tag.html"); -require("./ChildListCard.tag.html"); -require("./MemberEditModal.tag.html"); -require("./ImportCsvModal.tag.html"); -require("./ImportLdapModal.tag.html"); -require("./ChildListEditModal.tag.html"); -require("../components/LazyLoad.tag.html"); -require("../components/LoadingCard.tag.html"); +import "./MemberCard.tag.html"; +import "./ChildListCard.tag.html"; +import "./MemberEditModal.tag.html"; +import "./ImportCsvModal.tag.html"; +import "./ImportLdapModal.tag.html"; +import "./ChildListEditModal.tag.html"; +import "../components/LazyLoad.tag.html"; +import "../components/LoadingCard.tag.html"; <FavoriteList> <div class="container" > @@ -33,7 +33,7 @@ require("../components/LoadingCard.tag.html"); <h1> <a class="c-link" href="#favoriteLists"> - {__.title} / + {_t.title} / </a> {favoriteList.name} </h1> @@ -59,16 +59,16 @@ require("../components/LoadingCard.tag.html"); <ContextualMenu> <a onclick={parent.addMember} > - {parent.__.member_new} + {parent._t.member_new} </a> <a onclick={parent.importCsv} > - {parent.__.member_importCsv} + {parent._t.member_importCsv} </a> <a onclick={parent.importLdap} > - {parent.__.member_importLdap} + {parent._t.member_importLdap} </a> <a onclick={parent.createChildList} > - {parent.__.childList_new} + {parent._t.childList_new} </a> </ContextualMenu> @@ -88,10 +88,10 @@ require("../components/LoadingCard.tag.html"); </div> <script type="es6"> - let session = require("../../js/Session"); - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; + import session from "../../js/Session"; + import favoriteListService from "../../js/FavoriteListService"; + this.installBundle(session, "favoriteList"); - let favoriteListService = require("../../js/FavoriteListService"); this.pagination = { order: "name", desc: false, diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteListCard.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteListCard.tag.html index 7998a406..5ef19c13 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteListCard.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteListCard.tag.html @@ -8,18 +8,18 @@ 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% --> -require("../components/Card.tag.html"); -require("./FavoriteListEditModal.tag.html"); +import "../components/Card.tag.html"; +import "./FavoriteListEditModal.tag.html"; <FavoriteListCard> <Card name={opts.favoriteList.name} @@ -42,9 +42,10 @@ require("./FavoriteListEditModal.tag.html"); <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import favoriteListService from "../../js/FavoriteListService"; + this.installBundle(session, "favoriteList"); - let favoriteListService = require("../../js/FavoriteListService"); this.edit = () => { this.refs.editModal.open().then(() => { @@ -58,7 +59,7 @@ require("./FavoriteListEditModal.tag.html"); }; this.delete = () => { - this.confirm(this.__.deleteMessage).then((confirm) => { + this.confirm(this._t.deleteMessage).then((confirm) => { if (confirm) { favoriteListService.deleteFavoriteList(this.opts.favoriteList.id).then(() => { if (this.opts.onFavoriteListChange) { diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteListEditModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteListEditModal.tag.html index 0f228fb8..be740a45 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteListEditModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteListEditModal.tag.html @@ -18,32 +18,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../popup/Modal.tag.html"); +import "../popup/Modal.tag.html"; <FavoriteListEditModal> <Modal ref="modal" - header={opts.favoriteList.id ? __.edit : __.new} - label={__.save} + header={opts.favoriteList.id ? _t.edit : _t.new} + label={_t.save} type="success" onsubmit={save}> <div class="o-form-element"> - <label class="c-label" for="name">{parent.__.name}</label> + <label class="c-label" for="name">{parent._t.name}</label> <input type="text" id="name" ref="name" class="c-field" - placeholder={parent.__.name_placeholder} + placeholder={parent._t.name_placeholder} value={parent.opts.favoriteList.name} maxlength="255"> </div> </Modal> <script type="es6"> - let session = require("../../js/Session"); - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; - let Message = require("../../js/Message"); + import session from "../../js/Session"; + import route from "riot-route/lib/tag"; + import Message from "../../js/Message"; + import favoriteListService from "../../js/FavoriteListService"; + this.installBundle(session, "favoriteList"); - let favoriteListService = require("../../js/FavoriteListService"); if (!this.opts.favoriteList) { this.opts.favoriteList = {}; diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteLists.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteLists.tag.html index b32b4102..db929f3d 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteLists.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteLists.tag.html @@ -18,18 +18,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../components/Search.tag.html"); -require("../components/ContextualMenu.tag.html"); -require("../components/LazyLoad.tag.html"); -require("../components/LoadingCard.tag.html"); -require("./FavoriteListCard.tag.html"); -require("./FavoriteListEditModal.tag.html"); +import "../components/Search.tag.html"; +import "../components/ContextualMenu.tag.html"; +import "../components/LazyLoad.tag.html"; +import "../components/LoadingCard.tag.html"; +import "./FavoriteListCard.tag.html"; +import "./FavoriteListEditModal.tag.html"; <FavoriteLists> <div class="container" > <div show="{loaded}"> - <h1>{__.title}</h1> + <h1>{_t.title}</h1> <div class="main-content"> <div class="c-alert c-alert--info"> @@ -38,7 +38,7 @@ require("./FavoriteListEditModal.tag.html"); if={count > 0} href="{session.configuration.endPoint}/v1/favoriteLists/exports" target="_blank" - title={__.export}> + title={_t.export}> <i class="fa fa-download"></i> </a> </div> @@ -58,24 +58,24 @@ require("./FavoriteListEditModal.tag.html"); <ContextualMenu> <a onclick={parent.addFavoriteList}> - {parent.__.addFavoriteList} + {parent._t.addFavoriteList} </a> <a onclick={parent.openImportModal} > - {parent.__.importFavoriteLists} + {parent._t.importFavoriteLists} </a> </ContextualMenu> </div> - <Modal ref="importModal" onsubmit={import} header={__.importFavoriteLists} label={__.import} type="success"> + <Modal ref="importModal" onsubmit={import} header={_t.importFavoriteLists} label={_t.import} type="success"> <div class="o-form-element"> - <label class="c-label" for="importFile">{parent.__.import_file}</label> + <label class="c-label" for="importFile">{parent._t.import_file}</label> <input type="file" id="importFile" ref="importFile" required class="c-field {c-field--error : parent.importErrors.error}"> <div class="exemple"> - {parent.__.import_file_detail} + {parent._t.import_file_detail} </div> </div> </Modal> @@ -85,9 +85,11 @@ require("./FavoriteListEditModal.tag.html"); </div> <script type="es6"> + import session from "../../js/Session"; + import favoriteListService from "../../js/FavoriteListService"; + this.loaded = false; - this.session = require("../../js/Session"); - let favoriteListService = require("../../js/FavoriteListService"); + this.session = session; this.installBundle(this.session, "favoriteList"); this.pagination = { diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/ImportCsvModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/ImportCsvModal.tag.html index 92a41fe8..69d27c69 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/ImportCsvModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/ImportCsvModal.tag.html @@ -18,34 +18,34 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../popup/Modal.tag.html"); +import "../popup/Modal.tag.html"; <ImportCsvModal> <Modal ref="modal" - header={__.member_importCsv} - label={__.member_import} + header={_t.member_importCsv} + label={_t.member_import} type="success" onsubmit={importCsv}> <div class="o-form-element"> - <label class="c-label" for="csvFile">{parent.__.member_csvFile}</label> + <label class="c-label" for="csvFile">{parent._t.member_csvFile}</label> <input type="file" id="csvFile" ref="csvFile" required class="c-field {c-field--error : parent.errors.error}"> <div class="exemple"> - {parent.__.member_csvFile_exemple_label} - <code class="c-code c-code--multiline">{parent.__.member_csvFile_exemple}</code> - {parent.__.member_csvFile_exemple_detail} + {parent._t.member_csvFile_exemple_label} + <code class="c-code c-code--multiline">{parent._t.member_csvFile_exemple}</code> + {parent._t.member_csvFile_exemple_detail} </div> </div> </Modal> <script type="es6"> - let session = require("../../js/Session"); - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; + import session from "../../js/Session"; + import favoriteListService from "../../js/FavoriteListService"; + this.installBundle(session, "favoriteList"); - let favoriteListService = require("../../js/FavoriteListService"); this.errors = {}; diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/ImportLdapModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/ImportLdapModal.tag.html index 89cd8618..8e786661 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/ImportLdapModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/ImportLdapModal.tag.html @@ -18,36 +18,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../popup/Modal.tag.html"); +import "../popup/Modal.tag.html"; <ImportLdapModal> <Modal ref="modal" - header={__.member_importLdap} - label={__.member_import} + header={_t.member_importLdap} + label={_t.member_import} type="success" onsubmit={importLdap}> <div class="o-form-element"> - <label class="c-label" for="ldapUrl">{parent.__.member_ldap}</label> + <label class="c-label" for="ldapUrl">{parent._t.member_ldap}</label> <input type="text" id="ldapUrl" ref="ldapUrl" required - placeholder={parent.__.member_ldap_placeholder} + placeholder={parent._t.member_ldap_placeholder} class="c-field {c-field--error :parent.errors.error}"> <div class="exemple"> - {parent.__.member_ldap_exemple_label} - <code class="c-code c-code--multiline">{parent.__.member_ldap_exemple}</code> - {parent.__.member_ldap_exemple_detail} + {parent._t.member_ldap_exemple_label} + <code class="c-code c-code--multiline">{parent._t.member_ldap_exemple}</code> + {parent._t.member_ldap_exemple_detail} </div> </div> </Modal> <script type="es6"> - let session = require("../../js/Session"); - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; + import session from "../../js/Session"; + import favoriteListService from "../../js/FavoriteListService"; + this.installBundle(session, "favoriteList"); - let favoriteListService = require("../../js/FavoriteListService"); this.errors = {}; diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/MemberCard.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/MemberCard.tag.html index ab1b868d..ec2a1c43 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/MemberCard.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/MemberCard.tag.html @@ -8,18 +8,18 @@ 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% --> -require("../components/Card.tag.html"); -require("./MemberEditModal.tag.html"); +import "../components/Card.tag.html"; +import "./MemberEditModal.tag.html"; <MemberCard> <Card name={opts.member.name} @@ -39,9 +39,10 @@ require("./MemberEditModal.tag.html"); member={opts.member}/> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import favoriteListService from "../../js/FavoriteListService"; + this.installBundle(session, "favoriteList_member"); - let favoriteListService = require("../../js/FavoriteListService"); this.edit = () => { this.refs.editModal.open().then(() => { @@ -55,7 +56,7 @@ require("./MemberEditModal.tag.html"); }; this.delete = () => { - this.confirm(this.__.deleteMessage).then((confirm) => { + this.confirm(this._t.deleteMessage).then((confirm) => { if (confirm) { favoriteListService.deleteMember(this.opts.favoriteList.id, this.opts.member.id).then(() => { if (this.opts.onMemberChange) { diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/MemberEditModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/MemberEditModal.tag.html index 9eb287ec..655f1165 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/MemberEditModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/MemberEditModal.tag.html @@ -8,49 +8,49 @@ 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% --> -require("../popup/Modal.tag.html"); +import "../popup/Modal.tag.html"; <MemberEditModal> <Modal ref="modal" - header={opts.member.id ? __.edit : __.new} - label={__.save} + header={opts.member.id ? _t.edit : _t.new} + label={_t.save} type="success" onsubmit={save}> <div class="o-form-element"> - <label class="c-label" for="name">{parent.__.name}</label> + <label class="c-label" for="name">{parent._t.name}</label> <input type="text" id="name" ref="name" required class="c-field" - placeholder={parent.__.name_placeholder} + placeholder={parent._t.name_placeholder} value={parent.opts.member.name} maxlength="255"> </div> <div class="o-form-element"> - <label class="c-label" for="name">{parent.__.email}</label> + <label class="c-label" for="name">{parent._t.email}</label> <input type="email" id="email" ref="email" required class="c-field {c-field--error: parent.errors.email}" - placeholder={parent.__.email_placeholder} + placeholder={parent._t.email_placeholder} value={parent.opts.member.email} maxlength="255"> <div class="c-hint c-hint--static c-hint--error" each={error in parent.errors.email}>{error}</div> </div> <div class="o-form-element"> - <label class="c-label" for="email">{parent.__.weight}</label> + <label class="c-label" for="email">{parent._t.weight}</label> <input type="number" id="weight" ref="weight" @@ -62,10 +62,9 @@ require("../popup/Modal.tag.html"); </Modal> <script type="es6"> - let session = require("../../js/Session"); - let Message = require("../../js/Message"); + import session from "../../js/Session"; + import favoriteListService from "../../js/FavoriteListService"; this.installBundle(session, "favoriteList_member"); - let favoriteListService = require("../../js/FavoriteListService"); if (!this.opts.member) { this.opts.member = {}; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/CheckEmails.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/CheckEmails.tag.html index f73aa843..eeaa400e 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/CheckEmails.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/CheckEmails.tag.html @@ -8,12 +8,12 @@ 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% @@ -21,18 +21,20 @@ <CheckEmails> <div show={invalidEmails.length} class="c-alert c-alert--warning"> - {__.message_before} + {_t.message_before} <ul class="emails"> <li each={email in invalidEmails}>{email}</li> </ul> - {__.message_after} + {_t.message_after} </div> <script type="es6"> - this.session = require("../../js/Session"); - this.installBundle(this.session, "poll_invalidEmails"); + import session from "../../js/Session"; + import poll from "../../js/Poll.js"; - this.poll = require("../../js/Poll.js"); + this.session = session; + this.installBundle(this.session, "poll_invalidEmails"); + this.poll = poll; this.choiceToAdd = this.poll.initChoice(); this.invalidEmails = []; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html index 86ab407d..95953e74 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html @@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../components/date-picker.tag.html"); -require("../components/time-picker.tag.html"); +import "../components/date-picker.tag.html"; +import "../components/time-picker.tag.html"; <Choice> <div class="choice-container"> <button type="button" @@ -27,20 +27,20 @@ require("../components/time-picker.tag.html"); alt="texte" disabled={opts.disabled} onclick="{setTextType}" - title="{__.text}"> + title="{_t.text}"> <i class="fa fa-pencil" aria-hidden="true"></i> </button> <input type="text" ref="choiceText" tabindex="1" class={opts.choice.choiceType === 'TEXT' ? 'selected' : 'hidden'} - placeholder="{__.text_placeholder}" + placeholder="{_t.text_placeholder}" disabled={opts.disabled} value={valueText} required={opts.choice.choiceType === 'TEXT'} pattern={opts.choice.choiceType === 'TEXT' ? ".*[^\\s]+.*" : ""} maxlength="255" - title={__.text_notBlank} + title={_t.text_notBlank} onchange={onTextChange}/> <button type="button" class="choice-type-button colors-main-invers" @@ -48,7 +48,7 @@ require("../components/time-picker.tag.html"); show={!opts.disabled} disabled={opts.disabled} onclick="{setImageType}" - title="{__.ressource}"> + title="{_t.ressource}"> <i class="fa fa-image" aria-hidden="true"></i> </button> <div if="{originalFile}" @@ -68,7 +68,7 @@ require("../components/time-picker.tag.html"); <span if={!opts.disabled && !newFile} onclick="{addFile}"> <i class="fa fa-plus"/> - {__.addFile} + {_t.addFile} </span> <span if={!opts.disabled && newFile}> {newFile.name} @@ -88,7 +88,7 @@ require("../components/time-picker.tag.html"); alt="date" disabled={opts.disabled} onclick="{setDateType}" - title="{__.date}"> + title="{_t.date}"> <i class="fa fa-calendar" aria-hidden="true"></i> </button> <date-picker ref="choiceDate" @@ -101,7 +101,7 @@ require("../components/time-picker.tag.html"); alt="heure" disabled={opts.disabled} onclick="{toggleTime}" - title="{__.time}"> + title="{_t.time}"> <i class="fa fa-clock-o " aria-hidden="true"></i> </button> <time-picker ref="choiceTime" @@ -113,21 +113,24 @@ require("../components/time-picker.tag.html"); class="choice-type-button c-button--brand" alt="description" onclick="{toggleDescription}" - title="{__.description}"> + title="{_t.description}"> ... </button> </div> <div show="{showDescription}"> <textarea ref="description" - placeholder="{__.description_placeholder}" + placeholder="{_t.description_placeholder}" disabled={opts.disabled} value="{opts.choice.description}"/> </div> <script type="es6"> - this.session = require("../../js/Session"); - this.resourceService = require("../../js/ResourceService"); - let moment = require("moment"); + import session from "../../js/Session"; + import resourceService from "../../js/ResourceService"; + import moment from "moment"; + + this.session = session; + this.resourceService = resourceService; moment.locale(this.session.locale); this.installBundle(this.session, "choice", locale => { diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html index de1efe44..78f1f090 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html @@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./Report.tag.html"); -require("../components/MultiLineLabel.tag.html"); +import "./Report.tag.html"; +import "../components/MultiLineLabel.tag.html"; <ChoiceView> <div class="choice-view {center-choice : opts.center} {with-info : opts.choice.choiceType === 'RESOURCE' || opts.choice.description && !opts.showdescription}" @@ -92,9 +92,12 @@ require("../components/MultiLineLabel.tag.html"); </div> <script type="es6"> - this.session = require("../../js/Session"); - this.resourceService = require("../../js/ResourceService"); - let Tooltip = require("tooltip.js").default; + import session from "../../js/Session"; + import resourceService from "../../js/ResourceService"; + import Tooltip from "tooltip.js"; + + this.session = session; + this.resourceService = resourceService; this.installBundle(this.session, "choice"); this.showModalImage = false; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html index c7ff7b56..542af80b 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html @@ -8,19 +8,19 @@ 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% --> -require("./Choice.tag.html"); +import "./Choice.tag.html"; <Choices> - <h4>{__.title}</h4> + <h4>{_t.title}</h4> <div each={choice, index in form.choices} class="o-form-element"> <div class="c-input-group"> @@ -48,13 +48,15 @@ require("./Choice.tag.html"); show={!form.hasVotes} disabled={form.hasVotes || form.model.closed} onclick="{addOneChoice}"> - <i class="fa fa-plus"/> {__.moreChoice} + <i class="fa fa-plus"/> {_t.moreChoice} </button> </div> <script type="es6"> + import session from "../../js/Session"; + + this.session = session; this.form = this.opts.form; - this.session = require("../../js/Session"); this.choiceType = this.form.choiceType || "TEXT"; this.installBundle(this.session, "poll_choices", this.opts.emitter); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Comments.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Comments.tag.html index 35621582..fd714aa1 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Comments.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Comments.tag.html @@ -18,29 +18,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../Pagination.tag.html"); -require("../components/LetterAvatar.tag.html"); -require("../components/HumanInput.tag.html"); -require("../components/MultiLineLabel.tag.html"); -require("./Report.tag.html"); +import "../Pagination.tag.html"; +import "../components/LetterAvatar.tag.html"; +import "../components/HumanInput.tag.html"; +import "../components/MultiLineLabel.tag.html"; +import "./Report.tag.html"; <Comments> <div class="comments {open : open}"> <button type="button" class="c-button c-button--error close-btn" onclick="{closeComments}" - title={__.close}> + title={_t.close}> <i class="fa fa-times"/> </button> <div class="window colors-default" ref="window"> <div class="frame"> <div class="head"> - <h2 class="c-heading">{__.title}</h2> + <h2 class="c-heading">{_t.title}</h2> <button type="button" class="c-button c-button--error close-btn-inner" onclick="{closeComments}" - title={__.close}> + title={_t.close}> <i class="fa fa-times"/> </button> </div> @@ -56,7 +56,7 @@ require("./Report.tag.html"); maxlength="255" required value={poll.authorName} - placeholder="{__.authorPlaceholder}"> + placeholder="{_t.authorPlaceholder}"> </div> </div> <div class="o-form-element "> @@ -65,7 +65,7 @@ require("./Report.tag.html"); ref="text" name="text" required - placeholder="{__.textPlaceholder}"/> + placeholder="{_t.textPlaceholder}"/> </div> <div class="c-hint--static c-hint--error" if="{error}"> @@ -76,27 +76,27 @@ require("./Report.tag.html"); class="c-button c-button--info pull-right" disabled="{sendingComment}"> <i class="fa fa-paper-plane"/> - {__.sendComment} + {_t.sendComment} </button> </div> </form> <div show="{loaded}"> <h4 show="{poll.comments && poll.comments.length === 0}" class="c-heading"> - {__.noComment} + {_t.noComment} </h4> <div class="actions" show="{poll.commentCount > 0}"> <button type="button" class="c-button c-button--info" onclick="{toggleSort}" - title={orderDesc ? __.sort_desc : __.sort_asc}> + title={orderDesc ? _t.sort_desc : _t.sort_asc}> <i class="fa fa-sort-amount-{desc : pagination.desc, asc : !pagination.desc}"/> </button> <button type="button" class="c-button c-button--info" onclick="{scrollBottom}" - title={__.goToEnd}> + title={_t.goToEnd}> <i class="fa fa-arrow-down"/> </button> </div> @@ -125,13 +125,13 @@ require("./Report.tag.html"); <button type="button" class="c-button c-button--error u-small" onclick="{parent.parent.deleteComment(element)}" - title={parent.parent.__.delete}> + title={parent.parent._t.delete}> <i class="fa fa-trash"/> </button> <button type="button" class="c-button c-button--brand u-small" onclick="{parent.parent.startEditComment(element)}" - title={parent.parent.__.edit}> + title={parent.parent._t.edit}> <i class="fa fa-pencil-square-o"/> </button> </span> @@ -156,7 +156,7 @@ require("./Report.tag.html"); ref="editAuthor" required value={parent.parent.commentEditing.authorName} - placeholder="{parent.parent.__.authorPlaceholder}"> + placeholder="{parent.parent._t.authorPlaceholder}"> </div> </div> @@ -169,7 +169,7 @@ require("./Report.tag.html"); name="editText" required value={parent.parent.commentEditing.text} - placeholder="{parent.parent.__.textPlaceholder}"/> + placeholder="{parent.parent._t.textPlaceholder}"/> </div> </div> </div> @@ -181,15 +181,15 @@ require("./Report.tag.html"); <button class="c-button c-button--error" type="button" onclick="{parent.parent.cancelEditComment}" - title={parent.parent.__.cancelEditComment}> + title={parent.parent._t.cancelEditComment}> <i class="fa fa-remove"/> - {parent.parent.__.cancelEditComment} + {parent.parent._t.cancelEditComment} </button> <button class="c-button c-button--success pull-right" type="submit" - title={parent.parent.__.updateComment}> + title={parent.parent._t.updateComment}> <i class="fa fa-check"/> - {parent.parent.__.updateComment} + {parent.parent._t.updateComment} </button> </div> </form> @@ -203,7 +203,7 @@ require("./Report.tag.html"); <button type="button" class="c-button c-button--info" onclick="{scrollTop}" - title={__.goToStart}> + title={_t.goToStart}> <i class="fa fa-arrow-up"/> </button> </div> @@ -215,17 +215,18 @@ require("./Report.tag.html"); <button type="button" class="c-button c-button--info open-btn not-printable {open : open}" onclick="{openComments}"> - <i class="fa fa-comment"/> {poll.commentCount} {poll.commentCount <= 1 ? __.one : __.many} + <i class="fa fa-comment"/> {poll.commentCount} {poll.commentCount <= 1 ? _t.one : _t.many} </button> <script type="es6"> + import poll from "../../js/Poll.js"; + import session from "../../js/Session"; + this.loaded = false; - let session = require("../../js/Session"); this.installBundle(session, "poll_comments"); - let moment = require("moment"); this.sendingComment = false; - this.poll = require("../../js/Poll.js"); + this.poll = poll; this.pagination = { order: "postDate", @@ -234,9 +235,9 @@ require("./Report.tag.html"); pageNumber: 0 }; - this.onPollChange = poll => { - this.loaded = poll.comments !== undefined; - this.poll = poll; + this.onPollChange = poll2 => { + this.loaded = poll2.comments !== undefined; + this.poll = poll2; this.update(); }; @@ -319,7 +320,7 @@ require("./Report.tag.html"); }; this.deleteComment = (comment) => () => { - this.confirm(this.__.deleteComment).then((confirm) => { + this.confirm(this._t.deleteComment).then((confirm) => { if (confirm) { this.poll.deleteComment(comment).then(() => { this.refresh(); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Description.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Description.tag.html index 8d8af1ed..99341a78 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Description.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Description.tag.html @@ -23,10 +23,10 @@ <Description> <div class="description-part"> - <h4><i class="fa fa-info-circle"></i> {__.info}</h4> + <h4><i class="fa fa-info-circle"></i> {_t.info}</h4> <div class="o-form-element"> - <label class="c-label" for="title">{__.title}</label> + <label class="c-label" for="title">{_t.title}</label> <input ref="title" tabindex="1" type="text" @@ -34,43 +34,43 @@ required pattern=".*[^\s]+.*" maxlength="255" - title={__.titleNotBlank} + title={_t.titleNotBlank} name="title" value="{form.model.title}" disabled={opts.form.model.closed} - placeholder="{__.titlePlaceHolder}"/> + placeholder="{_t.titlePlaceHolder}"/> </div> <div class="o-form-element"> - <label class="c-label" for="description">{__.description}</label> + <label class="c-label" for="description">{_t.description}</label> <textarea ref="description" tabindex="1" class="c-field c-field--label" name="description" disabled={opts.form.model.closed} - placeholder="{__.descriptionPlaceHolder}">{form.model.description}</textarea> + placeholder="{_t.descriptionPlaceHolder}">{form.model.description}</textarea> </div> </div> <div class="description-part"> - <h4><i class="fa fa-user-circle"></i> {__.user}</h4> + <h4><i class="fa fa-user-circle"></i> {_t.user}</h4> <div class="o-form-element"> - <label class="c-label" for="name">{__.name}</label> + <label class="c-label" for="name">{_t.name}</label> <input ref="name" tabindex="1" type="text" class="c-field c-field--label" required pattern=".*[^\s]+.*" - title={__.nameNotBlank} + title={_t.nameNotBlank} name="name" value="{form.model.creatorName}" maxlength="255" disabled={opts.form.model.closed} - placeholder="{__.namePlaceHolder}"/> + placeholder="{_t.namePlaceHolder}"/> </div> <div class="o-form-element"> - <label class="c-label" for="email">{__.email}</label> + <label class="c-label" for="email">{_t.email}</label> <input ref="email" tabindex="1" type="email" @@ -78,7 +78,7 @@ name="email" value="{form.model.creatorEmail}" disabled={opts.form.model.closed} - placeholder="{__.emailPlaceHolder}" + placeholder="{_t.emailPlaceHolder}" list="userEmailAddresses" autocomplete="off"/> <datalist if={session.isConnected() && session.getUser().emailAddresses.length > 0} id="userEmailAddresses"> @@ -88,7 +88,9 @@ </div> <script type="es6"> - this.session = require("../../js/Session"); + import session from "../../js/Session"; + + this.session = session; this.installBundle(this.session, "poll_description", this.opts.emitter); this.form = this.opts.form; this.submit = () => { diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html index cdf24424..06161c08 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html @@ -20,20 +20,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% */ -require("./Description.tag.html"); -require("./Choices.tag.html"); -require("./Settings.tag.html"); -require("../voterList/VoterList.tag.html"); -require("./Summary.tag.html"); -require("../components/HumanInput.tag.html"); -require("./CheckEmails.tag.html"); +import "./Description.tag.html"; +import "./Choices.tag.html"; +import "./Settings.tag.html"; +import "../voterList/VoterList.tag.html"; +import "./Summary.tag.html"; +import "../components/HumanInput.tag.html"; +import "./CheckEmails.tag.html"; <EditPoll> <form show={loaded} ref="poll" onsubmit="{submitStep}" class="container"> <h1 class="no-border"> - <span if="{form.creation}">{__.newPoll}</span> + <span if="{form.creation}">{_t.newPoll}</span> <span if="{!form.creation}">{form.model.title}</span> </h1> @@ -50,7 +50,7 @@ require("./CheckEmails.tag.html"); </div> <div if="{showSummary || form.model.closed}" class="tab {selected: showSummary}" onclick="{doShowSummary}"> <button type="submit" class="cursor-pointer"> - {__.summaryTab} + {_t.summaryTab} </button> </div> </div> @@ -73,21 +73,21 @@ require("./CheckEmails.tag.html"); tabindex="3" href={form.creation ? "#" : ("#poll/" + form.model.id + "/vote/" + form.model.permission)}> <i class="fa fa-undo" aria-hidden="true"></i> - {__.cancel} + {_t.cancel} </a> <button type={form.creation || form.model.closed ? "button" : "submit"} if={form.step > 0} tabindex="2" class="c-button c-button--ghost" onclick={previousStep}> <i class="fa fa-chevron-left" aria-hidden="true"></i> - {__.previous} + {_t.previous} </button> <button if={form.step < form.steps.length - 1} type="submit" class="c-button c-button--info" tabindex="1" onclick={nextStep}> - {__.next} + {_t.next} <i class="fa fa-chevron-right " aria-hidden="true"></i> </button> @@ -99,7 +99,7 @@ require("./CheckEmails.tag.html"); disabled={savePollWaiting} onclick={savePoll}> <i class="fa fa-{form.creation ? 'plus' : 'check'}" aria-hidden="true"></i> - {__.save} + {_t.save} </button> </div> </div> @@ -108,12 +108,15 @@ require("./CheckEmails.tag.html"); </form> <script type="es6"> + import session from "../../js/Session"; + import form from "../../js/PollForm"; + import route from "riot-route/lib/tag"; + this.loaded = false; this.showSummary = this.opts.showSummary; - this.session = require("../../js/Session"); + this.session = session; this.installBundle(this.session, "poll"); - this.form = require("../../js/PollForm"); - let Message = require("../../js/Message"); + this.form = form; let pollLoaded = () => { this.loaded = true; @@ -128,7 +131,7 @@ require("./CheckEmails.tag.html"); this.form.init(this.opts.choiceType, this.session.getUser()).then(pollLoaded); } - this.getStepLabel = step => this.__["step_" + step]; + this.getStepLabel = step => this._t["step_" + step]; this.goto = index => () => { this.showSummary = false; @@ -175,7 +178,6 @@ require("./CheckEmails.tag.html"); }; if (this.form.creation) { this.form.create().then(() => { - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; route("poll/" + this.form.model.id + "/summary/" + this.form.model.permission); this.bus.trigger("successMessage", this._l("creationSuccess", this.form.model.title)); }, errorFn); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html index 54b3e9fb..f7f9247f 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html @@ -35,18 +35,18 @@ required maxlength="255" tabindex="1" - placeholder={__.authorPlaceHolder} + placeholder={_t.authorPlaceHolder} value={poll.voterName}> </div> <div if={!poll.canVote && !voteInEdition} class="choices-label"> - {__.choices} + {_t.choices} </div> </div> <div if={poll.resultIsVisible} class="result-label"> - <strong if={(poll.voteCountingType !== 5) && (poll.voteCountingType !== 2) && (poll.voteCountingType !== 4)}>{__.results}</strong> - <strong if={(poll.voteCountingType === 5) || (poll.voteCountingType === 2)}>{__.scores}</strong> - <strong if={(poll.voteCountingType === 4)}>{__.totals}</strong> + <strong if={(poll.voteCountingType !== 5) && (poll.voteCountingType !== 2) && (poll.voteCountingType !== 4)}>{_t.results}</strong> + <strong if={(poll.voteCountingType === 5) || (poll.voteCountingType === 2)}>{_t.scores}</strong> + <strong if={(poll.voteCountingType === 4)}>{_t.totals}</strong> </div> </div> <div each={choice, index in poll.choices} class="choice separator-top"> @@ -85,16 +85,16 @@ </div> </div> <div if={poll.resultIsVisible} class="score-choice"> - <span if={!choice.score}>{parent.__.noVote}</span> + <span if={!choice.score}>{parent._t.noVote}</span> <span if={choice.score}> <i if="{choice.score.scoreOrder === 0}" class="fa fa-trophy fa-15x winner"></i> <span if={!pollTypeSelect}> {choice.score.scoreValue} <span if={choice.score.scoreValue || !pollTypeCoombs}> - {parent.__["results_unit_" + poll.voteCountingType + "_" + (choice.score.scoreValue > 1 ? "many" : "one")]} + {parent._t["results_unit_" + poll.voteCountingType + "_" + (choice.score.scoreValue > 1 ? "many" : "one")]} </span> <span if={!choice.score.scoreValue && pollTypeCoombs}> - {parent.__.eliminated} + {parent._t.eliminated} </span> </span> <span if={pollTypeSelect}> @@ -113,7 +113,7 @@ tabindex="{(poll.choices.length + 1) * 10}" disabled={tooManyChoicesSelected || voting}> <i class="fa fa-envelope"></i> - {__.toVote} + {_t.toVote} </button> <button if="{voteInEdition}" class="c-button c-button--error" @@ -122,7 +122,7 @@ onclick="{cancelEditVote}" disabled={voting}> <i class="fa fa-remove"></i> - {__.cancelEdition} + {_t.cancelEdition} </button> <button if="{voteInEdition}" class="c-button c-button--success" @@ -130,11 +130,11 @@ disabled={tooManyChoicesSelected || voting} type="submit"> <i class="fa fa-check"></i> - {__.validateEdition} + {_t.validateEdition} </button> </div> <div class="c-hint--static c-hint--error" if="{tooManyChoicesSelected}"> - {__.tooManyChoicesSelected} {poll.voteCountingConfig.maxChoiceNumber} + {_t.tooManyChoicesSelected} {poll.voteCountingConfig.maxChoiceNumber} </div> <div class="c-hint--static c-hint--error" if="{error}"> <div each={fields in error}> @@ -146,25 +146,27 @@ </form> </div> <script type="es6"> + import session from "../../js/Session"; + import poll from "../../js/Poll.js"; + import moment from "moment"; + this.loaded = false; - let session = require("../../js/Session"); - let Choice = require("../../js/Choice"); - this.moment = require("moment"); + this.moment = moment; this.installBundle(session, "poll_votes"); this.tooManyChoicesSelected = false; this.voting = false; - this.poll = require("../../js/Poll.js"); + this.poll = poll; this.poll.loadForVotes().then(() => { this.update(); }); - this.onPollChange = poll => { - this.poll = poll; - this.pollTypeCheckbox = poll.voteCountingTypeValue && poll.voteCountingTypeValue.renderType === "checkbox"; - this.pollTypeSelect = poll.voteCountingTypeValue && poll.voteCountingTypeValue.renderType === "select"; - this.pollTypeCoombs = poll.voteCountingType && poll.voteCountingType === 7; + this.onPollChange = poll2 => { + this.poll = poll2; + this.pollTypeCheckbox = poll2.voteCountingTypeValue && poll2.voteCountingTypeValue.renderType === "checkbox"; + this.pollTypeSelect = poll2.voteCountingTypeValue && poll2.voteCountingTypeValue.renderType === "select"; + this.pollTypeCoombs = poll2.voteCountingType && poll2.voteCountingType === 7; this.onVoteChanged(); this.update(); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Podium.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Podium.tag.html deleted file mode 100644 index 0d7bba51..00000000 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Podium.tag.html +++ /dev/null @@ -1,95 +0,0 @@ -<!-- - #%L - Pollen :: UI RiotJs - %% - 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% - --> -require("./ChoiceView.tag.html"); -<Podium> - <div class="podium"> - <div if={podium.step2} each={choice in podium.step2} class="podium-step second-step"> - <div class="step-score colors-main-invers">2</div> - <div class="choice"> - <ChoiceView choice={choice} center="true"/> - </div> - </div> - <div if={podium.step1} each={choice in podium.step1} class="podium-step first-step"> - <div class="step-score colors-main-invers">1</div> - <div class="choice"> - <ChoiceView choice={choice} center="true"/> - </div> - </div> - <div if={podium.step3} each={choice in podium.step3} class="podium-step third-step"> - <div class="step-score colors-main-invers">3</div> - <div class="choice"> - <ChoiceView choice={choice} center="true"/> - </div> - </div> - </div> - - <script type="es6"> - this.loaded = false; - this.podium = require("../../js/Poll.js").getPodium(); - this.onPollChange = poll => { - this.podium = poll.getPodium(); - this.update(); - }; - - this.listen("poll", this.onPollChange); - - </script> - - - <style> - - .podium { - display: flex; - justify-content: center; - margin-bottom: 15px; - } - - .podium-step { - display: flex; - flex-direction: column-reverse; - min-width: 20%; - } - - .step-score { - font-size: 2em; - text-align: center; - height: 1em; - } - - .second-step .step-score { - height: 1.5em; - } - - .first-step .step-score { - height: 2em; - } - - .podium-step .choice { - display: flex; - justify-content: center; - font-size: 2em; - padding: 0 10px; - } - - - </style> - -</Podium> diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html index bd56a33d..7e046150 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html @@ -18,16 +18,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./Votes.tag.html"); -require("./Comments.tag.html"); -require("./Results.tag.html"); -require("./Choices.tag.html"); -require("./Settings.tag.html"); -require("./CheckEmails.tag.html"); -require("../popup/QrCodeButton.tag.html"); -require("../components/MultiLineLabel.tag.html"); -require("../components/InnerHtml.tag.html"); -require("./Report.tag.html"); +import "./Votes.tag.html"; +import "./Comments.tag.html"; +import "./Results.tag.html"; +import "./Choices.tag.html"; +import "./Settings.tag.html"; +import "./CheckEmails.tag.html"; +import "../popup/QrCodeButton.tag.html"; +import "../components/MultiLineLabel.tag.html"; +import "../components/InnerHtml.tag.html"; +import "./Report.tag.html"; <Poll> <div class="main-container" ref="mainContainer"> @@ -36,13 +36,13 @@ require("./Report.tag.html"); <span class="title">{poll.title}</span> <QrCodeButton if="{poll.pollType === 'FREE'}" class="title-button not-printable" value="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote" - title="{__.qrcode}"/> + title="{_t.qrcode}"/> <a href="{session.configuration.endPoint}/v1/polls/{poll.id}/feed?{poll.permission ? 'permission=' + poll.permission : ''}" class="c-button c-button--info title-button not-printable" - title="{__.rss}"> + title="{_t.rss}"> <i class="fa fa-rss" aria-hidden="true"></i> </a> - <a class="c-button c-button--info title-button not-printable" href="javascript:window.print()" title="{__.print}"> + <a class="c-button c-button--info title-button not-printable" href="javascript:window.print()" title="{_t.print}"> <i class="fa fa-print" aria-hidden="true"></i> </a> <Report target="{poll}"/> @@ -52,12 +52,12 @@ require("./Report.tag.html"); <div class="tab-container"> <div class="tab {selected : selectedTab === 'votes'}"> <a href="#poll/{poll.id}/vote{poll.getPermission()?'/' + poll.getPermission() : ''}"> - <i class="fa fa-thumbs-o-up fa-flip-horizontal fa-15x"></i> {__.tab_votes} ({poll.voteCount}) + <i class="fa fa-thumbs-o-up fa-flip-horizontal fa-15x"></i> {_t.tab_votes} ({poll.voteCount}) </a> </div> <div class="tab {selected : selectedTab === 'results'}"> <a href="#poll/{poll.id}/result{poll.getPermission()?'/' + poll.getPermission() : ''}"> - <i class="fa fa-trophy fa-15x"></i> {__.tab_results} + <i class="fa fa-trophy fa-15x"></i> {_t.tab_results} </a> </div> </div> @@ -68,11 +68,11 @@ require("./Report.tag.html"); <div class="dropdown-content"> <a href="#poll/{poll.id}/summary/{poll.permission}"> <i class="link fa fa-pencil-square-o"/> - {__.editPoll} + {_t.editPoll} </a> <a onclick="{deletePoll}"> <i class="link fa fa-trash"/> - {__.deletePoll} + {_t.deletePoll} </a> </div> </div> @@ -83,20 +83,20 @@ require("./Report.tag.html"); <div class="left-icon"> <i class="fa fa-clock-o"></i> - <p>{__.dateVotes}</p> - <p>{poll.endDate ? __.dateFrom : __.dateFromNoEnd} <span class="brand">{formatDate(poll.beginDate)}</span></p> - <p if={poll.endDate}> {__.dateTo} <span class="brand">{formatDate(poll.endDate)}</span></p> + <p>{_t.dateVotes}</p> + <p>{poll.endDate ? _t.dateFrom : _t.dateFromNoEnd} <span class="brand">{formatDate(poll.beginDate)}</span></p> + <p if={poll.endDate}> {_t.dateTo} <span class="brand">{formatDate(poll.endDate)}</span></p> </div> <div class="left-icon" if={poll.choiceAddAllowed}> <i class="fa fa-check-square"></i> - <p>{__.dateAddChoices}</p> + <p>{_t.dateAddChoices}</p> <p> - {poll.endChoiceDate || poll.endDate ? __.dateFrom : __.dateFromNoEnd} + {poll.endChoiceDate || poll.endDate ? _t.dateFrom : _t.dateFromNoEnd} <span class="brand">{formatDate(poll.beginChoiceDate ? poll.beginChoiceDate : poll.beginDate)}</span> </p> <p if={poll.endChoiceDate || poll.endDate}> - {__.dateTo} + {_t.dateTo} <span class="brand">{formatDate(poll.endChoiceDate ? poll.endChoiceDate : poll.endDate)}</span> </p> </div> @@ -104,21 +104,21 @@ require("./Report.tag.html"); <div class="cursor-pointer left-icon" if="{poll.voteCountingTypeValue}" onclick="{toggleHelp}"> <i class="fa fa-cog" aria-hidden="true"></i> <p> - {__.voteCountingType} <span class="brand">{poll.voteCountingTypeValue.name}</span> + {_t.voteCountingType} <span class="brand">{poll.voteCountingTypeValue.name}</span> <i class="info-label fa fa-question-circle" aria-hidden="true"></i> </p> </div> <div class="left-icon"> <i class="fa fa-user-circle"></i> - <p>{__.createdBy} <span class="brand">{poll.creatorName}</span></p> + <p>{_t.createdBy} <span class="brand">{poll.creatorName}</span></p> </div> <div class="left-icon" onclick="{toggleMaxVoters}"> <i class="fa fa-envelope"></i> <p> <span if={poll.voteCount > 0} class="brand">{poll.voteCount}</span> - {poll.voteCount === 0 ? __.noVote : (poll.voteCount === 1 ? __.vote : __.votes)} + {poll.voteCount === 0 ? _t.noVote : (poll.voteCount === 1 ? _t.vote : _t.votes)} <a if={poll.maxVoters > 0} class="info-label"> <i class="fa fa-exclamation-circle" aria-hidden="true"></i> </a> @@ -127,8 +127,8 @@ require("./Report.tag.html"); <div class="left-icon" if="{poll.pollType === 'RESTRICTED'}"> <i class="fa fa-users"></i> - <p><span class="brand">{poll.participantCount}</span> {__.subscribers}</p> - <p><span class="brand">{((poll.voteCount / poll.participantCount) * 100).toFixed(2)} %</span> {__.participation}</p> + <p><span class="brand">{poll.participantCount}</span> {_t.subscribers}</p> + <p><span class="brand">{((poll.voteCount / poll.participantCount) * 100).toFixed(2)} %</span> {_t.participation}</p> </div> </div> @@ -154,20 +154,23 @@ require("./Report.tag.html"); </div> <script type="es6"> - this.session = require("../../js/Session"); - let Message = require("../../js/Message"); - let route = require("riot-route/lib/tag").default; + import session from "../../js/Session"; + import Message from "../../js/Message"; + import route from "riot-route/lib/tag"; + import poll from "../../js/Poll"; + + this.session = session; this.installBundle(this.session, "poll"); this.selectedTab = this.opts.tabName || "votes"; this.showVoteCountingTypeHelper = false; - this.poll = require("../../js/Poll"); - this.onPollChange = poll => { - this.poll = poll; + this.poll = poll; + this.onPollChange = poll2 => { + this.poll = poll2; this.update(); - this.bus.trigger("pageChanged", poll.title); + this.bus.trigger("pageChanged", poll2.title); }; this.listen("poll", this.onPollChange); @@ -192,7 +195,7 @@ require("./Report.tag.html"); this.deletePoll = (e) => { e.preventDefault(); e.stopPropagation(); - this.confirm(this.__.deletePoll).then((confirm) => { + this.confirm(this._t.deletePoll).then((confirm) => { if (confirm) { this.poll.delete().then(() => { route(""); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/PollCard.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/PollCard.tag.html index cd99a48f..083ba258 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/PollCard.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/PollCard.tag.html @@ -18,19 +18,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../components/Avatar.tag.html"); +import "../components/Avatar.tag.html"; <PollCard class="poll-{opts.poll.status.toLowerCase()}"> <div class="card-actions"> <a if={opts.poll.permission} class="info" - title={__.edit} + title={_t.edit} href="#poll/{opts.poll.id}/edit/{opts.poll.permission}"> <i class="fa fa-pencil"></i> </a> <a class="error" if={opts.poll.permission} - title={__.delete} + title={_t.delete} onclick={deletePoll}> <i class="fa fa-times"></i> </a> @@ -60,7 +60,7 @@ require("../components/Avatar.tag.html"); <span class="poll-votes"> <a href="#poll/{opts.poll.id}/vote/{opts.poll.permission}"> - {opts.poll.voteCount === 0 ? __.noVote : (opts.poll.voteCount + " " + (count === 1 ? __.vote : __.votes))} + {opts.poll.voteCount === 0 ? _t.noVote : (opts.poll.voteCount + " " + (count === 1 ? _t.vote : _t.votes))} </a> <a if={opts.poll.maxVoters > 0 &&opts.poll.voteCount > opts.poll.maxVoters} class="c-badge c-badge--rounded c-badge--warning" @@ -71,14 +71,15 @@ require("../components/Avatar.tag.html"); </div> <script type="es6"> - let session = require("../../js/Session"); - let pollService = require("../../js/PollService"); + import session from "../../js/Session"; + import pollService from "../../js/PollService"; + this.installBundle(session, "poll"); this.deletePoll = (e) => { e.preventDefault(); e.stopPropagation(); - this.confirm(this.__.deletePoll).then((confirm) => { + this.confirm(this._t.deletePoll).then((confirm) => { if (confirm) { pollService.deletePoll(this.opts.poll.id, this.opts.poll.permission).then(() => { this.opts.onPollListChange(); @@ -90,9 +91,9 @@ require("../components/Avatar.tag.html"); this.toggleMaxVoters = () => { let message = this._l("maxVotersAlert", this.opts.poll.maxVoters); if (this.opts.poll.permission) { - message += " " + this.__.maxVotersAlert_offers; + message += " " + this._t.maxVotersAlert_offers; } - this.info(this.__.maxVotersAlert_title, message, null, "warning"); + this.info(this._t.maxVotersAlert_title, message, null, "warning"); }; </script> diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Polls.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Polls.tag.html index 278e0968..578fe94d 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Polls.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Polls.tag.html @@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./PollCard.tag.html"); -require("../components/LazyLoad.tag.html"); -require("../components/LoadingCard.tag.html"); -require("../components/Search.tag.html"); +import "./PollCard.tag.html"; +import "../components/LazyLoad.tag.html"; +import "../components/LoadingCard.tag.html"; +import "../components/Search.tag.html"; <Polls> <div class="container" show="{loaded}"> - <h1>{__[opts.method]}</h1> + <h1>{_t[opts.method]}</h1> <div class="main-content"> <div class="c-alert c-alert--info"> @@ -46,13 +46,13 @@ require("../components/Search.tag.html"); <ContextualMenu if={opts.method === "createdPolls"}> <a onclick={parent.assignPoll}> - {parent.__.assignPollToMe_title} + {parent._t.assignPollToMe_title} </a> </ContextualMenu> - <Modal ref="assignModal" onsubmit={assign} header={__.assignPollToMe_title} label={__.assignPollToMe} type="success"> + <Modal ref="assignModal" onsubmit={assign} header={_t.assignPollToMe_title} label={_t.assignPollToMe} type="success"> <div class="o-form-element"> - <label class="c-label" for="pollToAssign">{parent.__.assignPollToMe_desc}</label> + <label class="c-label" for="pollToAssign">{parent._t.assignPollToMe_desc}</label> <div class="o-field o-field--icon-left"> <i class="fa fa-fw fa-link c-icon"></i> <input class="c-field" @@ -69,9 +69,11 @@ require("../components/Search.tag.html"); </div> <script type="es6"> + import session from "../../js/Session"; + import Message from "../../js/Message"; + import pollService from "../../js/PollService"; + this.loaded = false; - let session = require("../../js/Session"); - let Message = require("../../js/Message"); this.installBundle(session, "polls"); this.pollToAssignPlaceholder = session.pollenUIContext.uiEndPoint + "/#poll/xxxx/vote/xxxx"; this.pollToAssignUrlPattern = session.pollenUIContext.uiEndPoint + "/#poll/(.+)/vote/(.+)"; @@ -86,8 +88,6 @@ require("../components/Search.tag.html"); this.count = 0; this.filteredCount = 0; - let pollService = require("../../js/PollService"); - this.getCountLabel = () => { let label; if (this.count === 0) { @@ -144,7 +144,7 @@ require("../components/Search.tag.html"); this.refresh(); this.bus.trigger("message", new Message(this._l("assignSuccessMessage", result.title), "success")); } else { - this.bus.trigger("message", new Message(this.__.alreadyAssignMessage, "warning")); + this.bus.trigger("message", new Message(this._t.alreadyAssignMessage, "warning")); } this.refs.assignModal.refs.pollToAssign.value = ""; this.update(); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Report.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Report.tag.html index 27fcfe7a..5f08f02f 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Report.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Report.tag.html @@ -8,29 +8,28 @@ 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% --> -require("../popup/Modal.tag.html"); <Report> <span class="label report-icon not-printable" show={!poll.permission} - onclick={openModalAddReport} title={__.title}> + onclick={openModalAddReport} title={_t.title}> <i class="fa fa-bell" aria-hidden="true"></i> </span> <span class="label {opts.target.report.count > opts.target.report.ignore ? 'error-label' : 'info-label'}" if={poll.permission && opts.target.report && opts.target.report.count} onclick={openReports} - title="{__.count} : {opts.target.report.count}{opts.target.report.ignore > 0 ? ' (' + opts.target.report.ignore + ' ' + __.ignores + ')' : ''} {__.score} : {opts.target.report.score}"> + title="{_t.count} : {opts.target.report.count}{opts.target.report.ignore > 0 ? ' (' + opts.target.report.ignore + ' ' + _t.ignores + ')' : ''} {_t.score} : {opts.target.report.score}"> <i class="fa fa-exclamation-circle" aria-hidden="true"></i> </span> @@ -93,9 +92,12 @@ require("../popup/Modal.tag.html"); </modal> <script type="es6"> - this.session = require("../../js/Session"); + import session from "../../js/Session"; + import poll from "../../js/Poll.js"; + + this.session = session; this.installBundle(this.session, "report"); - this.poll = require("../../js/Poll.js"); + this.poll = poll; this.levels = ["ILLEGAL", "SPAM", "OFF_TOPIC"]; this.reports = []; this.ignoreReports = []; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Results.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Results.tag.html index 3ef8dce0..4bf0c4c0 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Results.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Results.tag.html @@ -18,27 +18,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./ChoiceView.tag.html"); -require("../voteCountingType/CondorcetDetailResult.tag.html"); -require("../voteCountingType/BordaDetailResult.tag.html"); -require("../voteCountingType/InstantRunoffDetailResult.tag.html"); -require("../voteCountingType/CoombsDetailResult.tag.html"); -require("../voteCountingType/MajorityJudgmentDetailResult.tag.html"); +import "./ChoiceView.tag.html"; +import "../voteCountingType/CondorcetDetailResult.tag.html"; +import "../voteCountingType/BordaDetailResult.tag.html"; +import "../voteCountingType/InstantRunoffDetailResult.tag.html"; +import "../voteCountingType/CoombsDetailResult.tag.html"; +import "../voteCountingType/MajorityJudgmentDetailResult.tag.html"; <Results> <div class="container" show="{loaded}"> <div if="{!poll.resultIsVisible}" class="c-alert c-alert--warning"> - {__.noResult} + {_t.noResult} </div> <div if="{poll.resultIsVisible && poll.results}" class="result-body" > <table class="table-results"> <thead> <tr> - <th>{__.rank}</th> - <th if={(poll.voteCountingType !== 5) && (poll.voteCountingType !== 2) && (poll.voteCountingType !== 4)}>{__.results}</th> - <th if={(poll.voteCountingType === 5) || (poll.voteCountingType === 2)}>{__.scores}</th> - <th if={(poll.voteCountingType === 4)}>{__.totals}</th> - <th>{__.choices}</th> + <th>{_t.rank}</th> + <th if={(poll.voteCountingType !== 5) && (poll.voteCountingType !== 2) && (poll.voteCountingType !== 4)}>{_t.results}</th> + <th if={(poll.voteCountingType === 5) || (poll.voteCountingType === 2)}>{_t.scores}</th> + <th if={(poll.voteCountingType === 4)}>{_t.totals}</th> + <th>{_t.choices}</th> </tr> </thead> <tbody> @@ -48,10 +48,10 @@ require("../voteCountingType/MajorityJudgmentDetailResult.tag.html"); <span if={parent.poll.voteCountingType !== 8}> {result.scoreValue} <span if={result.scoreValue || !pollTypeCoombs}> - {parent.__["unit_" + poll.voteCountingType + "_" + (result.scoreValue > 1 ? "many" : "one")]} + {parent._t["unit_" + poll.voteCountingType + "_" + (result.scoreValue > 1 ? "many" : "one")]} </span> <span if={!result.scoreValue && pollTypeCoombs}> - {parent.__.eliminated} + {parent._t.eliminated} </span> </span> <span if={parent.poll.voteCountingType === 8}> @@ -73,17 +73,19 @@ require("../voteCountingType/MajorityJudgmentDetailResult.tag.html"); </div> <script type="es6"> + import session from "../../js/Session"; + import poll from "../../js/Poll.js"; + this.loaded = false; - let session = require("../../js/Session"); this.installBundle(session, "poll_results"); - this.poll = require("../../js/Poll.js"); + this.poll = poll; this.poll.loadResults(); - this.onPollChange = poll => { - this.loaded = !poll.resultIsVisible || poll.results !== undefined; - this.poll = poll; - this.pollTypeCoombs = poll.voteCountingType && poll.voteCountingType === 7; + this.onPollChange = poll2 => { + this.loaded = !poll2.resultIsVisible || poll2.results !== undefined; + this.poll = poll2; + this.pollTypeCoombs = poll2.voteCountingType && poll2.voteCountingType === 7; this.update(); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html index 1659c242..9f7c56c1 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html @@ -20,44 +20,44 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% */ -require("../components/date-time-picker.tag.html"); -require("../components/Checkbox.tag.html"); -require("../voteCountingType/MaxChoicesNumberConfig.tag.html"); -require("../voteCountingType/BordaConfig.tag.html"); -require("../voteCountingType/CumulativeConfig.tag.html"); -require("../voteCountingType/MajorityJudgmentConfig.tag.html"); +import "../components/date-time-picker.tag.html"; +import "../components/Checkbox.tag.html"; +import "../voteCountingType/MaxChoicesNumberConfig.tag.html"; +import "../voteCountingType/BordaConfig.tag.html"; +import "../voteCountingType/CumulativeConfig.tag.html"; +import "../voteCountingType/MajorityJudgmentConfig.tag.html"; <Settings> <div class="form-section" show={form.creation}> <div class="o-form-element"> - <Checkbox label="{__.restricted}" + <Checkbox label="{_t.restricted}" name="pollType" ref="pollType" i18nprefix="{i18nprefix}" disabled={opts.form.hasVotes} checkboxchecked={opts.form.model.pollType === "RESTRICTED"} ontogglecheckbox={togglePollType}> - {checked ? __.restricted_yes : __.restricted_no} + {checked ? _t.restricted_yes : _t.restricted_no} </Checkbox> </div> - <h4><i class="fa fa-cogs"></i> {__.basic_usage}</h4> + <h4><i class="fa fa-cogs"></i> {_t.basic_usage}</h4> <div class="o-form-element"> - <Checkbox label="{__.use_basic_usage}" + <Checkbox label="{_t.use_basic_usage}" disabled={opts.form.model.closed} checkboxchecked={!showOptions} ontogglecheckbox={toggleShowOptions}/> </div> <div class="c-alert c-alert--info" if={!showOptions}> - {__.basic_usage_detail} + {_t.basic_usage_detail} <ul> - <li>{__.basic_usage_detail_type}</li> - <li>{__.basic_usage_detail_multi_choices}</li> - <li>{__.basic_usage_detail_opening}</li> - <li>{__.basic_usage_detail_closing}</li> - <li>{__.basic_usage_detail_comments}</li> - <li>{__.basic_usage_detail_results}</li> - <li>{__.basic_usage_detail_notifications}</li> + <li>{_t.basic_usage_detail_type}</li> + <li>{_t.basic_usage_detail_multi_choices}</li> + <li>{_t.basic_usage_detail_opening}</li> + <li>{_t.basic_usage_detail_closing}</li> + <li>{_t.basic_usage_detail_comments}</li> + <li>{_t.basic_usage_detail_results}</li> + <li>{_t.basic_usage_detail_notifications}</li> </ul> </div> </div> @@ -67,13 +67,13 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); <div class="form-section"> <h4> <i class="fa fa-cog"></i> - {__.nav_voteCountingType} + {_t.nav_voteCountingType} <i class="info-label fa fa-question-circle" aria-hidden="true" onclick="{toggleVoteCountingTypeHelp}"></i> </h4> <div class="o-form-element select-or-radio"> <fieldset class="o-fieldset choice-radio" disabled={form.hasVotes || opts.form.model.closed}> - <legend class="o-fieldset__legend">{__.voteCountingType}</legend> + <legend class="o-fieldset__legend">{_t.voteCountingType}</legend> <label each={type in form.voteCountingTypes} class="c-field c-field--choice" title="{type.shortHelper}"> @@ -107,9 +107,9 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); </div> </div> <div class="form-section"> - <h4><i class="fa fa-check-square"></i> {__.nav_choices}</h4> + <h4><i class="fa fa-check-square"></i> {_t.nav_choices}</h4> <div class="o-form-element"> - <Checkbox label="{__.addChoices}" + <Checkbox label="{_t.addChoices}" name="choiceAddAllowed" id="choiceAddAllowed" ref="addChoices" @@ -120,7 +120,7 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); <div show="{form.model.choiceAddAllowed}" class="config-period"> <div class="o-form-element"> <label class="c-label" for="beginChoiceDate"> - {__.beginChoiceDate} + {_t.beginChoiceDate} </label> <date-time-picker ref="beginChoiceDate" tabindex="1" @@ -131,7 +131,7 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); </div> <div class="o-form-element"> <label class="c-label" for="endChoiceDate"> - {__.endChoiceDate} + {_t.endChoiceDate} </label> <date-time-picker ref="endChoiceDate" tabindex="1" @@ -164,9 +164,9 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); <div class="settings-options-row"> <div class="form-section"> - <h4><i class="fa fa-envelope"></i> {__.nav_votes}</h4> + <h4><i class="fa fa-envelope"></i> {_t.nav_votes}</h4> <div class="o-form-element"> - <Checkbox label="{__.votePeriod}" + <Checkbox label="{_t.votePeriod}" name="votePeriod" id="votePeriod" ref="votePeriod" @@ -177,7 +177,7 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); <div show="{form.model.votePeriod}" class="config-period"> <div class="o-form-element"> <label class="c-label" for="beginDate"> - {__.beginDate} + {_t.beginDate} </label> <date-time-picker ref="beginDate" tabindex="1" @@ -188,7 +188,7 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); </div> <div class="o-form-element"> <label class="c-label" for="endDate"> - {__.endDate} + {_t.endDate} </label> <date-time-picker ref="endDate" tabindex="1" @@ -202,21 +202,21 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); </div> <div class="o-form-element"> <label class="c-label"> - {__.voteVisibility} + {_t.voteVisibility} </label> <select class="c-field c-field--label" tabindex="1" ref="voteVisibility" disabled={form.hasVotes || opts.form.model.closed} value={form.model.voteVisibility}> - <option value="ANONYMOUS">{__.voteVisibility_anonymous}</option> - <option value="CREATOR">{__.voteVisibility_creator}</option> - <option value="VOTER">{__.voteVisibility_voter}</option> - <option value="EVERYBODY">{__.voteVisibility_everybody}</option> + <option value="ANONYMOUS">{_t.voteVisibility_anonymous}</option> + <option value="CREATOR">{_t.voteVisibility_creator}</option> + <option value="VOTER">{_t.voteVisibility_voter}</option> + <option value="EVERYBODY">{_t.voteVisibility_everybody}</option> </select> </div> <div class="o-form-element"> - <Checkbox label="{__.nav_anonymousVote}" + <Checkbox label="{_t.nav_anonymousVote}" name="anonymousVote" id="anonymousVote" ref="anonymousVote" @@ -226,23 +226,23 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); </div> </div> <div class="form-section"> - <h4><i class="fa fa-trophy"></i> {__.nav_result}</h4> + <h4><i class="fa fa-trophy"></i> {_t.nav_result}</h4> <div class="o-form-element"> <label class="c-label"> - {__.resultVisibility} + {_t.resultVisibility} </label> <select class="c-field c-field--label" tabindex="1" ref="resultVisibility" disabled={form.hasVotes || opts.form.model.closed} value={form.model.resultVisibility}> - <option value="CREATOR">{__.resultVisibility_creator}</option> - <option value="VOTER">{__.resultVisibility_voter}</option> - <option value="EVERYBODY">{__.resultVisibility_everybody}</option> + <option value="CREATOR">{_t.resultVisibility_creator}</option> + <option value="VOTER">{_t.resultVisibility_voter}</option> + <option value="EVERYBODY">{_t.resultVisibility_everybody}</option> </select> </div> <div class="o-form-element"> - <Checkbox label="{__.continuousResult}" + <Checkbox label="{_t.continuousResult}" name="continuousResults" id="continuousResults" ref="continuousResults" @@ -255,48 +255,48 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); <div class="settings-options-row"> <div class="form-section"> - <h4><i class="fa fa-comments"></i> {__.nav_comments}</h4> + <h4><i class="fa fa-comments"></i> {_t.nav_comments}</h4> <div class="o-form-element"> <label class="c-label"> - {__.commentVisibility} + {_t.commentVisibility} </label> <select class="c-field c-field--label" tabindex="1" ref="commentVisibility" disabled={form.hasVotes || opts.form.model.closed} value={form.model.commentVisibility}> - <option value="CREATOR">{__.commentVisibility_creator}</option> - <option value="VOTER">{__.commentVisibility_voter}</option> - <option value="EVERYBODY">{__.commentVisibility_everybody}</option> + <option value="CREATOR">{_t.commentVisibility_creator}</option> + <option value="VOTER">{_t.commentVisibility_voter}</option> + <option value="EVERYBODY">{_t.commentVisibility_everybody}</option> </select> </div> </div> <div class="form-section"> - <h4><i class="fa fa-paper-plane"></i> {__.nav_notification}</h4> + <h4><i class="fa fa-paper-plane"></i> {_t.nav_notification}</h4> <fieldset class="o-fieldset"> <legend class="o-fieldset__legend"> - {__.notification} - <i class="fa fa-question-circle cursor-help warning" if="{!form.model.creatorEmail}" title="{__.notification_disabled}"></i> + {_t.notification} + <i class="fa fa-question-circle cursor-help warning" if="{!form.model.creatorEmail}" title="{_t.notification_disabled}"></i> </legend> - <Checkbox label="{__.voteNotification}" + <Checkbox label="{_t.voteNotification}" labelclass="c-field c-field--choice" ref="voteNotification" disabled={!form.model.creatorEmail || opts.form.model.closed} checkboxchecked={form.model.voteNotification}/> - <Checkbox label="{__.commentNotification}" + <Checkbox label="{_t.commentNotification}" labelclass="c-field c-field--choice" ref="commentNotification" disabled={!form.model.creatorEmail || opts.form.model.closed} checkboxchecked={form.model.commentNotification}/> - <Checkbox label="{__.newChoiceNotification}" + <Checkbox label="{_t.newChoiceNotification}" labelclass="c-field c-field--choice" ref="newChoiceNotification" disabled={!form.model.creatorEmail || opts.form.model.closed} checkboxchecked={form.model.newChoiceNotification}/> </fieldset> <div class="o-form-element"> - <Checkbox label="{__.notifyMeBeforePollEnds}" + <Checkbox label="{_t.notifyMeBeforePollEnds}" labelclass="c-field c-field--choice" i18nprefix="{i18nprefix}" disabled={disableNotifyMeBeforePollEnds || opts.form.model.closed} @@ -304,11 +304,11 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); ontogglecheckbox={toggleNotifyMeBeforePollEnds}> <i class="fa fa-question-circle cursor-help warning" if="{checked}" - title="{__.notifyMeBeforePollEnds_disabled}"></i> + title="{_t.notifyMeBeforePollEnds_disabled}"></i> </Checkbox> <div if={notifyMeBeforePollEnds}> <label class="c-label"> - {__.notifyMeHoursBeforePollEnds} + {_t.notifyMeHoursBeforePollEnds} </label> <input type="number" tabindex="1" @@ -324,8 +324,10 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); </div> <script type="es6"> + import session from "../../js/Session"; + this.i18nprefix = "poll_settings"; - this.session = require("../../js/Session"); + this.session = session; this.installBundle(this.session, this.i18nprefix); this.form = this.opts.form; @@ -348,18 +350,18 @@ require("../voteCountingType/MajorityJudgmentConfig.tag.html"); }); this.toggleVoteCountingTypeHelp = () => { - fetch("/help/voteCountingTypes-" + this.session.locale + ".html").then(response => { - return response.text(); - }) - .then(content => { - return this.info(this.__.nav_voteCountingType, content, null, "info"); - }).then(() => { - let video = document.getElementById("voteCountingTypesHelpVideo"); - if (video) { - video.pause(); - } - }); - + fetch("/help/voteCountingTypes-" + this.session.locale + ".html") + .then(response => { + return response.text(); + }) + .then(content => { + return this.info(this._t.nav_voteCountingType, content, null, "info"); + }).then(() => { + let video = document.getElementById("voteCountingTypesHelpVideo"); + if (video) { + video.pause(); + } + }); }; this.updateVoteCountingTypeHelp = () => { diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html index 2e89f352..f26c5f90 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html @@ -18,10 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./Choices.tag.html"); -require("./Settings.tag.html"); -require("../popup/QrCodeButton.tag.html"); -require("../components/MultiLineLabel.tag.html"); +import "./Choices.tag.html"; +import "./Settings.tag.html"; +import "../popup/QrCodeButton.tag.html"; +import "../components/MultiLineLabel.tag.html"; <Summary> @@ -39,40 +39,40 @@ require("../components/MultiLineLabel.tag.html"); </p> <div if="{opts.form.model.voteCountingTypeValue}"> - {__.voteCountingType} : + {_t.voteCountingType} : <strong>{opts.form.model.voteCountingTypeValue.name}</strong> (<em>{opts.form.model.voteCountingTypeValue.helper}</em>) </div> </div> <div class="summary-part"> - <h3>{__.choices}</h3> + <h3>{_t.choices}</h3> <div each={choice, index in opts.form.choices} class="{odd-row: index % 2 > 0}"> <ChoiceView choice={choice} showdescription="true" hidereport="true"/> </div> </div> <div class="summary-part"> - <h3>{__.dates}</h3> + <h3>{_t.dates}</h3> <div if={opts.form.model.choiceAddAllowed}> - {__.addingChoices} - <span if={opts.form.model.beginChoiceDate}>{__.fromDate} <strong>{formatDate(opts.form.model.beginChoiceDate)}</strong></span> - <span if={opts.form.model.endChoiceDate}> {__.toDate} <strong>{formatDate(opts.form.model.endChoiceDate)}</strong></span> + {_t.addingChoices} + <span if={opts.form.model.beginChoiceDate}>{_t.fromDate} <strong>{formatDate(opts.form.model.beginChoiceDate)}</strong></span> + <span if={opts.form.model.endChoiceDate}> {_t.toDate} <strong>{formatDate(opts.form.model.endChoiceDate)}</strong></span> </div> <div> - {__.voting} - {__.fromDate} <strong>{formatDate(opts.form.model.beginDate)}</strong> - <span if={opts.form.model.endDate}> {__.toDate} <strong>{formatDate(opts.form.model.endDate)}</strong></span> + {_t.voting} + {_t.fromDate} <strong>{formatDate(opts.form.model.beginDate)}</strong> + <span if={opts.form.model.endDate}> {_t.toDate} <strong>{formatDate(opts.form.model.endDate)}</strong></span> </div> </div> <div if={opts.form.model.pollType === "FREE"} class="summary-part"> - <h3>{__.sharing}</h3> + <h3>{_t.sharing}</h3> <div if={opts.form.model.participants && opts.form.model.participants.length > 0}> - {__.invitations} <strong>{opts.form.model.participants.length}</strong> + {_t.invitations} <strong>{opts.form.model.participants.length}</strong> </div> <div> <label class="c-label" for="voteUrl"> - {__.shareLink} + {_t.shareLink} </label> <div class="share-actions"> <div class="c-input-group"> @@ -87,13 +87,13 @@ require("../components/MultiLineLabel.tag.html"); <button type="button" class="c-button c-button--info" onclick={copy("voteUrl")} - title="{__.copyLink}"> + title="{_t.copyLink}"> <i class="fa fa-clipboard" aria-hidden="true"></i> </button> </div> - <QrCodeButton value="{voteUrl}" title="{__.shareByQR}"/> + <QrCodeButton value="{voteUrl}" title="{_t.shareByQR}"/> <a href="mailto:?subject={opts.form.model.title}&body={opts.form.model.title}%0D%0A{opts.form.model.description}%0D%0A{voteUrl}" - title="{__.shareByEmail}" + title="{_t.shareByEmail}" class="c-button c-button--info"> <i class="fa fa-paper-plane"></i> </a> @@ -102,9 +102,9 @@ require("../components/MultiLineLabel.tag.html"); </div> <div if={opts.form.model.pollType === "RESTRICTED"} class="summary-part"> - <h3>{__.members}</h3> + <h3>{_t.members}</h3> <div> - <strong>{opts.form.model.participantCount}</strong> {__.membersNb} + <strong>{opts.form.model.participantCount}</strong> {_t.membersNb} </div> </div> @@ -113,34 +113,34 @@ require("../components/MultiLineLabel.tag.html"); href="{voteUrl}" class="c-button c-button--info"> <i class="link fa fa-envelope-o"/> - {__.vote} + {_t.vote} </a> <a href="{voteUrl}/{opts.form.model.permission}" class="c-button c-button--brand"> <i class="link fa fa-wrench"/> - {__.administrate} + {_t.administrate} </a> <a if="{!opts.form.model.closed}" onclick="{closePoll}" class="c-button c-button--error"> <i class="link fa fa-close"/> - {__.closePoll}</a> + {_t.closePoll}</a> <a if="{opts.form.model.closed}" onclick="{reopenPoll}" class="c-button c-button--success"> <i class="link fa fa-play"/> - {__.reopenPoll}</a> + {_t.reopenPoll}</a> <a href="#poll/{opts.form.model.id}/clone/{opts.form.model.permission}" class="c-button c-button--info"> <i class="link fa fa-clone"/> - {__.clonePoll} + {_t.clonePoll} </a> </div> <script type="es6"> - this.session = require("../../js/Session"); - let Message = require("../../js/Message"); - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; + import session from "../../js/Session"; + + this.session = session; this.installBundle(this.session, "summary"); this.showVoteCountingTypeHelper = false; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html index 595be57c..19d88d5f 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html @@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./Choice.tag.html"); -require("./ChoiceView.tag.html"); -require("./EditVote.tag.html"); -require("./VotesTable.tag.html"); -require("../components/HumanInput.tag.html"); -require("../components/LazyLoad.tag.html"); -require("../components/Avatar.tag.html"); +import "./Choice.tag.html"; +import "./ChoiceView.tag.html"; +import "./EditVote.tag.html"; +import "./VotesTable.tag.html"; +import "../components/HumanInput.tag.html"; +import "../components/LazyLoad.tag.html"; +import "../components/Avatar.tag.html"; <Votes> <div class="container" show="{loaded}"> @@ -32,15 +32,15 @@ require("../components/Avatar.tag.html"); <!-- Form to vote --> <p class="warning-label warning" if="{loaded && !poll.canVote}"> - <span if="{moment().isBefore(poll.beginDate)}">{__.voteNotOpen}</span> - <span if="{moment().isAfter(poll.endDate)}">{__.voteClosed}</span> + <span if="{moment().isBefore(poll.beginDate)}">{_t.voteNotOpen}</span> + <span if="{moment().isAfter(poll.endDate)}">{_t.voteClosed}</span> </p> <!-- Form to add a choice --> <form ref="formAddChoice" class="formAddChoice" if={poll.status === "ADDING_CHOICES"}> <HumanInput onsubmit="{addChoice}"></HumanInput> <div class="o-form-element"> - <label class="c-label" for="choice">{__.addChoice}</label> + <label class="c-label" for="choice">{_t.addChoice}</label> <div class="c-input-group"> <div class="o-field"> <Choice ref="choice" @@ -50,7 +50,7 @@ require("../components/Avatar.tag.html"); </div> <button type="submit" class="c-button c-button--success" - tooltips="{__.addChoice}" + tooltips="{_t.addChoice}" disabled="{addingChoice}"> <i class="fa fa-plus"></i> </button> @@ -63,21 +63,23 @@ require("../components/Avatar.tag.html"); </div> - <script type="es6"> + <script type="es6"> + import session from "../../js/Session"; + import moment from "moment"; + import poll from "../../js/Poll.js"; + this.loaded = false; - let session = require("../../js/Session"); - let Choice = require("../../js/Choice"); - this.moment = require("moment"); + this.moment = moment; this.installBundle(session, "poll_votes"); this.addingChoice = false; - this.poll = require("../../js/Poll.js"); + this.poll = poll; this.choiceToAdd = this.poll.initChoice(); - this.onPollChange = poll => { - this.loaded = poll.choices !== undefined; - this.poll = poll; + this.onPollChange = poll2 => { + this.loaded = poll2.choices !== undefined; + this.poll = poll2; this.update(); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/VotesTable.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/VotesTable.tag.html index fc11e45e..d9bf12e3 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/VotesTable.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/VotesTable.tag.html @@ -37,7 +37,7 @@ <Avatar class="voter-avatar" avatar={element.voterAvatar} name={element.voterName} rounded="true"/> <div class="voter-name" onmouseenter="{parent.parent.showTooltip(element)}" onclick="{parent.parent.showTooltip(vote)}" onmouseleave="{parent.parent.hideTooltip}"> <span if="{!element.anonymous || element.permission}">{element.voterName}</span> - <span if="{element.anonymous && !element.permission}" class="anonymous-voter">{parent.parent.__.anonymousVoter}</span> + <span if="{element.anonymous && !element.permission}" class="anonymous-voter">{parent.parent._t.anonymousVoter}</span> </div> <button type="button" class="c-button c-button--rounded u-xsmall c-button--brand" @@ -84,16 +84,19 @@ <ChoiceView if="{voteTooltip.choice}" choice="{voteTooltip.choice}" center="true" hideReport="true"></ChoiceView> <div class="vote-value" if="{!pollTypeCheckbox && voteTooltip.vote && voteTooltip.choice}"> - {voteTooltip.vote.ignored ? __.ignored :poll.getVoteValue(voteTooltip.vote, voteTooltip.choice)}</div> + {voteTooltip.vote.ignored ? _t.ignored :poll.getVoteValue(voteTooltip.vote, voteTooltip.choice)}</div> <div if="{voteTooltip.vote && !voteTooltip.choice}">{voteTooltip.vote.voterName}</div> </div> </div> <script type="es6"> + import session from "../../js/Session"; + import poll from "../../js/Poll.js"; + import moment from "moment"; + const MIN_CHOICE_COLUMN_WIDTH = 100; - let session = require("../../js/Session"); - let Choice = require("../../js/Choice"); - this.moment = require("moment"); + + this.moment = moment; this.installBundle(session, "poll_votes"); this.showChoiceHeader = true; this.voteTooltip = { @@ -102,7 +105,7 @@ vote: null }; - this.poll = require("../../js/Poll.js"); + this.poll = poll; this.pagination = { order: "topiaCreateDate", @@ -127,9 +130,9 @@ this.showChoiceHeader = results0 && this.poll.choices && results0.offsetWidth / this.poll.choices.length >= MIN_CHOICE_COLUMN_WIDTH; }; - this.onPollChange = poll => { - this.poll = poll; - this.pollTypeCheckbox = poll.voteCountingTypeValue && poll.voteCountingTypeValue.renderType === "checkbox"; + this.onPollChange = poll2 => { + this.poll = poll2; + this.pollTypeCheckbox = poll2.voteCountingTypeValue && poll2.voteCountingTypeValue.renderType === "checkbox"; this.refresh(); this.update(); }; @@ -150,7 +153,7 @@ e.preventDefault(); e.stopPropagation(); - this.confirm(this.__.delete).then((confirm) => { + this.confirm(this._t.delete).then((confirm) => { if (confirm) { this.voting = true; this.update(); diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/ConfirmPopup.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/ConfirmPopup.tag.html index bace5c3b..552c6645 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/ConfirmPopup.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/ConfirmPopup.tag.html @@ -33,7 +33,7 @@ <button type="button" class="c-button c-button--block c-button--brand" onclick={cancel}> - {__.cancel} + {_t.cancel} </button> <button type="button" class="c-button c-button--block c-button--{type}" @@ -47,8 +47,7 @@ </div> <script type="es6"> - - let session = require("../../js/Session"); + import session from "../../js/Session"; this.installBundle(session, "confirm"); this.openModal = false; @@ -57,7 +56,7 @@ this.open = (message, label, type, timeout) => { this.message = message; - this.label = label || this.__.delete; + this.label = label || this._t.delete; this.type = type || "error"; this.timeout = timeout; diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/FeedbackModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/FeedbackModal.tag.html index 22a54df4..b85574a0 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/FeedbackModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/FeedbackModal.tag.html @@ -18,52 +18,52 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./Modal.tag.html"); +import "./Modal.tag.html"; <FeedbackModal> - <modal header={__.title} + <modal header={_t.title} onsubmit={sendFeedback} ref="modal"> - {parent.__.detail} + {parent._t.detail} <div class="o-fieldset categories"> - <legend class="o-fieldset__legend">{parent.__.category}</legend> + <legend class="o-fieldset__legend">{parent._t.category}</legend> <label class="c-field c-field--choice"> <input type="radio" name="category" ref="category" required value="BUG"> - {parent.__.category_bug} + {parent._t.category_bug} </label> <label class="c-field c-field--choice"> <input type="radio" name="category" ref="category" value="ERGONOMICS"> - {parent.__.category_ergonomics} + {parent._t.category_ergonomics} </label> <label class="c-field c-field--choice"> <input type="radio" name="category" ref="category" value="OTHER"> - {parent.__.category_other} + {parent._t.category_other} </label> </div> <div class="o-form-element"> - <label class="c-label" for="email">{parent.__.email}</label> + <label class="c-label" for="email">{parent._t.email}</label> <input ref="email" tabindex="1" type="email" class="c-field c-field--label" name="email" value="{(session && session.isConnected()) ? session.getUser().defaultEmailAddress : ''}" - placeholder="{__.emailPlaceHolder}" + placeholder="{_t.emailPlaceHolder}" list="userEmailAddresses" autocomplete="off"/> <datalist id="userEmailAddresses"> @@ -72,19 +72,19 @@ require("./Modal.tag.html"); </div> <div class="o-form-element"> - <label class="c-label" for="description">{parent.__.description}</label> + <label class="c-label" for="description">{parent._t.description}</label> <textarea class="c-field" name="description" ref="description" pattern=".*[^\s]+.*" - title={parent.__.descriptionNotBlank} + title={parent._t.descriptionNotBlank} required> </textarea> </div> <div class="o-form-element"> <label class="c-toggle c-toggle--info"> - {parent.__.uploadScreenShot} + {parent._t.uploadScreenShot} <input type="checkbox" name="uploadScreenShot" ref="uploadScreenShot"> @@ -97,12 +97,13 @@ require("./Modal.tag.html"); </modal> <script type="es6"> - this.session = require("../../js/Session"); - let Message = require("../../js/Message"); + import session from "../../js/Session"; + import resourceService from "../../js/ResourceService"; + import feedbackService from "../../js/FeedbackService"; + import html2canvas from "html2canvas"; + + this.session = session; this.installBundle(this.session, "feedback"); - let resourceService = require("../../js/ResourceService"); - let feedbackService = require("../../js/FeedbackService"); - let html2canvas = require("html2canvas"); this.userEmailAddresses = []; this.open = () => { @@ -181,7 +182,7 @@ require("./Modal.tag.html"); consoleHistory: JSON.stringify(this.logger.getHistory(), null, 2) }; return feedbackService.createfeedback(feedback).then(() => { - this.bus.trigger("message", this.__.create_success, "success"); + this.bus.trigger("message", this._t.create_success, "success"); }, (error) => { this.refs.modal.openModal = true; this.update(); diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/GtuChangeModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/GtuChangeModal.tag.html index 6dd498b7..f8d32884 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/GtuChangeModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/GtuChangeModal.tag.html @@ -20,16 +20,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% */ - require("../components/GtuValidation.tag.html"); - require("./Modal.tag.html"); + import "../components/GtuValidation.tag.html"; + import "./Modal.tag.html"; <GtuChangeModal> - <Modal ref="modal" header={__.title} onsubmit={submit} label={__.action}> + <Modal ref="modal" header={_t.title} onsubmit={submit} label={_t.action}> <GtuValidation /> </Modal> <script type="es6"> - let session = require("../../js/Session"); - let userService = require("../../js/UserService"); + import session from "../../js/Session"; + import userService from "../../js/UserService"; this.installBundle(session, "gtu_change"); diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/InformationPopup.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/InformationPopup.tag.html index 906426f9..16bbebc0 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/InformationPopup.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/InformationPopup.tag.html @@ -45,7 +45,7 @@ <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; this.installBundle(session, "information"); this.openModal = false; @@ -53,7 +53,7 @@ this.open = (title, message, label, type) => { this.title = title; this.refs.body.innerHTML = message; - this.label = label || this.__.ok; + this.label = label || this._t.ok; this.type = type || "brand"; this.openModal = true; this.modalPromise = new Promise((resolve, reject) => { diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/Modal.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/Modal.tag.html index d83f0c52..1b97185e 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/Modal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/Modal.tag.html @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../components/HumanInput.tag.html"); +import "../components/HumanInput.tag.html"; <modal show={openModal}> <div class="c-overlay"></div> @@ -39,11 +39,11 @@ require("../components/HumanInput.tag.html"); show={!opts.onlyOk} class="c-button c-button--block c-button--brand" onclick={cancel}> - {__.cancel} + {_t.cancel} </button> <button type="submit" class="c-button c-button--block c-button--{opts.type || 'info'}" > - {opts.label || __.ok} + {opts.label || _t.ok} </button> </div> </footer> @@ -52,7 +52,7 @@ require("../components/HumanInput.tag.html"); <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; this.installBundle(session, "modal"); this.openModal = false; diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/NewPassword.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/NewPassword.tag.html index af7412c8..6eaa45a6 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/NewPassword.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/NewPassword.tag.html @@ -21,25 +21,25 @@ #L% */ <NewPassword> - <Modal ref="modal" header={__.title} onsubmit={submit} label={__.action}> + <Modal ref="modal" header={_t.title} onsubmit={submit} label={_t.action}> <input class="c-field {c-field--error : parent.error}" ref="email" type="email" required - placeholder="{parent.__.placeholder}"> + placeholder="{parent._t.placeholder}"> <div if="{parent.error}" class="c-hint--static c-hint--error"> {parent.error} </div> <div if="{parent.sent}" class="c-hint--static c-hint--success"> - <i class="fa fa-envelope"></i> {parent.__.sent} + <i class="fa fa-envelope"></i> {parent._t.sent} </div> </Modal> <script type="es6"> - let session = require("../../js/Session"); - let authService = require("../../js/AuthService"); + import session from "../../js/Session"; + import authService from "../../js/AuthService"; this.installBundle(session, "newpassword"); this.sent = false; @@ -62,7 +62,7 @@ this.sent = true; this.update(); }, () => { - this.error = this.__.error_emailNotFound; + this.error = this._t.error_emailNotFound; this.update(); }); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/QrCodeButton.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/QrCodeButton.tag.html index 8e2df51d..537677eb 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/QrCodeButton.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/QrCodeButton.tag.html @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../QrCode.tag.html"); +import "../QrCode.tag.html"; <QrCodeButton> <button class="c-button c-button--info" onclick={open}> diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/ResendValidation.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/ResendValidation.tag.html index bb28b3c5..ab312643 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/ResendValidation.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/ResendValidation.tag.html @@ -21,26 +21,26 @@ #L% */ <ResendValidation> - <Modal ref="modal" header={__.title} onsubmit={submit} label={__.action}> + <Modal ref="modal" header={_t.title} onsubmit={submit} label={_t.action}> <input class="c-field {c-field--error : parent.error}" ref="email" type="email" required - placeholder="{parent.__.placeholder}"> + placeholder="{parent._t.placeholder}"> <div if="{parent.error}" class="c-hint--static c-hint--error"> {parent.error} </div> <div if="{parent.sent}" class="c-hint--static c-hint--success"> - <i class="fa fa-envelope"></i> {parent.__.sent} + <i class="fa fa-envelope"></i> {parent._t.sent} </div> </Modal> <script type="es6"> - let session = require("../../js/Session"); - let authService = require("../../js/AuthService"); + import session from "../../js/Session"; + import authService from "../../js/AuthService"; this.installBundle(session, "resendvalidation"); @@ -57,7 +57,7 @@ this.sent = true; this.update(); }, () => { - this.error = this.__.error_emailNotFound; + this.error = this._t.error_emailNotFound; this.update(); }); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaConfig.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaConfig.tag.html index 65b380dc..55efb863 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaConfig.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaConfig.tag.html @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("./MaxChoicesNumberConfig.tag.html"); +import "./MaxChoicesNumberConfig.tag.html"; <BordaConfig> @@ -29,7 +29,7 @@ require("./MaxChoicesNumberConfig.tag.html"); onchange={updatePointsByRank}/> <div class="o-form-element"> - <Checkbox label="{__.bordaDefault}" + <Checkbox label="{_t.bordaDefault}" name="bordaDefault" id="bordaDefault" ref="bordaDefault" @@ -39,12 +39,12 @@ require("./MaxChoicesNumberConfig.tag.html"); </div> <div class="o-form-element"> <label class="c-label" for="maxChoiceNumber"> - {__.pointsByRank} + {_t.pointsByRank} </label> <div class="c-input-group c-input-group--stacked c-field--label"> <div class="o-field ranks" each={value, index in opts.config.pointsByRank || []}> - <i class="rank">{parent.__.rank} {index + 1} :</i> + <i class="rank">{parent._t.rank} {index + 1} :</i> <input name="points-{index}" tabindex="1" id="points-{index}" @@ -56,13 +56,13 @@ require("./MaxChoicesNumberConfig.tag.html"); max="{index === 0 ? undefined : parent.opts.config.pointsByRank[index - 1]}" onChange={parent.pointsChange(index)} type="number"> - <i class="points">{parent.__.points}</i> + <i class="points">{parent._t.points}</i> </div> </div> </div> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; this.installBundle(session, "poll_settings_voteCountingConfig"); if (this.opts.config.pointsByRankDefault === undefined) { diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaDetailResult.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaDetailResult.tag.html index 0bff3439..12f1912c 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaDetailResult.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaDetailResult.tag.html @@ -18,24 +18,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../poll/ChoiceView.tag.html"); +import "../poll/ChoiceView.tag.html"; <BordaDetailResult> - <h3 class="c-heading">{__.title}</h3> + <h3 class="c-heading">{_t.title}</h3> <table class="ranks"> <tr> - <td class="cell">{__.rank}</td> + <td class="cell">{_t.rank}</td> <td class="cell rank" each={rank in Array.from(Array(poll.voteCountingConfig.maxChoiceNumber || poll.choices.length).keys())}> {rank + 1} </td> <td class="cell"></td> </tr> <tr> - <td class="cell separator-top">{__.points}</td> + <td class="cell separator-top">{_t.points}</td> <td class="cell separator-top" each={rank in Array.from(Array(poll.voteCountingConfig.maxChoiceNumber || poll.choices.length).keys())}> {poll.voteCountingConfig.pointsByRank ? poll.voteCountingConfig.pointsByRank[rank] : (poll.voteCountingConfig.maxChoiceNumber || poll.choices.length) - rank} </td> - <td class="cell score">{__.total}</td> + <td class="cell score">{_t.total}</td> </tr> <tr each={choice in poll.choices}> <td class="cell separator-top"> @@ -51,13 +51,15 @@ require("../poll/ChoiceView.tag.html"); </table> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import poll from "../../js/Poll.js"; + this.installBundle(session, "poll_results_borda"); - this.poll = require("../../js/Poll.js"); - this.onPollChange = poll => { - this.poll = poll; - this.pointsByRank = poll.choices ? (Array.from(Array(poll.choices.length).keys(), i => poll.choices.length - i)) : []; + this.poll = poll; + this.onPollChange = poll2 => { + this.poll = poll2; + this.pointsByRank = poll2.choices ? (Array.from(Array(poll2.choices.length).keys(), i => poll2.choices.length - i)) : []; this.update(); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CondorcetDetailResult.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CondorcetDetailResult.tag.html index db1246f0..abdd86b6 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CondorcetDetailResult.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CondorcetDetailResult.tag.html @@ -8,19 +8,19 @@ 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% --> -require("../poll/ChoiceView.tag.html"); +import "../poll/ChoiceView.tag.html"; <CondorcetDetailResult> - <h3 class="c-heading">{__.title}</h3> + <h3 class="c-heading">{_t.title}</h3> <table class="battles"> <tr> <td class="cell runners"></td> @@ -38,7 +38,7 @@ require("../poll/ChoiceView.tag.html"); </tr> <tr> <td class="cell separator-top score"> - {__.total} + {_t.total} </td> <td each={opponent in poll.choices} class="cell separator-top score"> {getScore(opponent)} @@ -47,12 +47,14 @@ require("../poll/ChoiceView.tag.html"); </table> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import poll from "../../js/Poll.js"; + this.installBundle(session, "poll_results_condorcet"); - this.poll = require("../../js/Poll.js"); - this.onPollChange = poll => { - this.poll = poll; + this.poll = poll; + this.onPollChange = poll2 => { + this.poll = poll2; this.update(); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CoombsDetailResult.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CoombsDetailResult.tag.html index e5e645ae..f42d72ec 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CoombsDetailResult.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CoombsDetailResult.tag.html @@ -8,35 +8,35 @@ 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% --> -require("../poll/ChoiceView.tag.html"); +import "../poll/ChoiceView.tag.html"; <CoombsDetailResult> - <h3 class="c-heading">{__.title}</h3> + <h3 class="c-heading">{_t.title}</h3> <table class="rounds"> <tr> - <td class="cell">{__.round}</td> + <td class="cell">{_t.round}</td> <td class="cell" each={round, index in (poll.results && poll.results.detail && poll.results.detail.rounds || [])}> {index + 1} </td> </tr> <tr> - <td class="cell separator-top">{__.ranks}</td> + <td class="cell separator-top">{_t.ranks}</td> <td class="separator-top" each={round in (poll.results && poll.results.detail && poll.results.detail.rounds || [])}> <div class="cell2"> <div class="cell"> - {parent.__.firstRank} + {parent._t.firstRank} </div> <div class="cell"> - {parent.__.lastRank} + {parent._t.lastRank} </div> </div> </td> @@ -59,11 +59,13 @@ require("../poll/ChoiceView.tag.html"); </table> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import poll from "../../js/Poll.js"; + this.installBundle(session, "poll_results_coombs"); - this.poll = require("../../js/Poll.js"); - + this.poll = poll; + this.getRoundFirstScore = (choice, round) => { let rankScore = round.roundChoices.find(r => r.choiceId === choice.id); return rankScore ? rankScore.firstScore || 0 : ""; diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CumulativeConfig.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CumulativeConfig.tag.html index 92d2f70a..ec084e1e 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CumulativeConfig.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CumulativeConfig.tag.html @@ -22,7 +22,7 @@ <div class="o-form-element"> <label class="c-label" for="points"> - {__.cumulativePoints} + {_t.cumulativePoints} </label> <input name="points" tabindex="1" @@ -36,7 +36,7 @@ </div> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; this.installBundle(session, "poll_settings_voteCountingConfig"); if (!this.opts.config.points) { diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/InstantRunoffDetailResult.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/InstantRunoffDetailResult.tag.html index 09ff8fe0..a47e66be 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/InstantRunoffDetailResult.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/InstantRunoffDetailResult.tag.html @@ -8,22 +8,22 @@ 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% --> -require("../poll/ChoiceView.tag.html"); +import "../poll/ChoiceView.tag.html"; <InstantRunoffDetailResult> - <h3 class="c-heading">{__.title}</h3> + <h3 class="c-heading">{_t.title}</h3> <table class="rounds"> <tr> - <td class="cell">{__.rounds}</td> + <td class="cell">{_t.rounds}</td> <td class="cell" each={round, index in poll.results.detail.rounds}> {index + 1} </td> @@ -39,12 +39,14 @@ require("../poll/ChoiceView.tag.html"); </table> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import poll from "../../js/Poll.js"; + this.installBundle(session, "poll_results_instantRunoff"); - this.poll = require("../../js/Poll.js"); - this.onPollChange = poll => { - this.poll = poll; + this.poll = poll; + this.onPollChange = poll2 => { + this.poll = poll2; this.update(); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentConfig.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentConfig.tag.html index f8a25589..93abc36f 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentConfig.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentConfig.tag.html @@ -22,7 +22,7 @@ <div class="o-form-element"> <label class="c-label"> - {__.grades} + {_t.grades} </label> <div class="grades"> <div class="c-input-group c-field--label" each={value, index in opts.config.grades}> @@ -40,13 +40,13 @@ </div> <button class="c-button c-button--success" type="button" - title={parent.__.addGradAfter} + title={parent._t.addGradAfter} onclick={addGradAfter(index)}> <i class="fa fa-plus" aria-hidden="true"></i> </button> <button class="c-button c-button--error" type="button" - title={parent.__.removeGrad} + title={parent._t.removeGrad} disabled={parent.opts.config.grades.length <= 3} onclick={removeGrad(index)}> <i class="fa fa-trash" aria-hidden="true"></i> @@ -56,16 +56,17 @@ <button class="c-button c-button--info default-grades" type="button" onclick={setDefaultGrades}> - {__.grades_default} + {_t.grades_default} </button> </div> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + this.installBundle(session, "poll_settings_voteCountingConfig"); this.setDefaultGrades = () => { - this.opts.config.grades = this.__.grades_default_values.split(","); + this.opts.config.grades = this._t.grades_default_values.split(","); }; if (this.opts.config.grades === undefined) { diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentDetailResult.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentDetailResult.tag.html index 41dc0342..9533a276 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentDetailResult.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentDetailResult.tag.html @@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../poll/ChoiceView.tag.html"); +import "../poll/ChoiceView.tag.html"; <MajorityJudgmentDetailResult> - <h3 class="c-heading">{__.title}</h3> + <h3 class="c-heading">{_t.title}</h3> <div class="legend"> <div class="legend-item" @@ -68,12 +68,14 @@ require("../poll/ChoiceView.tag.html"); </div> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import poll from "../../js/Poll.js"; + this.installBundle(session, "poll_results_majorityJudgment"); - this.poll = require("../../js/Poll.js"); - this.onPollChange = poll => { - this.poll = poll; + this.poll = poll; + this.onPollChange = poll2 => { + this.poll = poll2; this.update(); }; @@ -95,7 +97,7 @@ require("../poll/ChoiceView.tag.html"); this.getBars = choice => { let choiceResult = this.poll.results.detail.choiceResults - .find(cr => cr.choiceId === choice.id); + .find(cr => cr.choiceId === choice.id); return choiceResult.voteByGrad.map((nbVotes, index) => { let grad = this.poll.voteCountingConfig.grades[index]; return { @@ -104,7 +106,7 @@ require("../poll/ChoiceView.tag.html"); nbVotes: nbVotes, color: this.getColor(index, 100, 50, 0.8), borderColor: this.getColor(index, 100, 50, 1), - title: grad + " : " + nbVotes + " " + (nbVotes === 1 ? this.__.oneVote : this.__.manyVotes) + title: grad + " : " + nbVotes + " " + (nbVotes === 1 ? this._t.oneVote : this._t.manyVotes) }; }).filter(bar => bar.nbVotes > 0); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html index 84c9e593..dd77eafd 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html @@ -8,12 +8,12 @@ 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% @@ -21,7 +21,7 @@ <MaxChoicesNumberConfig> <div class="o-form-element"> - <Checkbox label="{__.limitChoices}" + <Checkbox label="{_t.limitChoices}" name="limitChoices" id="limitChoices" ref="limitChoices" @@ -31,7 +31,7 @@ </div> <div show={opts.config.maxChoiceNumber > 0} class="o-form-element"> <label class="c-label" for="maxChoiceNumber"> - {__.maxChoiceNumber} + {_t.maxChoiceNumber} </label> <input name="maxChoiceNumber" tabindex="1" @@ -46,7 +46,8 @@ </div> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + this.installBundle(session, "poll_settings_voteCountingConfig"); this.toggleLimitChoices = () => { diff --git a/pollen-ui-riot-js/src/main/web/tag/voterList/ImportFavoritListModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/voterList/ImportFavoritListModal.tag.html index 03361b11..1ca44173 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voterList/ImportFavoritListModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/ImportFavoritListModal.tag.html @@ -8,21 +8,21 @@ 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% --> -require("../popup/Modal.tag.html"); +import "../popup/Modal.tag.html"; <ImportFavoritListModal> - <Modal header={__.importFavoriteList} + <Modal header={_t.importFavoriteList} onsubmit={import} ref="modal"> <select class="c-field" @@ -35,10 +35,10 @@ require("../popup/Modal.tag.html"); </Modal> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import voterListService from "../../js/VoterListService"; + this.installBundle(session, "voterList"); - let favoriteListService = require("../../js/FavoriteListService"); - let voterListService = require("../../js/VoterListService"); this.open = () => { return this.refs.modal.open(); diff --git a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterList.tag.html b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterList.tag.html index aa2615a2..7aa38f98 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterList.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterList.tag.html @@ -19,18 +19,18 @@ #L% --> -require("./VoterListCard.tag.html"); -require("./VoterListEditModal.tag.html"); -require("./VoterListMemberCard.tag.html"); -require("./VoterListMemberEditModal.tag.html"); -require("./ImportFavoritListModal.tag.html"); -require("../components/ContextualMenu.tag.html"); +import "./VoterListCard.tag.html"; +import "./VoterListEditModal.tag.html"; +import "./VoterListMemberCard.tag.html"; +import "./VoterListMemberEditModal.tag.html"; +import "./ImportFavoritListModal.tag.html"; +import "../components/ContextualMenu.tag.html"; <VoterList> <ol class="c-breadcrumbs" if="{opts.form.currentVoterList.parentId}"> <li class="c-breadcrumbs__crumb" each={list, index in getVoterListsStack()}> <a class="c-link" onclick={parent.setCurrent(list)}> - {index === 0 ? parent.__.main_list : list.name} + {index === 0 ? parent._t.main_list : list.name} </a> </li> <li class="c-breadcrumbs__crumb c-text--loud"> @@ -41,7 +41,7 @@ require("../components/ContextualMenu.tag.html"); <div show={isOutOfLimite()} class="c-alert c-alert--warning"> <div> - <strong> {__.maxVotersAlert_title}</strong> + <strong> {_t.maxVotersAlert_title}</strong> </div> <InnerHtml html={_l("maxVotersAlert", opts.form.model.maxVoters)} /> </div> @@ -64,30 +64,30 @@ require("../components/ContextualMenu.tag.html"); <a onclick={parent.addMember} > <i class="fa fa-plus" aria-hidden="true"></i> <i class="fa fa-user" aria-hidden="true"></i> - {parent.__.addMember} + {parent._t.addMember} </a> <a onclick={parent.addVoterList} > <i class="fa fa-plus" aria-hidden="true"></i> <i class="fa fa-users" aria-hidden="true"></i> - {parent.__.addVoterList} + {parent._t.addVoterList} </a> <a if={parent.user && parent.favoriteLists.length} onclick={parent.importFavoriteList} > <i class="fa fa-arrow-down" aria-hidden="true"></i> <i class="fa fa-users" aria-hidden="true"></i> - {parent.__.importFavoriteList} + {parent._t.importFavoriteList} </a> <a if={parent.user && !parent.opts.form.currentVoterList.temp} onclick={parent.exportToFavoriteList} > <i class="fa fa-arrow-up" aria-hidden="true"></i> <i class="fa fa-users" aria-hidden="true"></i> - {parent.__.exportFavoriteList} + {parent._t.exportFavoriteList} </a> <a if={!parent.opts.form.creation && !parent.opts.form.model.closed && !parent.opts.form.currentVoterList.temp} onclick={parent.resendInvitation} > <i class="fa fa-paper-plane" aria-hidden="true"></i> - {parent.__.resendInvitation} + {parent._t.resendInvitation} </a> </ContextualMenu> @@ -103,11 +103,12 @@ require("../components/ContextualMenu.tag.html"); favorite-lists={favoriteLists}/> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import voterListService from "../../js/VoterListService"; + import favoriteListService from "../../js/FavoriteListService"; + import route from "riot-route/lib/tag"; + this.installBundle(session, "voterList"); - let voterListService = require("../../js/VoterListService"); - let favoriteListService = require("../../js/FavoriteListService"); - let route = require("riot-route/lib/tag").default; // a voir pourquoi le default doit être mi ; this.user = session.getUser(); this.favoriteLists = []; @@ -189,11 +190,11 @@ require("../components/ContextualMenu.tag.html"); voterListService.resendInvitationList(this.opts.form.currentVoterList).then((result) => { let message; if (result <= 0) { - message = this.__.resendInvitation_none; + message = this._t.resendInvitation_none; } else if (result === 1) { - message = this.__.resendInvitation_one; + message = this._t.resendInvitation_one; } else { - message = result + " " + this.__.resendInvitation_success; + message = result + " " + this._t.resendInvitation_success; } this.bus.trigger("message", message, "info"); }); @@ -213,7 +214,7 @@ require("../components/ContextualMenu.tag.html"); }; this.submit = () => { - this.opts.form.mainVoterList.name = this.__.mainList + this.opts.form.model.title; + this.opts.form.mainVoterList.name = this._t.mainList + this.opts.form.model.title; }; this.loadFavoriteList(); diff --git a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListCard.tag.html b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListCard.tag.html index 88f6e259..6b43c5d5 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListCard.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListCard.tag.html @@ -8,18 +8,18 @@ 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% --> -require("../components/Card.tag.html"); -require("./VoterListEditModal.tag.html"); +import "../components/Card.tag.html"; +import "./VoterListEditModal.tag.html"; <VoterListCard> <Card name={opts.voterList.name} @@ -31,7 +31,7 @@ require("./VoterListEditModal.tag.html"); <yield to="actions"> <a class="info" if={!parent.opts.form.creation && !parent.opts.form.model.closed && !parent.opts.voterList.temp} - title={parent.__.resendInvitation} + title={parent._t.resendInvitation} onclick={parent.resendInvitation}> <i class="fa fa-paper-plane"></i> </a> @@ -50,9 +50,10 @@ require("./VoterListEditModal.tag.html"); voter-list={opts.voterList}/> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import voterListService from "../../js/VoterListService"; + this.installBundle(session, "voterList"); - let voterListService = require("../../js/VoterListService"); this.edit = () => { this.refs.editModal.open().then(() => { @@ -66,7 +67,7 @@ require("./VoterListEditModal.tag.html"); }; this.delete = () => { - this.confirm(this.__.deleteMessage).then((confirm) => { + this.confirm(this._t.deleteMessage).then((confirm) => { if (confirm) { voterListService.deleteVoterList(this.opts.voterList); if (this.opts.onVoterListChange) { @@ -80,11 +81,11 @@ require("./VoterListEditModal.tag.html"); voterListService.resendInvitationList(this.opts.voterList).then((result) => { let message; if (result <= 0) { - message = this.__.resendInvitation_none; + message = this._t.resendInvitation_none; } else if (result === 1) { - message = this.__.resendInvitation_one; + message = this._t.resendInvitation_one; } else { - message = result + " " + this.__.resendInvitation_success; + message = result + " " + this._t.resendInvitation_success; } this.bus.trigger("message", message, "info"); }); diff --git a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListEditModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListEditModal.tag.html index 793d78a0..11873ad5 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListEditModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListEditModal.tag.html @@ -8,36 +8,36 @@ 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% --> -require("../popup/Modal.tag.html"); +import "../popup/Modal.tag.html"; <VoterListEditModal> <Modal ref="modal" - header={opts.voterList.id ? __.edit : __.new} - label={__.save} + header={opts.voterList.id ? _t.edit : _t.new} + label={_t.save} type="success" onsubmit={save}> <div class="o-form-element"> - <label class="c-label" for="name">{parent.__.name}</label> + <label class="c-label" for="name">{parent._t.name}</label> <input type="text" id="name" ref="name" class="c-field" - placeholder={parent.__.name_placeholder} + placeholder={parent._t.name_placeholder} value={parent.opts.voterList.name} class="c-field {c-field--error : parent.errors.name}"> </div> <div class="o-form-element"> - <label class="c-label" for="email">{parent.__.weight}</label> + <label class="c-label" for="email">{parent._t.weight}</label> <input type="number" id="weight" ref="weight" @@ -49,10 +49,10 @@ require("../popup/Modal.tag.html"); </Modal> <script type="es6"> - let session = require("../../js/Session"); - let Message = require("../../js/Message"); + import session from "../../js/Session"; + import voterListService from "../../js/VoterListService"; + this.installBundle(session, "voterList"); - let voterListService = require("../../js/VoterListService"); if (!this.opts.voterList) { this.opts.voterList = {}; diff --git a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMemberCard.tag.html b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMemberCard.tag.html index 70fbab89..ae286095 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMemberCard.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMemberCard.tag.html @@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -require("../components/Card.tag.html"); -require("./VoterListMemberEditModal.tag.html"); +import "../components/Card.tag.html"; +import "./VoterListMemberEditModal.tag.html"; <VoterListMemberCard> <Card name={opts.member.name} @@ -30,7 +30,7 @@ require("./VoterListMemberEditModal.tag.html"); <yield to="actions"> <a class="info" if={!parent.opts.form.creation && !parent.opts.form.model.closed && parent.opts.member.id && !parent.opts.member.voting} - title={parent.__.resendInvitation} + title={parent._t.resendInvitation} onclick={parent.resendInvitation}> <i class="fa fa-paper-plane"></i> </a> @@ -42,7 +42,7 @@ require("./VoterListMemberEditModal.tag.html"); <i if={parent.opts.member.voting} class="voting success fa fa-check" aria-hidden="true"></i> <i if={parent.opts.member.invalidEmail} class="voting error fa fa-times" - title={parent.__.invalidEmail} + title={parent._t.invalidEmail} aria-hidden="true"></i> </yield> </Card> @@ -51,9 +51,10 @@ require("./VoterListMemberEditModal.tag.html"); member={opts.member}/> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import voterListService from "../../js/VoterListService"; + this.installBundle(session, "voterList_member"); - let voterListService = require("../../js/VoterListService"); this.edit = () => { this.refs.editModal.open().then(() => { @@ -67,7 +68,7 @@ require("./VoterListMemberEditModal.tag.html"); }; this.delete = () => { - this.confirm(this.__.deleteMessage).then((confirm) => { + this.confirm(this._t.deleteMessage).then((confirm) => { if (confirm) { voterListService.deleteMember(this.opts.member); this.opts.onMemberChange(); @@ -77,7 +78,7 @@ require("./VoterListMemberEditModal.tag.html"); this.resendInvitation = () => { voterListService.resendInvitationMember(this.opts.member).then((result) => { - this.bus.trigger("message", result ? this.__.resendInvitation_success : this.__.resendInvitation_none, "info"); + this.bus.trigger("message", result ? this._t.resendInvitation_success : this._t.resendInvitation_none, "info"); }); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMemberEditModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMemberEditModal.tag.html index 4a709839..2cdf6b50 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMemberEditModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMemberEditModal.tag.html @@ -8,46 +8,46 @@ 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% --> -require("../popup/Modal.tag.html"); +import "../popup/Modal.tag.html"; <VoterListMemberEditModal> <Modal ref="modal" - header={opts.member.id ? __.edit : __.new} - label={__.save} + header={opts.member.id ? _t.edit : _t.new} + label={_t.save} type="success" onsubmit={save}> <div class="o-form-element"> - <label class="c-label" for="name">{parent.__.name}</label> + <label class="c-label" for="name">{parent._t.name}</label> <input type="text" id="name" ref="name" required class="c-field {c-field--error: parent.errors.email}" - placeholder={parent.__.name_placeholder} + placeholder={parent._t.name_placeholder} value={parent.opts.member.name}> </div> <div class="o-form-element"> - <label class="c-label" for="name">{parent.__.email}</label> + <label class="c-label" for="name">{parent._t.email}</label> <input type="email" id="email" ref="email" required class="c-field {c-field--error: parent.errors.email}" - placeholder={parent.__.email_placeholder} + placeholder={parent._t.email_placeholder} value={parent.opts.member.email}> </div> <div class="o-form-element"> - <label class="c-label" for="email">{parent.__.weight}</label> + <label class="c-label" for="email">{parent._t.weight}</label> <input type="number" id="weight" ref="weight" @@ -59,9 +59,9 @@ require("../popup/Modal.tag.html"); </Modal> <script type="es6"> - let session = require("../../js/Session"); + import session from "../../js/Session"; + import voterListService from "../../js/VoterListService"; this.installBundle(session, "voterList_member"); - let voterListService = require("../../js/VoterListService"); if (!this.opts.member) { this.opts.member = {}; diff --git a/pollen-ui-riot-js/webpack.config.js b/pollen-ui-riot-js/webpack.config.js index 9db6aca1..b8fdc241 100644 --- a/pollen-ui-riot-js/webpack.config.js +++ b/pollen-ui-riot-js/webpack.config.js @@ -1,6 +1,5 @@ /* eslint strict: 0 */ "use strict"; - var webpack = require("webpack"); var CopyWebpackPlugin = require("copy-webpack-plugin"); @@ -14,23 +13,8 @@ module.exports = { path: __dirname + "/target/dist/" }, - resolveLoader: { - alias: { - "riotjs-loader": require.resolve("./src/main/js/riotjs-loader") - } - }, - - devServer: { - historyApiFallback: { - rewrites: [ - {from: /./, to: "/index.html"} - ] - } - }, - plugins: [ - new webpack.ProvidePlugin({riot: "riot"}), new webpack.DefinePlugin({ POLLEN_VERSION: JSON.stringify(require("./package.json").version) }), @@ -55,22 +39,31 @@ module.exports = { ]) ], + devtool: "inline", + module: { rules: [ { enforce: "pre", test: /\.tag.html$/, exclude: /node_modules/, - loader: "riotjs-loader" + use: [{ + loader: "riot-tag-loader", + options: { + hot: true, + type: "es6" + } + }] }, { - test: /\.js$|\.tag.html$/, + test: /\.js$/, exclude: /node_modules/, - loader: "babel-loader" - }, - { - test: /\.json$/, - loader: "json-loader" + use: { + loader: "babel-loader", + options: { + presets: ["@babel/preset-env"] + } + } } ] } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.