Skip to content

Commit

Permalink
Обновление Parsley до версии 2.2.0-rc4
Browse files Browse the repository at this point in the history
  • Loading branch information
deniart committed Nov 21, 2015
1 parent d67c385 commit 09ee27d
Show file tree
Hide file tree
Showing 77 changed files with 2,597 additions and 1,929 deletions.
4 changes: 2 additions & 2 deletions frontend/components/field/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"vendor-chosen-order": "vendor/chosen-order/chosen.order.jquery.js",
"vendor-chosen-ajax": "vendor/ajax-chosen/lib/ajax-chosen.js",
"vendor-autocomplete": "vendor/jquery-autocomplete/dist/jquery.autocomplete.js",
"vendor-parsley": "vendor/parsley/dist/parsley.remote.js",
"vendor-parsley-ru": "vendor/parsley/i18n/ru.js",
"vendor-parsley": "vendor/parsley/dist/parsley.js",
"vendor-parsley-ru": "vendor/parsley/dist/i18n/ru.js",
"vendor-pikaday": "vendor/pikaday/pikaday.js",
"vendor-pikaday-jquery": "vendor/pikaday/pikaday.jquery.js",
"vendor-timepicker": "vendor/timepicker/jquery.timepicker.js",
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/field/js/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ window.ParsleyExtend = $.extend(window.ParsleyExtend, {
});

jQuery(document).ready(function ($) {
ParsleyValidator
Parsley
.addValidator('rangetags', function (value, requirement) {
var tag_count = value.replace(/ /g, "").match(/[^\s,]+(,|)/gi);
return tag_count && tag_count.length >= requirement[0] && tag_count.length <= requirement[1];
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/field/vendor/parsley/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"blacklist": ["useStrict"]
}
16 changes: 16 additions & 0 deletions frontend/components/field/vendor/parsley/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true;

[*]
# Ensure there's no lingering whitespace
trim_trailing_whitespace = true
# Ensure a newline at the end of each file
insert_final_newline = true

[*.js]
# Unix-style newlines
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = 2
10 changes: 10 additions & 0 deletions frontend/components/field/vendor/parsley/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parser": "babel-eslint",
"rules": {
"strict": 0
},
"env": {
"browser": true,
"node": true
}
}
35 changes: 31 additions & 4 deletions frontend/components/field/vendor/parsley/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
.DS_Store
node_modules/
bower_components/
doc/annotated-source/
npm-debug.log

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
node_modules
coverage
tmp

# Users Environment Variables
.lock-wscript

test/env/browserify_bundle.js
13 changes: 13 additions & 0 deletions frontend/components/field/vendor/parsley/.jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"preset": "google",
"maximumLineLength": null,
"requireCurlyBraces": false,
"validateQuoteMarks": false,
"disallowSpacesInsideParentheses": false,
"disallowSpacesInAnonymousFunctionExpression": false,
"disallowSpacesInFunctionDeclaration": false,
"disallowSpacesInFunctionExpression": false,
"disallowMultipleLineBreaks": false,
"disallowSpacesInCallExpression": false,
"esnext": true
}
17 changes: 7 additions & 10 deletions frontend/components/field/vendor/parsley/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
language: node_js

node_js:
- 0.10

before_script:
- npm install -g bower
- npm install -g browserify
- bower install
- browserify test/env/browserify.js > test/env/browserify_bundle.js

script: npm run-script test-all
- "0.10"
- "0.12"
sudo: false
script: "gulp coverage"
after_success:
- npm install -g codeclimate-test-reporter
- codeclimate-test-reporter < coverage/lcov.info
73 changes: 73 additions & 0 deletions frontend/components/field/vendor/parsley/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,78 @@
# Parsley 2.x changelog

## 2.2.0-rc3

- Merged both versions (remote and basic) of Parsley.
There is now a single version that is remote & promise aware.
- Converted src/ and test/ to ECMAScript 6.
Requires es5-shim if you need compatibility with IE8.

## 2.2.0-rc2

- A custom validator may specify an error message by simply passing it as first argument
when rejecting the promise. (#560)
- Submit buttons: data now included in the submitted form (#826) and
attribute 'formnovalidate' is supported (#972)
- Remote: use HTTP status code for what is considered valid or not (#956)
- Remote: allow RESTful urls where "{value}" is replaced by the value to validate
- Remote: add field:ajaxoptions to allow customizing of the ajax parameters (#894)
- pattern validator is now anchored, unless it looks like /pattern/flag (#861)
- Parsley won't try to correct names with caps (#990)

## 2.2.0-rc1

- Major validators refactor:
- Compatible with promises from the ground up. Previous API (e.g. `isValid`)
remains, but promise-aware API is now recommended (e.g. `whenValid`).
- New API to define custom validators (old API is still there but deprecated).
- Shorter code, removed dependency on `validators` lib.
- The `remote` validator is much smaller now, will probably be merged in the future.

- Deprecated `data-parsley-trim-value` in favour of new `whitespace` API
- Added `whitespace` API with two options: `trim` and `squish`

## 2.1.2

- fix custom triggers after a `reset()` (#926)
- fix documentation and generated dist files

## 2.1.1

- Bug fix for reentrant validations

## 2.1.0

- Event remodel
- New API `on` and `off` to register for events
- Global listeners added with `Parsley.on`
- Using the new API, event names no longer have their ".parsley" ending
- Compatibility with previous API is maintained, but `$.emit`, `$.listen`,
etc. are now deprecated (#899)

- New features
- New event 'form:submit' fired before a form is submitted.
- The `value` option can now be a function
- Parsley.version is now the best way to get the current version
- Additional translations

- Changes
- Error containers are created only the first time they are needed.
- [BC Break] `isValid()` field method now returns just a boolean, `[]` is no
more returned when field is optional and empty. `needsValidation()` appears
now to indicate if a valid field needed a validation.

- Bug fixes
- Speed optimization (#855)
- Eemote cache now cleared after form submission (#813)
- Event 'field:reset' now fired if a field is no longer validated (because it
is excluded, or removed) (#841)
- Support for validators with compound names by restoring full case
sensitivity to error messages. (#805)
- Fix conflict between different forms on the same page (#888)
- Handles checkbox names containing spaces (#881)
- Detects name conflicts between validators and regular options
- Compatible with jQuery.noConflict() (#859)

## 2.0.7

- support of html5 `maxlength` and `minlength` (#731)
Expand Down
1 change: 1 addition & 0 deletions frontend/components/field/vendor/parsley/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
parsleyjs.org
14 changes: 14 additions & 0 deletions frontend/components/field/vendor/parsley/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ Hi there.

Thanks for your interest in Parsley and your will to contribute. You're welcome!

First thing: make sure you are using the **latest official release**.

## Questions?

Please ask questions on [StackOverflow](http://stackoverflow.com/questions/ask) and be sure to include the `parsley.js` tag. Please **provide an example**, starting for example from [this jsfiddle](http://jsfiddle.net/marcandre/58vnaqur/)

## Issues?

If you believe you have found a bug in `parsley`, please **provide an example**, starting for example from [this jsfiddle](http://jsfiddle.net/marcandre/58vnaqur/).

This makes it possible for you to be sure you have isolated the issue to a minimal case. It also makes it much easier for us to understand your issue. Sometimes the issue is [completely different than what you would expect](https://github.com/guillaumepotier/Parsley.js/issues/711) and only an actual example can lead to a solution.

## Pull requests?

Here are a few simple rules you'll have to follow in order to ease code reviews,
discussions and PR merging.

Expand Down
27 changes: 16 additions & 11 deletions frontend/components/field/vendor/parsley/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ JavaScript form validation, without actually writing a single line of JavaScript

## Version

2.0.7
2.2.0-rc1

## Doc

See `index.html` and `doc/`

## Requirements

jQuery >= 1.8
[jQuery](https://jquery.com/) >= 1.8
[es5-shim](https://github.com/es-shims/es5-shim) if you want need to support IE8

## Contributing

See `CONTRIBUTING.md` file
See the [`CONTRIBUTING.md` file](https://github.com/guillaumepotier/Parsley.js/blob/master/CONTRIBUTING.md)

## Integrations

Expand All @@ -29,21 +30,25 @@ Some integrations are
* [Django](https://github.com/agiliq/django-parsley)
* [Rails](https://github.com/mekishizufu/parsley-rails)
* [OSSCDN by MaxCDN](http://osscdn.com/#/parsleyjs)
* [Drupal] (https://www.drupal.org/project/parsley)

## Install dev environment
## Install dev environment and running tests

First time: install `npm` and:
```
npm install -g gulp
```

then
```
npm install
npm install -g grunt-cli
npm install -g bower
grunt configure
gulp test
```

## Build `dist/`

```
grunt build
grunt build-all
gulp build
```

## Generate annotated documentation
Expand All @@ -60,9 +65,9 @@ grunt build-annotated-source

## Run tests

In the browser: open `test/index.html`
In the browser: run a server with `gulp test-browser`, then open `test/runner.html`

In the terminal: `npm test`
In the terminal: `gulp test`

## License

Expand Down
21 changes: 21 additions & 0 deletions frontend/components/field/vendor/parsley/UPGRADE-2.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# UPGRADE FROM 2.0.x to 2.1.0

## General

2.1.0 version introduced some minor BC Breaks. Here is the list:

### `isValid()` field methods returns boolean. If you had a test case like this:

```javascript
if ('object' === typeof $('#field').parsley().isValid() && !$('#field').parsley().isValid().length) {
// field is optional and empty, nor valid, nor invalid
}
```

becomes

```javascript
if ($('#field').parsley().isValid() && !$('#field').parsley().needsValidation()) {
// field is optional and empty, nor valid, nor invalid
}
```
9 changes: 5 additions & 4 deletions frontend/components/field/vendor/parsley/bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "parsleyjs",
"version": "2.0.7",
"ignore": [
"**/.*",
"build",
Expand All @@ -13,10 +12,12 @@
"Gruntfile.js",
"package.json"
],
"dependencies": {
"jquery": ">1.8"
},
"devDependencies": {
"jquery": "~1.10.0",
"validator.js": "~1.0.0",
"requirejs": "~2.1.0",
"expect.js": "*",
"mocha": "*",
"bootstrap": "~3.0.3",
"sinonjs": "~1.7.3",
"uwidget": "~0.0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// ParsleyConfig definition if not already set
window.ParsleyConfig = window.ParsleyConfig || {};
window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
// Validation errors messages for Parsley
// Load this after Parsley

// Define then the messages
window.ParsleyConfig.i18n.ar = $.extend(window.ParsleyConfig.i18n.ar || {}, {
Parsley.addMessages('ar', {
defaultMessage: "تأكد من صحة القيمة المدخل",
type: {
email: "تأكد من إدخال بريد الكتروني صحيح",
Expand All @@ -28,6 +26,4 @@ window.ParsleyConfig.i18n.ar = $.extend(window.ParsleyConfig.i18n.ar || {}, {
equalto: "تأكد من تطابق القيمتين المدخلة."
});

// If file is loaded after Parsley main file, auto-load locale
if ('undefined' !== typeof window.ParsleyValidator)
window.ParsleyValidator.addCatalog('ar', window.ParsleyConfig.i18n.ar, true);
Parsley.setLocale('ar');
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// ParsleyConfig definition if not already set
window.ParsleyConfig = window.ParsleyConfig || {};
window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
// Validation errors messages for Parsley
// Load this after Parsley

// Define then the messages
window.ParsleyConfig.i18n.bg = $.extend(window.ParsleyConfig.i18n.bg || {}, {
Parsley.addMessages('bg', {
defaultMessage: "Невалидна стойност.",
type: {
email: "Невалиден имейл адрес.",
Expand All @@ -28,6 +26,4 @@ window.ParsleyConfig.i18n.bg = $.extend(window.ParsleyConfig.i18n.bg || {}, {
equalto: "Стойността трябва да съвпада."
});

// If file is loaded after Parsley main file, auto-load locale
if ('undefined' !== typeof window.ParsleyValidator)
window.ParsleyValidator.addCatalog('bg', window.ParsleyConfig.i18n.bg, true);
Parsley.setLocale('bg');
Loading

0 comments on commit 09ee27d

Please sign in to comment.