Skip to content

Commit b9186af

Browse files
committed
Merge branch 'main' of github.com:matestack/matestack-ui-vuejs into main
2 parents bbb9460 + 62b68d1 commit b9186af

28 files changed

+840
-1137
lines changed

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Version 3.0.0 was released on the xth of February 2022. Click here for more [det
1818

1919
****
2020

21-
**If you want to see the docs for Version 2.1, click** [**here**](https://docs.matestack.io/matestack-ui-core/v/2.1/)**:**
21+
**If you want to see the docs for Version 2.1, click** [**here**](https://docs.matestack.io/matestack-ui-core/v/2.1/)
2222
{% endhint %}
2323

2424
## About

docs/SUMMARY.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66
## Getting started
77

88
* [Installation & Update](getting-started/installation-update.md)
9+
* [Hello World](getting-started/hello-world.md)
910

10-
## Built-in Reactivity composed in pure Ruby <a id="built-in-reactivity"></a>
11+
## Built-in Reactivity composed in pure Ruby <a href="#built-in-reactivity" id="built-in-reactivity"></a>
1112

12-
* [Overview](built-in-reactivity/overview.md)
1313
* [Emit Client Side Events](built-in-reactivity/emit-client-side-events/README.md)
1414
* [Onclick Component API](built-in-reactivity/emit-client-side-events/onclick-component-api.md)
1515
* [Toggle UI States](built-in-reactivity/toggle-ui-states/README.md)
1616
* [Toggle Component API](built-in-reactivity/toggle-ui-states/toggle-component-api.md)
1717
* [Call Server Side Actions](built-in-reactivity/call-server-side-actions/README.md)
18-
* [Overview](built-in-reactivity/call-server-side-actions/overview.md)
1918
* [Action Component API](built-in-reactivity/call-server-side-actions/action-component-api.md)
2019
* [Reactive Forms](built-in-reactivity/reactive-forms/README.md)
2120
* [Overview](built-in-reactivity/reactive-forms/overview.md)
@@ -32,22 +31,23 @@
3231
* [Cable Component API](built-in-reactivity/partial-ui-updates/cable-component-api.md)
3332
* [Isolated Component API](built-in-reactivity/partial-ui-updates/isolated-component-api.md)
3433
* [Page Transitions](built-in-reactivity/page-transitions/README.md)
35-
* [Overview](built-in-reactivity/page-transitions/overview.md)
3634
* [Transition Component API](built-in-reactivity/page-transitions/transition-component-api.md)
3735
* [Reactive Collections](built-in-reactivity/reactive-collections/README.md)
38-
* [Overview](built-in-reactivity/reactive-collections/overview.md)
39-
* [Collection Component API \[WIP\]](built-in-reactivity/reactive-collections/collection-component-api.md)
36+
* [Overview & API](built-in-reactivity/reactive-collections/overview.md)
4037

41-
## Custom Reactivity implemented in Vue.js <a id="custom-reactivity"></a>
38+
## Custom Reactivity implemented in Vue.js <a href="#custom-reactivity" id="custom-reactivity"></a>
4239

4340
* [Custom Vue.js Components](custom-reactivity/custom-vue-js-components.md)
44-
* [Third party Vue.js components \[WIP\]](custom-reactivity/third-party-vue.js-components-wip.md)
41+
* [Third party Vue.js Components \[WIP\]](custom-reactivity/third-party-vue.js-components-wip.md)
4542
* [Matestack's Vue.js APIs \[WIP\]](custom-reactivity/matestacks-vue.js-apis-wip.md)
4643
* [Matestack's Vuex API \[WIP\]](custom-reactivity/matestacks-vuex-api-wip.md)
44+
* [Third Party JavaScript \[WIP\]](custom-reactivity/third-party-javascript.md)
4745

4846
## Integrations
4947

5048
* [Action Cable](integrations/action-cable.md)
5149
* [Devise](integrations/devise.md)
52-
* [Authorization \[WIP\]](integrations/authorization.md)
53-
* [Third Party JavaScript \[WIP\]](integrations/third-party-javascript.md)
50+
51+
***
52+
53+
* [Contribute](contribute.md)

docs/built-in-reactivity/call-server-side-actions/action-component-api.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
# Action Component API
22

3-
The action component allows us to trigger async HTTP requests without Javascript!
3+
The `action` component can be used to trigger asynchronous requests from - for example a button click - or any other html markup. The `action` components let's us wrap content in an `a` tag which is then clickable and triggers a background request with the configured request method to the configured path and with optionally given params and let's us react to the server response. It can distinguish between a successful and failed response and emit events, transition somewhere, completely redirect and more. You only need to configure it according to your needs.
4+
5+
```ruby
6+
def response
7+
action action_config do
8+
button 'Delete'
9+
end
10+
end
11+
12+
def action_config
13+
{
14+
path: product_path(product),
15+
method: :delete,
16+
sucess: {
17+
transition: {
18+
follow_response: true
19+
}
20+
},
21+
failure: {
22+
emit: 'deletion-failed'
23+
}
24+
}
25+
end
26+
```
427

528
## Parameters
629

@@ -117,9 +140,9 @@ end
117140

118141
#### Perform redirect
119142

120-
We can also perform a redirect \(full page load\) that only gets triggered on success and also accepts further params:
143+
We can also perform a redirect (full page load) that only gets triggered on success and also accepts further params:
121144

122-
Please be aware, that emiting a event doen't have an effect when performing a redirect instead of a transition, as the whole page \(including the surrounding app\) gets reloaded!
145+
Please be aware, that emiting a event doen't have an effect when performing a redirect instead of a transition, as the whole page (including the surrounding app) gets reloaded!
123146

124147
```ruby
125148
success: {
@@ -341,7 +364,7 @@ class ExamplePage < Matestack::Ui::Page
341364
end
342365
```
343366

344-
Now, if we click the button and everything goes well \(which should be the case in this very simple example\), we can see the timestamp gets updated - nice!
367+
Now, if we click the button and everything goes well (which should be the case in this very simple example), we can see the timestamp gets updated - nice!
345368

346369
#### Async request with success event emit used for notification
347370

@@ -378,7 +401,7 @@ This time, after clicking our action component we should see the `good job!` mes
378401

379402
#### Async request with failure event emit used for notification
380403

381-
In the examples before, we always assumed \(and made sure\) that things went well. Now, it's the first time to use the `failure_action_test_path` to see how we can notify the user if things go wrong!
404+
In the examples before, we always assumed (and made sure) that things went well. Now, it's the first time to use the `failure_action_test_path` to see how we can notify the user if things go wrong!
382405

383406
```ruby
384407
class ExamplePage < Matestack::Ui::Page
@@ -532,6 +555,6 @@ end
532555

533556
Now, we can visit `localhost:3000/action_test/page1` and see our first page, shown by the `This is Page 1` text.
534557

535-
There, we can click on our button \(`Click me!`\) and get transfered to the second page. There, we see the `This is Page 2` text and, for 300ms, our `server says: good job!` success message. Neat!
558+
There, we can click on our button (`Click me!`) and get transfered to the second page. There, we see the `This is Page 2` text and, for 300ms, our `server says: good job!` success message. Neat!
536559

537-
If we click the button \(`Click me!`\) on the second page, we get the failure message \(`server says: something went wrong!`\) and get sent back to page 2, just as we wanted to.
560+
If we click the button (`Click me!`) on the second page, we get the failure message (`server says: something went wrong!`) and get sent back to page 2, just as we wanted to.

docs/built-in-reactivity/call-server-side-actions/overview.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

docs/built-in-reactivity/emit-client-side-events/onclick-component-api.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Onclick Component API
22

3-
The `onclick` component renders an `a` tag that emits a client side event when the user clicks on it. The onclick component takes a block in order to define its appearance.
3+
The `onclick` component renders an `a` tag that emits a client side event when the user clicks on it. Other component may react to this event.
4+
5+
The onclick component takes a block in order to define its appearance.
46

57
## Parameters
68

@@ -10,7 +12,7 @@ Takes a string or symbol. An event with this name will be emitted using the Mate
1012

1113
**You currently cannot pass in an event payload.**
1214

13-
### **&block - required**
15+
### **\&block - required**
1416

1517
The passed in block defines the appearance of the onclick component. The while UI structure defined in this block will be wrapped with an `a` tag
1618

@@ -26,10 +28,9 @@ class ExamplePage < Matestack::Ui::Page
2628
button "rerender something"
2729
end
2830
async rerender_on: "abc", id: "some-unique-id" do
29-
plain "Render this text when the 'abc' event is emitted"
31+
plain "Rerender this text when the 'abc' event is emitted #{DateTime.now}"
3032
end
3133
end
3234

3335
end
3436
```
35-

0 commit comments

Comments
 (0)