Skip to content

Commit 5bd64e5

Browse files
committed
updated migration guide
1 parent ec61b5b commit 5bd64e5

File tree

1 file changed

+60
-24
lines changed

1 file changed

+60
-24
lines changed

docs/2.0.0-migration-guide-wip.md

Lines changed: 60 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class SomeApp < Matestack::Ui::Component
5151

5252
# new
5353
yield if block_given?
54-
end
54+
end
5555
end
5656

5757
end
@@ -69,7 +69,7 @@ class SomeApp < Matestack::Ui::App
6969

7070
# new
7171
some_partial(&block)
72-
end
72+
end
7373
end
7474

7575
def some_partial(&block)
@@ -79,17 +79,22 @@ class SomeApp < Matestack::Ui::App
7979
end
8080
```
8181

82-
#### loading state element
82+
#### Loading state element
8383

8484
TODO -&gt; example
8585

86+
#### Minimal app wrapping removed
87+
88+
- Until `1.5.0`, `matestack-ui-core` rendered a minimal app around pages without explicitly associated app
89+
- This behavior is removed in `2.0.0` -> a page will be rendered without any wrapping app until an app is explicitly associated
90+
8691
### Pages
8792

8893
**Controller instance variables**
8994

9095
* No more implicit controller instance variable access - &gt; inject like you would inject options into a component
9196

92-
TODO -&gt; example
97+
TODO -&gt; example
9398

9499
### Components
95100

@@ -135,7 +140,7 @@ class Components::SomeComponent < Matestack::Ui::Component
135140
# Do not define any slots as optional or required
136141

137142
def response
138-
# old
143+
# old
139144
# slot slots[:some_slot]
140145

141146
# new
@@ -217,9 +222,9 @@ class Components::SomeComponent < Matestack::Ui::Component
217222

218223
# old
219224
# def response
220-
# plain foo
225+
# plain foo
221226
# plain options[:foo]
222-
# plain bar
227+
# plain bar
223228
# plain options[:bar]
224229
# end
225230

@@ -246,7 +251,7 @@ class Components::SomeComponent < Matestack::Ui::Component
246251

247252
# new
248253
def response
249-
span class: context.bs_class
254+
span class: context.bs_class
250255
end
251256

252257
end
@@ -334,7 +339,7 @@ class Components::SomeComponent < Matestack::Ui::Component
334339
# yield_components
335340
# new
336341
yield if block_given?
337-
end
342+
end
338343
end
339344

340345
end
@@ -351,7 +356,7 @@ class Components::SomeComponent < Matestack::Ui::Component
351356
# yield_components
352357
# new
353358
some_partial(&block)
354-
end
359+
end
355360
end
356361

357362
def some_partial(&block)
@@ -442,7 +447,7 @@ end
442447
#### Vue.js props injection/usage
443448

444449
* No more implicit injection of all options into Vue.js component
445-
* No more `@component_config` instance variable and `setup` method
450+
* No more `@component_config` instance variable and `setup` method
446451
* Use explicit method in order to inject specific options into Vue.js components
447452

448453
TODO -&gt; change to `vue_props` as method name instead of `config`
@@ -472,7 +477,7 @@ class Components::SomeComponent < Matestack::Ui::VueJsComponent
472477
# end
473478

474479
# new
475-
def config
480+
def vue_props
476481
{}.tap do |props|
477482
props[:foo] = options[:foo]
478483
props[:bar] = context.bar
@@ -491,10 +496,10 @@ Vue.component('some-component', {
491496
return {};
492497
},
493498
mounted: function() {
494-
console.log(this.componentConfig["id"]) // undefined!
495-
console.log(this.componentConfig["foo"]) // hello
496-
console.log(this.componentConfig["bar"]) // world
497-
console.log(this.componentConfig["baz"]) // baz
499+
console.log(this.props["id"]) // undefined!
500+
console.log(this.props["foo"]) // hello
501+
console.log(this.props["bar"]) // world
502+
console.log(this.props["baz"]) // baz
498503
},
499504
});
500505
```
@@ -527,10 +532,10 @@ TODO
527532
```ruby
528533
class SomePage < Matestack::Ui::Page
529534

530-
# old
531-
# include Matestack::Ui::Core::Collection::Helper
535+
# old
536+
# include Matestack::Ui::VueJs::Components::Collection::Helper
532537

533-
# new
538+
# new
534539
include Matestack::Ui::VueJs::Components::Collection::Helper
535540

536541
end
@@ -543,10 +548,10 @@ end
543548
```ruby
544549
class SomePage < Matestack::Ui::Page
545550

546-
# old
547-
# include Matestack::Ui::Core::Collection::Helper
551+
# old
552+
# include Matestack::Ui::VueJs::Components::Collection::Helper
548553

549-
# new
554+
# new
550555
include Matestack::Ui::VueJs::Components::Collection::Helper
551556

552557
def response
@@ -582,12 +587,43 @@ end
582587

583588
### Onclick
584589

585-
TODO -&gt; change to span
590+
* changed from rendering a `div` as root element to a `a` tag in order to have an inline root element being consistent with `transition` and `action`
591+
592+
**this possibly breaks the appearance of your UI as we're switching from a block to an inline root element**
593+
594+
```ruby
595+
onclick emit: "hello" do
596+
button "Klick!"
597+
end
598+
```
599+
600+
will now render:
601+
602+
```html
603+
<a href="#" class="matestack-onclick-component-root">
604+
<button>Klick!</button>
605+
</a>
606+
```
607+
608+
instead of:
609+
610+
```html
611+
<div class="matestack-onclick-component-root">
612+
<button>Klick!</button>
613+
</div>
614+
```
615+
616+
You can keep the block style by simply applying following styles to your application:
617+
618+
```css
619+
.matestack-onclick-component-root{
620+
display: block;
621+
}
622+
```
586623

587624
### Link
588625

589626
TODO -&gt; example
590627

591628
* link is now calling the HTML `link` tag instead of rendering an `a` tag
592629
* use `a href: ...` or `a path: ...` instead
593-

0 commit comments

Comments
 (0)