Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed May 7, 2024
1 parent 9125bbf commit e27f831
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,36 @@ response.unpoly.target = '.content'
response.unpoly.events = JsonOutput.toJson([["type": "itemDeleted"]])
```
If you use [`respond`](https://grails.github.io/legacy-grails-doc/4.0.0/ref/Controllers/respond.html) method introduced in Grails 2.3. The `respond` method tries to produce the most appropriate response for the requested content type (JSON, XML, HTML etc.)

You can [configure mime types](https://grails.github.io/legacy-grails-doc/4.0.0/guide/theWebLayer.html#contentNegotiation) for Unpoly.

Update the `app/conf/application.yml`:

```yml
grails:
mime:
types:
up: text/html
```
For example given the show action:
```groovy
def show(Book book) {
respond book
}
```

You could supply a `show.up.gsp` file to render the Unpoly:

```html
<div id="${book.id}">
<h1>${book.title}</h1>
<p>${book.description}</p>
</div>
```


## Development

Expand Down

0 comments on commit e27f831

Please sign in to comment.