From e27f83135245902ab746bedea1f1a80b74cf0db5 Mon Sep 17 00:00:00 2001 From: Michael Yan Date: Tue, 7 May 2024 09:27:08 +0800 Subject: [PATCH] Update README --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 221734b..ab7ca3a 100644 --- a/README.md +++ b/README.md @@ -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 +
+

${book.title}

+

${book.description}

+
+``` + ## Development