Skip to content

Commit

Permalink
Use helper expressions for switch/case
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Dec 14, 2017
1 parent a9cb0a2 commit 808159a
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions docs/features.md
Expand Up @@ -944,11 +944,11 @@ DoneJS application [routes](https://canjs.com/doc/can-route.html) map URL patter
This architecture simplifies routes so that they can be managed entirely in simple data bound templates, like the following example:

```html
{{#switch(page)}}
{{#case("home")}}
{{#switch page}}
{{#case "home"}}
<myapp-home></myapp-home>
{{/case}}
{{#case("users")}}
{{#case "users"}}
{{#if(slug)}}
<myapp-user-detail userId:bind="slug"></myapp-user-detail>
{{else}}
Expand Down
4 changes: 2 additions & 2 deletions guides/guide/steps/4-bootstrap/index.stache
Expand Up @@ -19,8 +19,8 @@
</div>
</div>

{{#switch(env.NODE_ENV)}}
{{#case("production")}}
{{#switch env.NODE_ENV}}
{{#case "production"}}
<script src="{{joinBase('steal.production.js')}}"></script>
{{/case}}
{{#default}}
Expand Down
4 changes: 2 additions & 2 deletions guides/guide/steps/7-navigate/index.stache
Expand Up @@ -31,8 +31,8 @@
</div>
</div>

{{#switch(env.NODE_ENV)}}
{{#case("production")}}
{{#switch env.NODE_ENV}}
{{#case "production"}}
<script src="{{joinBase('steal.production.js')}}"></script>
{{/case}}
{{#default}}
Expand Down
4 changes: 2 additions & 2 deletions guides/place-my-order/steps/additional/addition.stache
@@ -1,7 +1,7 @@
{{#case("restaurants")}}
{{#if(slug)}}
{{#switch(action)}}
{{#case('order')}}
{{#switch action}}
{{#case 'order'}}
<can-import from="place-my-order/order/new/"
can-tag="pmo-loading">
<pmo-order-new slug:from="slug"/>
Expand Down
16 changes: 8 additions & 8 deletions guides/place-my-order/steps/additional/index.stache
Expand Up @@ -12,17 +12,17 @@
<can-import from="place-my-order/header.component" />
<pmo-header page="{page}"></pmo-header>

{{#switch(page)}}
{{#case("home")}}
{{#switch page}}
{{#case "home"}}
<can-import from="place-my-order/home.component"
can-tag="pmo-loading">
<pmo-home></pmo-home>
</can-import>
{{/case}}
{{#case("restaurants")}}
{{#case "restaurants"}}
{{#if(slug)}}
{{#switch(action)}}
{{#case('order')}}
{{#switch action}}
{{#case 'order'}}
<can-import from="place-my-order/order/new/"
can-tag="pmo-loading">
<pmo-order-new slug:bind="slug"></pmo-order-new>
Expand All @@ -43,16 +43,16 @@
</can-import>
{{/if}}
{{/case}}
{{#case("order-history")}}
{{#case "order-history"}}
<can-import from="place-my-order/order/history.component"
can-tag="pmo-loading">
<pmo-order-history></pmo-order-history>
</can-import>
{{/case}}
{{/switch}}

{{#switch(env.NODE_ENV)}}
{{#case("production")}}
{{#switch env.NODE_ENV}}
{{#case "production"}}
<script
src="{{joinBase('steal.production.js')}}">
</script>
Expand Down
4 changes: 2 additions & 2 deletions guides/place-my-order/steps/loading-assets/index.stache
Expand Up @@ -10,8 +10,8 @@

<h1>{{message}}</h1>

{{#switch(env.NODE_ENV)}}
{{#case("production")}}
{{#switch env.NODE_ENV}}
{{#case "production"}}
<script src="{{joinBase('steal.production.js')}}"></script>
{{/case}}
{{#default}}
Expand Down
12 changes: 6 additions & 6 deletions guides/place-my-order/steps/switch-between/index.stache
Expand Up @@ -12,29 +12,29 @@
<can-import from="place-my-order/header.component" />
<pmo-header page:from="page"/>

{{#switch(page)}}
{{#case("home")}}
{{#switch page}}
{{#case "home"}}
<can-import from="place-my-order/home.component"
can-tag="pmo-loading">
<pmo-home/>
</can-import>
{{/case}}
{{#case("restaurants")}}
{{#case "restaurants"}}
<can-import from="place-my-order/restaurant/list/"
can-tag="pmo-loading">
<pmo-restaurant-list/>
</can-import>
{{/case}}
{{#case("order-history")}}
{{#case "order-history"}}
<can-import from="place-my-order/order/history.component"
can-tag="pmo-loading">
<pmo-order-history/>
</can-import>
{{/case}}
{{/switch}}

{{#switch(env.NODE_ENV)}}
{{#case("production")}}
{{#switch env.NODE_ENV}}
{{#case "production"}}
<script
src="{{joinBase('steal.production.js')}}">
</script>
Expand Down

0 comments on commit 808159a

Please sign in to comment.