Skip to content

Commit 2a7fa2e

Browse files
authored
Merge pull request #24 from offirgolan/update
Update dependencies, drop support for Ember < 3.16 and node < 10
2 parents b72c9c5 + 153afd2 commit 2a7fa2e

29 files changed

+7497
-2869
lines changed

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
root = true
66

7-
87
[*]
98
end_of_line = lf
109
charset = utf-8

.eslintignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# unconventional js
2+
/blueprints/*/files/
3+
/vendor/
4+
5+
# compiled output
6+
/dist/
7+
/tmp/
8+
9+
# dependencies
10+
/bower_components/
11+
/node_modules/
12+
13+
# misc
14+
/coverage/
15+
!.*
16+
17+
# ember-try
18+
/.node_modules.ember-try/
19+
/bower.json.ember-try
20+
/package.json.ember-try

.eslintrc.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
'use strict';
2+
13
module.exports = {
24
root: true,
5+
parser: 'babel-eslint',
36
parserOptions: {
4-
ecmaVersion: 2017,
5-
sourceType: 'module'
7+
ecmaVersion: 2018,
8+
sourceType: 'module',
9+
ecmaFeatures: {
10+
legacyDecorators: true
11+
}
612
},
713
plugins: [
814
'ember'
@@ -14,35 +20,35 @@ module.exports = {
1420
env: {
1521
browser: true
1622
},
17-
rules: {
18-
},
23+
rules: {},
1924
overrides: [
2025
// node files
2126
{
2227
files: [
28+
'.eslintrc.js',
29+
'.template-lintrc.js',
30+
'ember-cli-build.js',
2331
'index.js',
2432
'testem.js',
25-
'ember-cli-build.js',
33+
'blueprints/*/index.js',
2634
'config/**/*.js',
2735
'tests/dummy/config/**/*.js'
2836
],
2937
excludedFiles: [
30-
'app/**',
3138
'addon/**',
39+
'addon-test-support/**',
40+
'app/**',
3241
'tests/dummy/app/**'
3342
],
3443
parserOptions: {
35-
sourceType: 'script',
36-
ecmaVersion: 2015
44+
sourceType: 'script'
3745
},
3846
env: {
3947
browser: false,
4048
node: true
4149
},
4250
plugins: ['node'],
43-
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
44-
// add your custom rules and overrides for node files here
45-
})
51+
extends: ['plugin:node/recommended']
4652
}
4753
]
4854
};

.gitignore

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
# See https://help.github.com/ignore-files/ for more about ignoring files.
22

33
# compiled output
4-
/dist
5-
/tmp
4+
/dist/
5+
/tmp/
66

77
# dependencies
8-
/node_modules
9-
/bower_components
8+
/bower_components/
9+
/node_modules/
1010

1111
# misc
12+
/.env*
13+
/.pnp*
1214
/.sass-cache
1315
/connect.lock
14-
/coverage/*
16+
/coverage/
1517
/libpeerconnection.log
16-
npm-debug.log*
17-
yarn-error.log
18-
testem.log
18+
/npm-debug.log*
19+
/testem.log
20+
/yarn-error.log
1921

2022
# ember-try
21-
.node_modules.ember-try/
22-
bower.json.ember-try
23-
package.json.ember-try
23+
/.node_modules.ember-try/
24+
/bower.json.ember-try
25+
/package.json.ember-try

.npmignore

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
1-
/bower_components
1+
# compiled output
2+
/dist/
3+
/tmp/
4+
5+
# dependencies
6+
/bower_components/
7+
8+
# misc
9+
/.bowerrc
10+
/.editorconfig
11+
/.ember-cli
12+
/.env*
13+
/.eslintignore
14+
/.eslintrc.js
15+
/.git/
16+
/.gitignore
17+
/.template-lintrc.js
18+
/.travis.yml
19+
/.watchmanconfig
20+
/bower.json
221
/config/ember-try.js
3-
/dist
4-
/tests
5-
/tmp
6-
**/.gitkeep
7-
.bowerrc
8-
.editorconfig
9-
.ember-cli
10-
.eslintrc.js
11-
.gitignore
12-
.watchmanconfig
13-
.travis.yml
14-
bower.json
15-
ember-cli-build.js
16-
testem.js
22+
/CONTRIBUTING.md
23+
/ember-cli-build.js
24+
/testem.js
25+
/tests/
26+
/yarn.lock
27+
.gitkeep
1728

1829
# ember-try
19-
.node_modules.ember-try/
20-
bower.json.ember-try
21-
package.json.ember-try
30+
/.node_modules.ember-try/
31+
/bower.json.ember-try
32+
/package.json.ember-try

.template-lintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
module.exports = {
4+
extends: 'octane'
5+
};

.travis.yml

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ language: node_js
33
node_js:
44
# we recommend testing addons with the same minimum supported node version as Ember CLI
55
# so that your addon works for all apps
6-
- "4"
6+
- "10"
77

8-
sudo: false
9-
dist: trusty
8+
dist: xenial
109

1110
addons:
1211
chrome: stable
@@ -18,31 +17,45 @@ env:
1817
global:
1918
# See https://git.io/vdao3 for details.
2019
- JOBS=1
21-
matrix:
22-
# we recommend new addons test the current and previous LTS
23-
# as well as latest stable release (bonus points to beta/canary)
24-
- EMBER_TRY_SCENARIO=ember-lts-2.12
25-
- EMBER_TRY_SCENARIO=ember-lts-2.16
26-
- EMBER_TRY_SCENARIO=ember-lts-2.18
27-
- EMBER_TRY_SCENARIO=ember-release
28-
- EMBER_TRY_SCENARIO=ember-beta
29-
- EMBER_TRY_SCENARIO=ember-canary
30-
- EMBER_TRY_SCENARIO=ember-default
31-
32-
matrix:
20+
21+
branches:
22+
only:
23+
- master
24+
# npm version tags
25+
- /^v\d+\.\d+\.\d+/
26+
27+
jobs:
3328
fast_finish: true
3429
allow_failures:
3530
- env: EMBER_TRY_SCENARIO=ember-canary
3631

32+
include:
33+
# runs linting and tests with current locked deps
34+
- stage: "Tests"
35+
name: "Tests"
36+
script:
37+
- yarn lint
38+
- yarn test:ember
39+
40+
- stage: "Additional Tests"
41+
name: "Floating Dependencies"
42+
install:
43+
- yarn install --no-lockfile --non-interactive
44+
script:
45+
- yarn test:ember
46+
47+
# we recommend new addons test the current and previous LTS
48+
# as well as latest stable release (bonus points to beta/canary)
49+
- env: EMBER_TRY_SCENARIO=ember-lts-3.16
50+
- env: EMBER_TRY_SCENARIO=ember-release
51+
- env: EMBER_TRY_SCENARIO=ember-beta
52+
- env: EMBER_TRY_SCENARIO=ember-canary
53+
- env: EMBER_TRY_SCENARIO=ember-default-with-jquery
54+
- env: EMBER_TRY_SCENARIO=ember-classic
55+
3756
before_install:
3857
- curl -o- -L https://yarnpkg.com/install.sh | bash
3958
- export PATH=$HOME/.yarn/bin:$PATH
4059

41-
install:
42-
- yarn install --no-lockfile --non-interactive
43-
4460
script:
45-
- yarn lint:js
46-
# Usually, it's ok to finish the test scenario without reverting
47-
# to the addon's original dependency state, skipping "cleanup".
48-
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup
61+
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO

CONTRIBUTING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# How To Contribute
2+
3+
## Installation
4+
5+
* `git clone <repository-url>`
6+
* `cd ember-bootstrap-cp-validations`
7+
* `yarn install`
8+
9+
## Linting
10+
11+
* `yarn lint:hbs`
12+
* `yarn lint:js`
13+
* `yarn lint:js --fix`
14+
15+
## Running tests
16+
17+
* `ember test` – Runs the test suite on the current Ember version
18+
* `ember test --server` – Runs the test suite in "watch mode"
19+
* `ember try:each` – Runs the test suite against multiple Ember versions
20+
21+
## Running the dummy application
22+
23+
* `ember serve`
24+
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).
25+
26+
For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).

README.md

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,59 @@
1-
# ember-bootstrap-cp-validations
1+
ember-bootstrap-cp-validations
2+
==============================================================================
23

34
[![npm version](https://badge.fury.io/js/ember-bootstrap-cp-validations.svg)](http://badge.fury.io/js/ember-bootstrap-cp-validations)
45

5-
[Ember CP Validations](https://github.com/offirgolan/ember-cp-validations) support for [Ember Bootstrap](https://github.com/kaliber5/ember-bootstrap).
6+
This Ember addon adds support for validations based on [Ember CP Validations](https://github.com/offirgolan/ember-cp-validations) to [ember-bootstrap](https://www.ember-bootstrap.com) forms.
7+
This way your forms are only submitted when the underlying data is valid, otherwise the appropriate bootstrap error
8+
markup will be applied. See the [FormElement documentation](https://www.ember-bootstrap.com/api/classes/Components.FormElement.html) for
9+
further details.
610

7-
## Install
11+
Compatibility
12+
------------------------------------------------------------------------------
813

9-
```bash
14+
* Ember Bootstrap v3
15+
* Ember CP Validations v3
16+
* Ember.js v3.12 or above
17+
* Ember CLI v2.13 or above
18+
* Node.js v10 or above
19+
20+
21+
Installation
22+
------------------------------------------------------------------------------
23+
24+
```
1025
ember install ember-bootstrap-cp-validations
1126
```
1227

13-
## Usage
28+
You should have installed the ember-bootstrap and ember-cp-validations addons already. If not install them:
29+
30+
```
31+
ember install ember-bootstrap
32+
ember install ember-cp-validations
33+
```
34+
35+
Usage
36+
------------------------------------------------------------------------------
37+
38+
Define your model and its validations as described in [Ember CP Validations](https://github.com/offirgolan/ember-cp-validations).
39+
Then assign the model to your form:
40+
41+
```hbs
42+
<BsForm @model={{changeset this.user this.userValidations}} as |form|>
43+
<form.element @label="Username" @controlType="text" @property="username" />
44+
<form.element @label="Email" @controlType="email" @property="email" />
45+
<form.element @label="Password" @controlType="password" @property="password" />
46+
<form.submitButton>Submit</form.submitButton>
47+
</BsForm>
48+
```
49+
50+
Contributing
51+
------------------------------------------------------------------------------
1452

15-
Just install this addon and use ember-bootstrap as intended. This addon adds support for form validation (error and warning messages) of the following components
53+
See the [Contributing](CONTRIBUTING.md) guide for details.
1654

17-
- [bs-form](http://kaliber5.github.io/ember-bootstrap/api/classes/Components.Form.html)
18-
- [bs-form-element](http://kaliber5.github.io/ember-bootstrap/api/classes/Components.FormElement.html)
1955

20-
## Requirements
56+
License
57+
------------------------------------------------------------------------------
2158

22-
This addon needs ember-bootstrap starting at 1.0.0. For warning messages you will need at least ember-cp-validations 3.0.
59+
This project is licensed under the [MIT License](LICENSE.md).

addon/components/bs-form/element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default BsFormElement.extend({
2020
required: and('notDisabled', '_attrValidations.options.presence.presence', '_presenceEnabled'),
2121

2222
setupValidations() {
23-
defineProperty(this, '_attrValidations', readOnly(`model.validations.attrs.${this.get('property')}`));
23+
defineProperty(this, '_attrValidations', readOnly(`model.validations.attrs.${this.property}`));
2424
defineProperty(this, 'errors', readOnly('_attrValidations.messages'));
2525
defineProperty(this, 'warnings', readOnly('_attrValidations.warningMessages'));
2626
}

0 commit comments

Comments
 (0)