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

Commit 4972810

Browse files
committed
Moved the Alt Text inside the $translate promise
- Moved the Alternate Text inside the $translate promise - Made Gulp even more automated - Cleaned up code
1 parent b1a6095 commit 4972810

11 files changed

+190
-123
lines changed

bower.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"name": "ghiscoding.angular-validation",
3-
"version": "1.3.20",
4-
"authors": [
5-
"Ghislain B."
6-
],
7-
"description": "AngularJS Form Validation (Directive / Service)",
2+
"name": "angular-validation-ghiscoding",
3+
"version": "1.3.21",
4+
"author": "Ghislain B.",
5+
"description": "Angular-Validation Directive and Service (ghiscoding)",
86
"main": [
97
"locales/validation/en.js",
108
"locales/validation/fr.js",
@@ -35,6 +33,7 @@
3533
"index.html",
3634
"gulpfile.js",
3735
"vendors",
36+
"readme.md",
3837
"README.md"
3938
],
4039
"homepage": "http://github.com/ghiscoding/angular-validation",

changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ Angular-Validation change logs
2121
1.3.17 (2015-04-11) Added global `$scope.$validationOptions` object, for now only has the `debounce` property that be used by both the Directive and Service.
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
24-
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.
24+
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.

dist/angular-validation.min.js

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

gulpfile.js

Lines changed: 75 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,41 @@
1-
var gulp = require('gulp'),
2-
del = require('del'),
3-
concat = require('gulp-concat'),
4-
deporder = require('gulp-deporder'),
5-
header = require('gulp-header'),
6-
stripdebug = require('gulp-strip-debug'),
7-
uglify = require('gulp-uglify'),
8-
pkg = require('./package.json');
9-
10-
var
11-
src = 'src/',
12-
dest = 'dist',
13-
14-
d = new Date(),
15-
jsHeaderComment = [
1+
var argv = require('yargs').argv,
2+
gulp = require('gulp'),
3+
gulpif = require('gulp-if'),
4+
bump = require('gulp-bump'),
5+
del = require('del'),
6+
concat = require('gulp-concat'),
7+
order = require('gulp-order'),
8+
header = require('gulp-header'),
9+
replace = require('gulp-replace-task'),
10+
semver = require('semver'),
11+
stripdebug = require('gulp-strip-debug'),
12+
uglify = require('gulp-uglify');
13+
14+
var d = new Date()
15+
src = 'src/',
16+
dest = 'dist';
17+
18+
var jsHeaderComment = [
1619
'/**',
17-
' * ' + pkg.description,
18-
' * ' + pkg.homepage,
19-
' * @author: ' + pkg.author,
20-
' * @version: ' + pkg.version,
21-
' * @license: ' + pkg.license,
20+
' * <%= pkg.description %>',
21+
' * <%= pkg.homepage %>',
22+
' * @author: <%= pkg.author %>',
23+
' * @version: <%= version %>',
24+
' * @license: <%= pkg.license %>',
2225
' * @build: ' + d,
2326
' */',
2427
''].join('\n');
2528

29+
var readmeHeader = [
30+
'#Angular Validation (Directive / Service)',
31+
'`Version: <%= version %>`',
32+
''].join('\n');
33+
34+
var getPackageJson = function () {
35+
var fs = require('fs');
36+
return JSON.parse(fs.readFileSync('./package.json', 'utf8'));
37+
};
38+
2639
//-- Register tasks
2740
//------------------
2841

@@ -31,6 +44,13 @@ gulp.task('default', ['compress'], function() {
3144

3245
});
3346

47+
// bump the version of Bower and NPM packages
48+
gulp.task('bump', function () {
49+
return gulp.src(['./package.json', './bower.json'])
50+
.pipe(bump())
51+
.pipe(gulp.dest('./'));
52+
});
53+
3454
// clean the dist folder
3555
gulp.task('clean', function() {
3656
del([
@@ -40,11 +60,43 @@ gulp.task('clean', function() {
4060

4161
// compress our src folder
4262
gulp.task('compress', ['clean'], function() {
43-
// src/*.js into 1 single minified file
63+
var pkg = getPackageJson();
64+
var oldVersion = pkg.version;
65+
var newVersion = pkg.version;
66+
67+
// if user wants to bump revision at same time
68+
if(argv.bump == 1) {
69+
// bump version for js file header
70+
newVersion = semver.inc(oldVersion, 'patch');
71+
72+
// bump version in package & bower
73+
gulp.src(['./package.json', './bower.json'])
74+
.pipe(bump())
75+
.pipe(gulp.dest('./'));
76+
77+
// bump the README version as well
78+
gulp.src('README.md')
79+
.pipe(replace({
80+
patterns: [
81+
{
82+
match: /Version: [.0-9]+/g,
83+
replacement: 'Version: ' + newVersion
84+
}
85+
]
86+
}))
87+
.pipe(gulp.dest('./'));
88+
}
89+
90+
// compress (src/*.js) into 1 single minified file
4491
gulp.src(src + '*.js')
45-
.pipe(deporder())
92+
.pipe(order([
93+
'validation-directive.js',
94+
'validation-common.js',
95+
'validation-rules.js',
96+
'validation-service.js'
97+
]))
4698
.pipe(uglify())
4799
.pipe(concat('angular-validation.min.js'))
48-
.pipe(header(jsHeaderComment))
100+
.pipe(header(jsHeaderComment, { pkg : pkg, version: newVersion } ))
49101
.pipe(gulp.dest('dist'));
50102
});

more-examples/dynamicFormIndex.html

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,44 @@
11
<!DOCTYPE html>
22
<html ng-app="plunker">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>AngularJS Plunker</title>
6+
<script>document.write('<base href="' + document.location + '" />');</script>
7+
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
8+
<link rel="stylesheet" href="../style.css">
9+
</head>
310

4-
<head>
5-
<meta charset="utf-8" />
6-
<title>AngularJS Plunker</title>
7-
<script>document.write('<base href="' + document.location + '" />');</script>
8-
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
9-
<link rel="stylesheet" href="../style.css">
11+
<body ng-controller="MainCtrl">
12+
<h3>Form Validation (with dynamic form and fields)</h3>
13+
<tabset>
14+
<tab ng-repeat="tab in items" heading="{{tab.heading}}" >
15+
<form name="{{tab.formName}}" novalidate>
16+
<div ng-repeat="field in tab.fields" >
17+
<form-field></form-field>
18+
</div>
19+
</form>
20+
</tab>
21+
</tabset>
22+
<button name="validateForms" value="Validate" ng-click="validate()">Validate</button>
1023

11-
<!-- external librairies CDN -->
12-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
13-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js"></script>
14-
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.1.js"></script>
24+
<!-- external librairies CDN -->
25+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
26+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js"></script>
27+
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.1.js"></script>
1528

16-
<!-- angular-translate -->
17-
<!-- Visit Angular-Translate https://github.com/PascalPrecht/angular-translate -->
18-
<script src="../vendors/angular-translate/angular-translate.min.js"></script>
19-
<script src="../vendors/angular-translate/angular-translate-loader-static-files.min.js"></script>
29+
<!-- angular-translate -->
30+
<!-- Visit Angular-Translate https://github.com/PascalPrecht/angular-translate -->
31+
<script src="../vendors/angular-translate/angular-translate.min.js"></script>
32+
<script src="../vendors/angular-translate/angular-translate-loader-static-files.min.js"></script>
2033

21-
<!-- Angular-Validation -->
22-
<!--<script type="text/javascript" src="../dist/angular-validation.min.js"></script>-->
23-
<script type="text/javascript" src="../src/validation-directive.js"></script>
24-
<script type="text/javascript" src="../src/validation-service.js"></script>
25-
<script type="text/javascript" src="../src/validation-common.js"></script>
26-
<script type="text/javascript" src="../src/validation-rules.js"></script>
34+
<!-- Angular-Validation -->
35+
<script type="text/javascript" src="../dist/angular-validation.min.js"></script>
36+
<!--<script type="text/javascript" src="../src/validation-directive.js"></script>
37+
<script type="text/javascript" src="../src/validation-service.js"></script>
38+
<script type="text/javascript" src="../src/validation-common.js"></script>
39+
<script type="text/javascript" src="../src/validation-rules.js"></script>-->
2740

28-
<script src="dynamicForm-app.js"></script>
29-
</head>
30-
31-
<body ng-controller="MainCtrl">
32-
<h3>Form Validation (with dynamic form and fields)</h3>
33-
<tabset>
34-
<tab ng-repeat="tab in items" heading="{{tab.heading}}" >
35-
<form name="{{tab.formName}}" novalidate>
36-
<div ng-repeat="field in tab.fields" >
37-
<form-field></form-field>
38-
</div>
39-
</form>
40-
</tab>
41-
</tabset>
42-
<button name="validateForms" value="Validate" ng-click="validate()">Validate</button>
43-
</body>
41+
<script src="dynamicForm-app.js"></script>
42+
</body>
4443

4544
</html>

more-examples/dynamicInputIndex.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
</head>
99

1010
<body>
11-
<div>
1211
<div class="container" ng-controller="CtrlDynamic">
1312
<h1>Angular Validation</h1>
1413
<hr/>
@@ -32,11 +31,11 @@ <h3 class="text-info">{{'CHANGE_LANGUAGE' | translate}}</h3>
3231
<script src="../vendors/angular-translate/angular-translate-loader-static-files.min.js"></script>
3332

3433
<!-- Angular-Validation -->
35-
<!--<script type="text/javascript" src="../dist/angular-validation.min.js"></script>-->
36-
<script type="text/javascript" src="../src/validation-directive.js"></script>
34+
<script type="text/javascript" src="../dist/angular-validation.min.js"></script>
35+
<!--<script type="text/javascript" src="../src/validation-directive.js"></script>
3736
<script type="text/javascript" src="../src/validation-service.js"></script>
3837
<script type="text/javascript" src="../src/validation-common.js"></script>
39-
<script type="text/javascript" src="../src/validation-rules.js"></script>
38+
<script type="text/javascript" src="../src/validation-rules.js"></script>-->
4039

4140
<!-- my application -->
4241
<script type="text/javascript" src="dynamicInput-app.js"></script>

package.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
{
2-
"name": "ghiscoding.angular-validation",
3-
"version": "1.3.20",
2+
"name": "angular-validation-ghiscoding",
3+
"version": "1.3.21",
44
"author": "Ghislain B.",
55
"description": "Angular-Validation Directive and Service (ghiscoding)",
66
"main": "app.js",
7-
"dependencies": {
8-
"gulp": "^3.8.11"
9-
},
7+
"dependencies": {},
108
"devDependencies": {
119
"del": "^1.1.1",
1210
"gulp": "^3.8.11",
11+
"gulp-bump": "^0.3.0",
1312
"gulp-concat": "^2.5.2",
14-
"gulp-deporder": "^1.0.0",
13+
"gulp-if": "^1.2.5",
14+
"gulp-order": "^1.1.1",
1515
"gulp-header": "^1.2.2",
16+
"gulp-replace-task": "^0.1.0",
1617
"gulp-strip-debug": "^1.0.2",
17-
"gulp-uglify": "^1.1.0"
18+
"gulp-uglify": "^1.1.0",
19+
"semver": "^4.3.3",
20+
"yargs": "^3.8.0"
1821
},
1922
"scripts": {
2023
"test": "echo \"Error: no test specified\" && exit 1"
2124
},
2225
"keywords": [
23-
"angular-validation"
26+
"angular-validation",
27+
"angular-validation-ghiscoding"
2428
],
2529
"license": "MIT",
2630
"homepage": "http://github.com/ghiscoding/angular-validation",

readme.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Angular Validation (Directive / Service)
2-
`Version: 1.3.20`
2+
`Version: 1.3.21`
33
### Form validation after user inactivity of default 1sec. (customizable timeout)
44

55
Forms Validation with Angular made easy! Angular-Validation is an angular directive/service with locales (languages) with a very simple approach of defining your `validation=""` directly within your element to validate (input, textarea, etc) and...that's it!!! The directive/service will take care of the rest!
@@ -34,6 +34,7 @@ For more explanations, see the question answered: [Why Use It?](#whyuseit)
3434
* [Global Options](#global-options)
3535
* [Install (bower)](#install)
3636
* [Include it in your app project](#project)
37+
* [License](#license)
3738
* [Locales (languages)](#locales)
3839
* [Regular Expressions (Regex)](#regex)
3940
* [Requirements](#requirements)
@@ -470,6 +471,7 @@ Dependencies
470471
2. Bootstrap 3.x *is optional* (http://getbootstrap.com/)
471472
3. AngularJS 1.2.x / 1.3.x (https://angularjs.org/)
472473

474+
<a name="license"></a>
473475
License
474476
-----
475477
[MIT License](http://www.opensource.org/licenses/mit-license.php)
@@ -501,4 +503,5 @@ License
501503
* [1.3.17](https://github.com/ghiscoding/angular-validation/commit/1283a3a7435c70ec0a355ee273c8479e4b9bdabf) `2015-04-11` Added global `$scope.$validationOptions` [Global Options](#global-options) object, for now only has the `debounce` property that be used by both the Directive and Service.
502504
* [1.3.18](https://github.com/ghiscoding/angular-validation/commit/d4b55741b9635cd5654f44c58c146f4d86b2e512) `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
503505
* [1.3.19](https://github.com/ghiscoding/angular-validation/commit/2c1e5d62e434da24c122a5b575b5434e988ff254) `2015-04-20` Fixed issue #28 - unbind all 'blur' in cancelValidation() might affect other modules
504-
* [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.
506+
* [1.3.20](https://github.com/ghiscoding/angular-validation/commit/b1a609573d8059482813ec4131b6b8cb682318cd) `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.
507+
* [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.

0 commit comments

Comments
 (0)