Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fraddski committed Nov 28, 2016
1 parent cf7ed7f commit 1d0c1d5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions behaviors/magic-button.md
Expand Up @@ -7,6 +7,7 @@ Append a magic button to an input.
* **field** _(optional)_ a field to grab the value from
* **component** _(optional)_ a name of a component to grab the component ref from
* **transform** _(optional)_ a transform to apply to the grabbed value
* **transformArg** _(optional)_ an argument to pass through to the transform
* **url** _(optional)_ to get data from
* **property** _(optional)_ to get from the returned data
* **moreMagic** _(optional)_ to run the returned value through more transforms, api calls, etc
Expand All @@ -17,6 +18,7 @@ Magic buttons are extremely powerful, but can be a little confusing to configure

1. specify a `field` or `component`. The button will grab the value or ref, respectively
2. specify a `transform`. Transforms are useful when doing api calls with that data
2. specify a `transformArg` if you need to send more information to the transform.
3. specify a `url` to do the api call against. It will do a GET request to `url + transformed data`
4. specify a `property` to grab from the result of that api call. You can use `_.get()` syntax, e.g. `foo.bar[0].baz`
5. add `moreMagic` if you need to do anything else to the returned data
Expand Down Expand Up @@ -65,4 +67,12 @@ moreMagic:
property: metadata.caption
```

### (ノ◕ヮ◕)ノ*:・゚✧ "grab the show name and use it to automatically format an image url"

```yaml
field: showName
transform: formatUrl
transformArg: [base image url]/recaps-$DATAFIELD.png ($DATAFIELD is the placeholder in our formatUrl transform)
```

☆.。.:*・°☆.。.:*・°☆.。.:*・°☆.。.:*・°☆

0 comments on commit 1d0c1d5

Please sign in to comment.