Skip to content

Commit 28f0d65

Browse files
committed
Docs - Add HAML alternatives to all ERB/HTML snippets
1 parent 7c3679c commit 28f0d65

File tree

50 files changed

+290
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+290
-4
lines changed

docs/controllers/async_block_controller.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ None
5151
<!-- tabs:end -->
5252
# How to Use
5353

54+
<!-- tabs:start -->
55+
## ** HTML **
5456
[example](../examples/async_block_controller.html ':include :type=code')
57+
## ** HAML **
58+
[example](../examples/async_block_controller.haml ':include :type=code')
59+
<!-- tabs:end -->
5560

5661
The controller will send out a fetch request, and on success will replace the block with the HTML content of the response.
5762

docs/controllers/auto_submit_form_controller.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,9 @@ Adds event listeners for `input` and `change` to all `<input>` `<textarea>` and
4848

4949
# How to Use
5050

51-
[example](../examples/auto_submit_form_controller.html ':include :type=code')
51+
<!-- tabs:start -->
52+
## ** HTML **
53+
[example](../examples/auto_submit_form_controller.html ':include :type=code')
54+
## ** HAML **
55+
[example](../examples/auto_submit_form_controller.haml ':include :type=code')
56+
<!-- tabs:end -->

docs/controllers/autosize_controller.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Only works for user-initiated changes, if changes are made in JavaScript and `in
4848
<!-- tabs:end -->
4949

5050
# How to Use
51-
51+
<!-- tabs:start -->
52+
## ** HTML **
5253
[example](../examples/autosize_controller.html ':include :type=code')
53-
54+
## ** HAML **
55+
[example](../examples/autosize_controller.haml ':include :type=code')
56+
<!-- tabs:end -->

docs/controllers/char_count_controller.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,9 @@ The controller will add an event listener for `input` to the `input` target.
5252

5353
# How to Use
5454

55+
<!-- tabs:start -->
56+
## ** HTML **
5557
[example](../examples/char_count_controller.html ':include :type=code')
58+
## ** HAML **
59+
[example](../examples/char_count_controller.haml ':include :type=code')
60+
<!-- tabs:end -->

docs/controllers/clipboard_controller.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ None
5959

6060
# How to Use
6161

62+
<!-- tabs:start -->
63+
## ** HTML **
6264
[example](../examples/clipboard_controller.html ':include :type=code')
65+
## ** HAML **
66+
[example](../examples/clipboard_controller.haml ':include :type=code')
67+
<!-- tabs:end -->
6368

6469

docs/controllers/confirm_navigation_controller.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ Shows a native confirmation dialogue using `window.onbeforeunload` to the user w
5050

5151
On pages where you apply changes that might get lost.
5252

53+
<!-- tabs:start -->
54+
## ** HTML **
5355
[example](../examples/confirm_navigation_controller.html ':include :type=code')
56+
## ** HAML **
57+
[example](../examples/confirm_navigation_controller.haml ':include :type=code')
58+
<!-- tabs:end -->
5459

5560
Or if you are applying changes using Javascript that might get lost, you could add the following to prevent lost changes.
5661

docs/controllers/detect_dirty_controller.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ Adds `input` and `change` event listeners to the attached input.
5050

5151
### Tracking dirty inputs
5252

53+
<!-- tabs:start -->
54+
## ** HTML **
5355
[example](../examples/detect_dirty_controller.html ':include :type=code')
56+
## ** HAML **
57+
[example](../examples/detect_dirty_controller.haml ':include :type=code')
58+
<!-- tabs:end -->
5459

5560
### Build behaviours / style around dirty attributes
5661

docs/controllers/disable_inputs_controller.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ None
4646

4747
Example - when creating an event that can have the `end_time` turned off with a boolean:
4848

49+
<!-- tabs:start -->
50+
## ** HTML **
4951
[example](../examples/disable_inputs_controller.html ':include :type=code')
52+
## ** HAML **
53+
[example](../examples/disable_inputs_controller.haml ':include :type=code')
54+
<!-- tabs:end -->
5055

5156
# See also
5257

docs/controllers/dismissable_controller.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ None
4848

4949
A good example is a flash message, rather than it staying on the page forever, allowing the user to dismiss it with a little 'X' in the corner.
5050

51+
<!-- tabs:start -->
52+
## ** HTML **
5153
[example](../examples/dismissable_controller.html ':include :type=code')
54+
## ** HAML **
55+
[example](../examples/dismissable_controller.haml ':include :type=code')
56+
<!-- tabs:end -->
5257

5358
# Browser support / Necessary polyfills
5459

docs/controllers/empty_dom_controller.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ None
5757

5858
The controller emits an event `dom:empty` when the container becomes empty, and `dom:not-empty` when it is no longer empty. Use those events to hook up other Stimulus actions. This particular example toggles the hide/show of a nice status message when the container is empty.
5959

60+
61+
<!-- tabs:start -->
62+
## ** HTML **
6063
[example](../examples/empty_dom_controller.html.erb ':include :type=code')
64+
## ** HAML **
65+
[example](../examples/empty_dom_controller.html.haml ':include :type=code')
66+
<!-- tabs:end -->
6167

6268
## Advanced Case
6369

@@ -66,4 +72,9 @@ You can scope what the controller watches for inside the container using a CSS s
6672
The selector you specify will be used to `querySelectorAll` the children/subtree of the container you attach the controller too, and fire the
6773
`dom:empty` and `dom:not-empty` events when the results of the query are empty/not empty.
6874

75+
<!-- tabs:start -->
76+
## ** HTML **
6977
[example](../examples/empty_dom_controller_advanced.html.erb ':include :type=code')
78+
## ** HAML **
79+
[example](../examples/empty_dom_controller_advanced.html.haml ':include :type=code')
80+
<!-- tabs:end -->

0 commit comments

Comments
 (0)