4
4
<a href =' https://travis-ci.org/Exelord/ember-custom-actions ' ><img src =" https://travis-ci.org/Exelord/ember-custom-actions.svg?branch=master " alt =" Dependency Status " /></a > <a href =' https://gemnasium.com/github.com/Exelord/ember-custom-actions ' ><img src =" https://gemnasium.com/badges/github.com/Exelord/ember-custom-actions.svg " alt =" Dependency Status " /></a >
5
5
</p >
6
6
7
- The Ember add-on lets you call custom actions to your JSON API server.
8
- Ember Custom Actions is compatible with Ember 2.8 (and higher) applications..
7
+ Ember Custom Actions is a package for defining custom API actions, dedicated for Ember 2.8 (and higher) applications.
9
8
10
9
# Getting started
11
10
@@ -17,7 +16,7 @@ Ember Custom Actions is compatible with Ember 2.8 (and higher) applications..
17
16
18
17
### Configuration
19
18
20
- You can define your custom default options in your ` config/environment.js ` file.
19
+ You can define your custom options in your ` config/environment.js ` file
21
20
22
21
``` js
23
22
module .exports = function (environment ) {
@@ -34,41 +33,41 @@ module.exports = function(environment) {
34
33
}
35
34
```
36
35
#### ` type `
37
- default type of the request (GET, PUT, POST, DELETE, etc..)
36
+ Default type of the request (GET, PUT, POST, DELETE, etc..)
38
37
39
38
#### ` urlType `
40
- Base of the URL that's generated for the action. If not defined ` urlType ` is equal ` type ` ;
39
+ Base of the URL which is generated for the action. If not defined, ` urlType ` is equal to the ` type ` option
41
40
42
41
#### ` ajaxOptions `
43
- you can define your own ajax options for example headers.
42
+ Your own ajax options (e.g. headers)
44
43
45
44
#### ` pushToStore `
46
- if you want to push the recived data to the store mark this option to ` true ` and change your application ` JSONAPISerializer ` to:
45
+ If you want to push the received data to the store, set this option to ` true ` and change your application ` JSONAPISerializer ` to:
47
46
``` js
48
47
// app/serializers/application.js
49
48
50
49
import { JSONAPISerializer } from ' ember-custom-actions' ;
51
50
export default JSONAPISerializer .extend ();
52
51
```
53
52
#### ` normalizeOperation `
54
- You can define how your outgoing data should be serialized.
53
+ You can define how your outgoing data should be serialized
55
54
56
- Example of data:
55
+ Exemplary data:
57
56
``` js
58
57
{
59
58
firstParam: ' My Name' ,
60
59
colors: { rubyRed: 1 , blueFish: 3 }
61
60
}
62
61
```
63
- using a ` dasherize ` transformer our request data will be look like :
62
+ After using a ` dasherize ` transformer our request data will turn into :
64
63
65
64
``` js
66
65
{
67
66
first- param: ' My Name' ,
68
67
colors: { ruby- red: 1 , blue- fish: 3 }
69
68
}
70
69
```
71
- It's great for API with request data format restrictions.
70
+ It's great for API with request data format restrictions
72
71
73
72
** Available transformers:**
74
73
- camelize
@@ -82,9 +81,8 @@ It's great for API with request data format restrictions.
82
81
### Model actions
83
82
To define custom action like: ` posts/1/publish ` you can use
84
83
` modelAction(path, options) ` method with arguments:
85
-
86
- ` path ` - the url of the action in our case ` publish `
87
- ` options ` - optional parameter which will overwrite the configuration options
84
+ - ` path ` - the url of the action (in our case it's ` publish ` )
85
+ - ` options ` - optional parameter which will overwrite the configuration options
88
86
89
87
``` js
90
88
import Model from ' ember-data/model' ;
@@ -108,11 +106,10 @@ postToPublish.publish(payload).then((status) => {
108
106
```
109
107
110
108
### Resource actions
111
- To define custom action like: ` posts/favorites ` you can use
109
+ To a define custom action like: ` posts/favorites ` you can use
112
110
` resourceAction(path, options) ` method with arguments:
113
-
114
- ` path ` - the url of the action in our case ` favorites `
115
- ` options ` - optional parameter which will overwrite the configuration options
111
+ - ` path ` - the url of the action (in our case it's ` favorites ` )
112
+ - ` options ` - optional parameter which will overwrite the configuration options
116
113
117
114
``` js
118
115
import Model from ' ember-data/model' ;
@@ -141,7 +138,7 @@ emptyPost.favorites(payload).then((favoritesPosts) => {
141
138
142
139
## Installation
143
140
144
- * ` git clone <repository-url> ` this repository
141
+ * ` git clone https://github.com/Exelord/ember-custom-actions.git `
145
142
* ` cd ember-custom-actions `
146
143
* ` npm install `
147
144
* ` bower install `
@@ -168,7 +165,7 @@ Big thanks to Mike North and his [Project](https://github.com/mike-north/ember-a
168
165
169
166
## Contributing
170
167
171
- Bug reports and pull requests are welcome on GitHub at https://github.com/exelord/Monarchy . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
168
+ Bug reports and pull requests are welcome on GitHub at https://github.com/exelord/ember-custom-actions . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
172
169
173
170
## License
174
171
0 commit comments