Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

Commit 5c4c8bf

Browse files
committed
Added friendly-name attribute on element
1 parent 4972810 commit 5c4c8bf

16 files changed

+99
-46
lines changed

app.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,30 @@ myApp.controller('CtrlValidationService', ['$scope', '$translate', 'validationSe
8282
var myValidation = new validationService();
8383

8484
// you can create indepent call to the validation service
85+
// also below the multiple properties available
8586
myValidation.addValidator({
8687
elmName: 'input2',
88+
// friendlyName: $translate.instant('FIRST_NAME'),
8789
debounce: 3000,
8890
scope: $scope,
8991
rules: 'numeric_signed|required'
9092
});
9193

9294
// you can also chain validation service and add multiple validators at once
9395
// we optionally start by defining some global options. Note: each validator can overwrite individually these properties (ex.: validatorX can have a `debounce` different than the global set)
94-
// there is 2 ways to write a call... #1 with elementName & rules defined as 2 strings arguments ... #2 with 1 object as argument (with defined property names)
95-
// #1 .addValidtor('myElementName', 'myRules') ... #2 .addValidator({ elmName: 'inputX', rules: 'myRules'})
96+
// there is 2 ways to write a call... #1-2 with elementName & rules defined as 2 or 3 strings arguments ... #3 with 1 object as argument (with defined property names)
97+
// #1 .addValidtor('myElementName', 'myRules')
98+
// #2 .addValidtor('myElementName', 'myRules', 'myFriendlyName')
99+
// #3 .addValidator({ elmName: 'inputX', rules: 'myRules'})
96100
// the available object properties are the exact same set as the directive except that they are camelCase
97101
myValidation
98102
.setGlobalOptions({ debounce: 1500, scope: $scope })
99103
.addValidator('input3', 'float_signed|between_num:-0.6,99.5|required')
100104
.addValidator('input4', 'exact_len:4|regex:YYWW:=^(0[9]|1[0-9]|2[0-9]|3[0-9])(5[0-2]|[0-4][0-9])$:regex|required|integer')
101-
.addValidator('input5', 'email|required|min_len:6')
105+
.addValidator('input5', 'email|required|min_len:6', $translate.instant('INPUT5')) // 3rd argument being the Friendly name
102106
.addValidator('input6', 'url|required')
103107
.addValidator('input7', 'ipv4|required')
104-
.addValidator('input8', 'credit_card|required')
108+
.addValidator('input8', 'credit_card|required', $translate.instant('INPUT8')) // 3rd argument being the Friendly name
105109
.addValidator('input9', 'between_len:2,6|required')
106110
.addValidator('input10', 'date_iso|required')
107111
.addValidator('input11', 'date_us_long|required')

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-validation-ghiscoding",
3-
"version": "1.3.21",
3+
"version": "1.3.22",
44
"author": "Ghislain B.",
55
"description": "Angular-Validation Directive and Service (ghiscoding)",
66
"main": [

changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ Angular-Validation change logs
2222
1.3.18 (2015-04-19) Fixed issue #20 - Error messages shown on submit are non-understandable, this was fixed using $translate promises instead of $translate.instant(). Fixed a few error display on the validationSummary() and checkFormValidity(). Also merged #27 to add Russian
2323
1.3.19 (2015-04-20) Fixed issue #28 - unbind all 'blur' in cancelValidation() might affect other modules
2424
1.3.20 (2015-04-21) Fixed issue #26 - validation of forms inside ng-repeat (added sample `dynamicFormView` in `more-examples` folder). And again issue #28 - unbind all 'blur' in cancelValidation() might affect other modules.
25-
1.3.21 (2015-04-29) Moved the Alternate Text inside the $translate promise as well which removes possible delay of non-translated text appearing as alternate text (this will not affect regular text, or already translated text). Also cleanup code and made my Gulp task even more automated.
25+
1.3.21 (2015-04-29) Moved the Alternate Text inside the $translate promise as well which removes possible delay of non-translated text appearing as alternate text (this will not affect regular text, or already translated text). Also cleanup code and made my Gulp task even more automated.
26+
1.3.22 (2015-05-03) Added new element attribute of `friendly-name` which is used ONLY in the ValidationSummary, this friendly name is to give a better element name display, which also support translation, inside the ValidationSummary instead of just "input1" (see ValidationSummary for more details).

dist/angular-validation.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

locales/validation/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
"INPUT17": "Alphanumeric + Exactly(3) + Required -- debounce(5sec)",
7575
"INPUT18": "Date ISO (yyyy-mm-dd) -- minimum condition >= 2001-01-01 ",
7676
"INPUT19": "Date US SHORT (mm/dd/yy) -- between the dates 12/01/99 and 12/31/15",
77+
"FIRST_NAME": "First Name",
78+
"LAST_NAME": "Last Name",
7779
"SAVE": "Save",
7880
"SELECT1": "Required (select) -- validation with (blur) EVENT",
7981
"SHOW_VALIDATION_SUMMARY": "Show Validation Summary"

locales/validation/es.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
"INPUT17": "Alfanúmerico + Exactamente(3) + Requerido -- debounce(5sec)",
7575
"INPUT18": "Fecha formato ISO (yyyy-mm-dd) -- Condición minima >= 2001-01-01 ",
7676
"INPUT19": "Fecha formato US corto (mm/dd/yy) -- entre las fechas 12/01/99 and 12/31/15",
77+
"FIRST_NAME": "Nombre",
78+
"LAST_NAME": "Apellido",
7779
"SAVE": "Guardar",
7880
"SELECT1": "Requerido (select) -- validación con (blur) EVENT",
7981
"SHOW_VALIDATION_SUMMARY": "Mostar el resumén de validación"

locales/validation/fr.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
"INPUT17": "Alphanumérique + Exactement(3) + Requis -- debounce(5sec)",
7575
"INPUT18": "Date ISO (yyyy-mm-dd ) -- condition minimal >= 2001-01-01 ",
7676
"INPUT19": "Date US COURT (mm/dd/yy) -- entre les dates 12/01/99 et 12/31/15",
77+
"FIRST_NAME": "Prénom",
78+
"LAST_NAME": "Nom de Famille",
7779
"SAVE": "Sauvegarder",
7880
"SELECT1": "Requis (select) -- validation avec EVENT (blur)",
7981
"SHOW_VALIDATION_SUMMARY": "Afficher le Résumé de Validation"

locales/validation/no.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
"INPUT17": "Alfanumerisk + Nøyaktig(3) + Påkrevd -- debounce(5sec)",
7575
"INPUT18": "ISO dato (yyyy-mm-dd) -- minimum >= 2001-01-01 ",
7676
"INPUT19": "US SHORT dato (mm/dd/yy) -- mellom 12/01/99 og 12/31/15",
77+
"FIRST_NAME": "Fornavn",
78+
"LAST_NAME": "Etternavn",
7779
"SAVE": "Lagre",
7880
"SELECT1": "Påkrevd (select) -- validering med (blur) EVENT",
7981
"SHOW_VALIDATION_SUMMARY": "Vis Valideringsoppsummering"

locales/validation/ru.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
"INPUT17": "Буквенно-цифровой + Точно(3) + Обязательно -- debounce(5sec)",
7575
"INPUT18": "Дата ISO (yyyy-mm-dd) -- минимальное условие >= 2001-01-01 ",
7676
"INPUT19": "Дата US SHORT (mm/dd/yy) --между датами 12/01/99 и 12/31/15",
77+
"FIRST_NAME": "Имя",
78+
"LAST_NAME": "Фамилия",
7779
"SAVE": "Сохранить",
7880
"SELECT1": "Обязательное (select) -- проверка по СОБЫТИЮ (blur)",
7981
"SHOW_VALIDATION_SUMMARY": "Показать результаты проверки значений"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-validation-ghiscoding",
3-
"version": "1.3.21",
3+
"version": "1.3.22",
44
"author": "Ghislain B.",
55
"description": "Angular-Validation Directive and Service (ghiscoding)",
66
"main": "app.js",

0 commit comments

Comments
 (0)