Skip to content

Commit 7f0aadd

Browse files
jonasjabarigitbook-bot
authored andcommitted
GitBook: [#2] No subject
1 parent e945da0 commit 7f0aadd

24 files changed

+1357
-741
lines changed

docs/README.md

Lines changed: 725 additions & 6 deletions
Large diffs are not rendered by default.

docs/SUMMARY.md

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

88
* [Installation & Update](getting-started/installation-update.md)
9-
* [Concepts & Rails Integration](getting-started/concepts-rails-integration.md)
10-
11-
## HTML implemented in pure Ruby <a id="ui-in-pure-ruby"></a>
12-
13-
* [Overview](ui-in-pure-ruby/overview.md)
14-
* [HTML Rendering](ui-in-pure-ruby/html-rendering.md)
15-
* [Components](ui-in-pure-ruby/components/README.md)
16-
* [Component API](ui-in-pure-ruby/components/component-api.md)
17-
* [Component Registry](ui-in-pure-ruby/components/component-registry.md)
18-
* [Components on Rails views](ui-in-pure-ruby/components/components-on-rails-views.md)
19-
* [Pages](ui-in-pure-ruby/pages/README.md)
20-
* [Page API](ui-in-pure-ruby/pages/page-api-1.md)
21-
* [Rails Controller Integration](ui-in-pure-ruby/pages/rails-controller-integration.md)
22-
* [Apps](ui-in-pure-ruby/apps/README.md)
23-
* [App API](ui-in-pure-ruby/apps/app-api-1.md)
24-
* [Reusing Rails Views or Partials](ui-in-pure-ruby/reusing-views-or-partials.md)
9+
* [Hello World](getting-started/hello-world.md)
10+
11+
## HTML Rendering
12+
13+
* [Basic Rendering Mechanism](html-rendering/html-rendering.md)
14+
* [Integrating Action View Helpers](html-rendering/integrating-action-view-helpers.md)
15+
* [Integrating Rails Views or Partials](html-rendering/reusing-views-or-partials.md)
16+
17+
## Components
18+
19+
* [API](components/api.md)
20+
* [Usage on Rails Views](components/usage-on-rails-views.md)
21+
* [Usage on Matestack Pages](components/usage-on-matestack-pages.md)
22+
* [Usage on Matestack Layouts](components/usage-on-matestack-layouts.md)
23+
* [Usage in Isolation](components/usage-in-isolation.md)
24+
* [Registry](components/registry.md)
25+
26+
## Pages
27+
28+
* [API](pages/api.md)
29+
* [Rails Controller Integration](pages/rails-controller-integration.md)
30+
31+
## Layouts
32+
33+
* [API](layouts/api.md)
34+
* [Rails Controller Integration](layouts/rails-controller-integration.md)

docs/ui-in-pure-ruby/components/component-api.md renamed to docs/components/api.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Component API
2-
3-
See below for an overview of the various possibilities Matestack provides for component implementation:
1+
# API
42

53
## Response
64

@@ -402,7 +400,7 @@ end
402400

403401
### Text argument
404402

405-
Sometimes you just want to pass in a simple \(text\) argument rather than a hash with multiple keys:
403+
Sometimes you just want to pass in a simple (text) argument rather than a hash with multiple keys:
406404

407405
```ruby
408406
class ExamplePage < Matestack::Ui::Page
@@ -637,7 +635,7 @@ class Some::Component < Matestack::Ui::Component
637635
end
638636
```
639637

640-
Then, put both components \(note that some component uses other component so that's how they're both in here\) to use on the example page:
638+
Then, put both components (note that some component uses other component so that's how they're both in here) to use on the example page:
641639

642640
```ruby
643641
class ExamplePage < Matestack::Ui::Page
@@ -718,4 +716,3 @@ class ExamplePage < Matestack::Ui::Page
718716

719717
end
720718
```
721-

docs/components/registry.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Registry
2+
3+
By default, components can be called directly like `Components::Card.call(title: "foo", body: "bar")` which will return the desired HTML string.
4+
5+
If desired, you can create alias methods in order to avoid the class call syntax:
6+
7+
{% code title="app/matestack/components/registry.rb" %}
8+
```ruby
9+
module Components::Registry
10+
11+
def card(text=nil, options=nil, &block)
12+
Components::Card.call(text, options, &block)
13+
end
14+
15+
#...
16+
17+
end
18+
```
19+
{% endcode %}
20+
21+
which then allows you to call the card component like `card(title: "foo", body: "bar")` if the above shown module is included properly.
22+
23+
As this is just a plain Ruby module, you need to include it in all contexts you want to use the alias method. It might be a good idea to create your own `ApplicationPage`, `ApplicationComponent` and `ApplicationLayout` as base classes for your pages, components ans layouts. In there, you include your component registry module(s) only once and have access to the alias methods in all child classes:
24+
25+
{% code title="app/matestack/application_page.rb" %}
26+
```ruby
27+
class ApplicationPage < Matestack::Ui::Page
28+
29+
include Components::Registry
30+
31+
end
32+
```
33+
{% endcode %}
34+
35+
{% code title="app/matestack/application_component.rb" %}
36+
```ruby
37+
class ApplicationComponent < Matestack::Ui::Component
38+
39+
include Components::Registry
40+
41+
end
42+
```
43+
{% endcode %}
44+
45+
{% code title="app/matestack/application_layout.rb" %}
46+
```ruby
47+
class ApplicationLayout < Matestack::Ui::Layout
48+
49+
include Components::Registry
50+
51+
end
52+
```
53+
{% endcode %}

docs/components/usage-in-isolation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Usage in Isolation
2+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Usage on Matestack Layouts
2+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Usage on Matestack Pages
2+
File renamed without changes.

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

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

docs/getting-started/hello-world.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Hello World
2+
3+
WIP!

0 commit comments

Comments
 (0)