Skip to content

Commit 9e3a317

Browse files
jonasjabarigitbook-bot
authored andcommitted
GitBook: [main] 2 pages and 6 assets modified
1 parent 0c92f1a commit 9e3a317

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

docs/getting-started/concepts-rails-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Based on a strong foundation - Rails with all the sugar you love - Matestack ena
1212

1313
**which leads to beautiful reactive web UI implemented in pure Ruby:**
1414

15-
![](../.gitbook/assets/image%20%289%29%20%281%29%20%283%29%20%281%29.png)
15+
![](../.gitbook/assets/image%20%289%29%20%281%29%20%283%29%20%283%29%20%281%29.png)
1616

1717
yielding following advantages:
1818

docs/getting-started/installation-update.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ end
3737

3838
Now, you are able to create UI components in pure Ruby and use them in your Rails views. Additionally you can substitute Rails views and layouts with Matestack pages and apps.
3939

40-
If you want to use Matestack's optional reactivity features in pure Ruby \(through dynamic Vue.js components such as `form` and `async` or dynamic page transitions\), please perform the next steps to set up the JavaScript parts via AssetPipeline or Webpacker.
40+
If you want to use Matestack's optional reactivity features in pure Ruby \(through dynamic Vue.js components such as `form` and `async` or dynamic page transitions\), please perform the next steps to set up the JavaScript parts via Webpacker.
4141

4242
{% hint style="info" %}
4343
Matestack's JavaScript is only required if you want to use reactive features. It's totally valid to just use the "static" features of Matestack, namely implement UI components, pages and apps in pure Ruby.
@@ -81,9 +81,36 @@ $ bin/webpack --watch
8181
When you update the `matestack-ui-core` Ruby gem, make sure to update the npm package as well!
8282
{% endhint %}
8383

84-
### Turbolinks
84+
### Usage with Turbolinks/Turbo
8585

86-
We recommend to \(remove/deactivate\)\([https://stackoverflow.com/a/38649595](https://stackoverflow.com/a/38649595)\) turbolinks within the scope you wish to build with Matestack, as there is no reason to use it alongside matestack-ui-core and there might appear some strange side effects. If you encounter strange page-transition/form-submit/action-submit behavior and have turbolinks activated, try to deactivate it first.
86+
If you want to use `matestack-ui-core` alongside with Turbolinks or Turbo, please add:
87+
88+
```bash
89+
yarn add vue-turbolinks
90+
```
91+
92+
And use following snippet instead:
93+
94+
```javascript
95+
import Vue from 'vue/dist/vue.esm'
96+
import Vuex from 'vuex'
97+
98+
import MatestackUiCore from 'matestack-ui-core'
99+
100+
import TurbolinksAdapter from 'vue-turbolinks'; // import vue-turbolinks
101+
Vue.use(TurbolinksAdapter); // tell Vue to use it
102+
103+
let matestackUiApp = undefined
104+
105+
// change the trigger event
106+
document.addEventListener('turbolinks:load', () => {
107+
matestackUiApp = new Vue({
108+
el: "#matestack-ui",
109+
store: MatestackUiCore.store
110+
})
111+
})
112+
113+
```
87114

88115
### Application layout adjustments
89116

0 commit comments

Comments
 (0)