Commit 66c356f 1 parent f045981 commit 66c356f Copy full SHA for 66c356f
File tree 1 file changed +54
-1
lines changed
1 file changed +54
-1
lines changed Original file line number Diff line number Diff line change 1
- # adonis-unpoly
1
+ # Unpoly for AdonisJS 6
2
+
3
+ Easily add support for the server protocol expected by [ Unpoly] ( http://unpoly.com ) .
4
+
5
+ ## Installation
6
+
7
+
8
+ ``` bash
9
+ node ace add @jrmc/adonis-unpoly
10
+ ```
11
+
12
+ Or
13
+
14
+ ``` bash
15
+ npm install @jrmc/adonis-unpoly
16
+ node ace configure @jrmc/adonis-unpoly
17
+ ```
18
+
19
+ ## Usage in controllers
20
+
21
+ Sample close drawer or redirect
22
+
23
+ ``` javascript
24
+ async store ({ response, i18n, up }: HttpContext ) {
25
+ // ...
26
+
27
+ session .flash (' notification' , {
28
+ type: ' success' ,
29
+ message: i18n .formatMessage (' form.success.user.create' ),
30
+ })
31
+
32
+ if (up .isDrawer ()) {
33
+ up .setDismissLayer ()
34
+ } else {
35
+ response .redirect ().toRoute (' admin.users.index' )
36
+ }
37
+ }
38
+ ```
39
+
40
+ ## Usage in edge view
41
+
42
+ Sample back button
43
+
44
+ ``` edge
45
+ @if(up.isDrawer())
46
+ <button up-dismiss>
47
+ @svg('tabler:arrow-left')
48
+ <button>
49
+ @else
50
+ <a href="{{ $props.href }}">
51
+ @svg('tabler:arrow-left')
52
+ </a>
53
+ @end
54
+ ```
You can’t perform that action at this time.
0 commit comments