summaryrefslogtreecommitdiffstats
path: root/packages/meteor-useraccounts-core/lib/templates_helpers/at_error.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-04-20 15:18:33 +0300
committerLauri Ojansivu <x@xet7.org>2019-04-20 15:18:33 +0300
commit73e265d8fd050ae3daa67472b4465a5c49d68910 (patch)
tree677b233934a43d8f873e24c794ce289d85e3a9b7 /packages/meteor-useraccounts-core/lib/templates_helpers/at_error.js
parent6117097a93bfb11c8bd4c87a23c44a50e22ceb87 (diff)
downloadwekan-73e265d8fd050ae3daa67472b4465a5c49d68910.tar.gz
wekan-73e265d8fd050ae3daa67472b4465a5c49d68910.tar.bz2
wekan-73e265d8fd050ae3daa67472b4465a5c49d68910.zip
Include to Wekan packages directory contents, so that meteor command would build all directly.
This also simplifies build scripts. Thanks to xet7 !
Diffstat (limited to 'packages/meteor-useraccounts-core/lib/templates_helpers/at_error.js')
-rw-r--r--packages/meteor-useraccounts-core/lib/templates_helpers/at_error.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/packages/meteor-useraccounts-core/lib/templates_helpers/at_error.js b/packages/meteor-useraccounts-core/lib/templates_helpers/at_error.js
new file mode 100644
index 00000000..5673dfe7
--- /dev/null
+++ b/packages/meteor-useraccounts-core/lib/templates_helpers/at_error.js
@@ -0,0 +1,26 @@
+AT.prototype.atErrorHelpers = {
+ singleError: function() {
+ var errors = AccountsTemplates.state.form.get("error");
+ return errors && errors.length === 1;
+ },
+ error: function() {
+ return AccountsTemplates.state.form.get("error");
+ },
+ errorText: function(){
+ var field, err;
+ if (this.field){
+ field = T9n.get(this.field, markIfMissing=false);
+ err = T9n.get(this.err, markIfMissing=false);
+ }
+ else
+ err = T9n.get(this.valueOf(), markIfMissing=false);
+
+ // Possibly removes initial prefix in case the key in not found inside t9n
+ if (err.substring(0, 15) === "error.accounts.")
+ err = err.substring(15);
+
+ if (field)
+ return field + ": " + err;
+ return err;
+ },
+};