Skip to content

Commit

Permalink
fix: rm duplicate handlebars helper doc
Browse files Browse the repository at this point in the history
  • Loading branch information
wonknu committed Oct 13, 2016
1 parent bad4249 commit d93bbfd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
31 changes: 0 additions & 31 deletions docs/abe-handlebars-helper.md

This file was deleted.

31 changes: 31 additions & 0 deletions docs/abe-handlebars-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,37 @@
## slugify
## ifCond
## ifIn
## raw

### usage (in template) :
```
{{{{raw}}}}
{{someVariable}}
{{{{/raw}}}}
```
someVariable won't compile server side only client side when injected on the iframe or when the iframe reload.

### Use case
This can be useful when working with inline script inside template, for exemple when a JS array is updated with abe-each.

template.html
```
{{#each objs}}
​ {{abe type='text' key='objs.item' desc='some item' visible='false' reload='true'}} // note that there is a reload attr
{{/each}}
{{{{raw}}}}
// objs = [{item: 1}, {item: 2}, {item: 3}]
var myArray = [
{{#each objs}}
{{item}},
{{/each objs}}
];
{{{{/raw}}}}
```

Everything inside raw bloc will be compiled client side and as the reload attribut is on the json that will be used is the one client side (not the one saved inside a json file)
when a new item will be added or removed from abe form *objs* inside the json file won't have changed but as it compiled on the client after reloading the iframe myArray will contains as much item as there is on objs each bloc

## truncate

Expand Down
2 changes: 1 addition & 1 deletion src/cli/cms/editor/handlebars/raw.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function raw(obj) {
return obj.fn(this).replace(/\[\[/g, '{{').replace(/\]\]/g, '}}');
return obj.fn(this).replace(/\[\[/g, '{{').replace(/\]\]/g, '}}')
}

0 comments on commit d93bbfd

Please sign in to comment.