-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Amiel Martin
committed
Jul 6, 2017
1 parent
9304244
commit 9ffbf6a
Showing
8 changed files
with
1,041 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
{{docs-navbar | ||
logo="ember" | ||
name="Data Url Templates" | ||
githubUrl="https://github.com/amiel/ember-data-url-templates" | ||
}} | ||
|
||
{{outlet}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{{#docs-viewer as |viewer|}} | ||
|
||
{{#viewer.nav as |nav|}} | ||
{{nav.item 'Home' 'docs.index'}} | ||
{{nav.item 'Quickstart' 'docs.quickstart'}} | ||
{{nav.item 'Patterns' 'docs.patterns'}} | ||
|
||
{{#nav.subnav as |nav|}} | ||
{{nav.item 'query and queryRecord' 'docs.cookbook.queries'}} | ||
{{nav.item 'relationships' 'docs.cookbook.relationships'}} | ||
{{/nav.subnav}} | ||
|
||
<!-- {{nav.item 'API Reference' 'docs.api'}} --> | ||
{{/viewer.nav}} | ||
|
||
{{#viewer.main}} | ||
<div class="docs-container docs__center docs-md"> | ||
<div class="docs-section"> | ||
{{outlet}} | ||
</div> | ||
</div> | ||
{{/viewer.main}} | ||
|
||
{{/docs-viewer}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Introduction | ||
|
||
Coming soon. | ||
|
||
## Installation | ||
|
||
```sh | ||
ember install ember-data-url-templates | ||
``` | ||
|
||
Then, import and mixin `ember-data-url-templates` to your adapter. For example, to use url templates in all adapters by default, | ||
|
||
```js | ||
// app/adapters/application.js | ||
|
||
import DS from 'ember-data'; | ||
import UrlTemplates from 'ember-data-url-templates'; | ||
|
||
export default DS.JSONAPIAdapter.extend(UrlTemplates, { | ||
}); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Coming soon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,44 @@ | ||
<h1>Welcome to ember-data-url-templates documentation</h1> | ||
{{docs-hero | ||
logo="ember" | ||
slim-heading='Data' | ||
strong-heading='Url Templates' | ||
byline='build urls with templates instead of defining buildURL' | ||
}} | ||
|
||
<p>Documentation coming soon</p> | ||
|
||
<p>{{link-to "See acceptance test examples" 'posts'}}</p> | ||
<div class='docs-container docs-md'> | ||
<section class='docs-section'> | ||
|
||
<aside>Looking for the quickstart? {{link-to 'Click here' 'docs.quickstart'}}.</aside> | ||
|
||
<p> | ||
ember-data-url-templates is an addon to allow building urls with url templates instead of defining <code>buildURL</code> as described in <a href="https://github.com/emberjs/rfcs/pull/4" target="_blank" rel="noopener">emberjs/rfcs#4</a>. | ||
</p> | ||
|
||
<pre> | ||
<code> | ||
// app/adapters/comment.js | ||
|
||
import Ember from "ember"; | ||
import DS from "ember-data"; | ||
import UrlTemplates from "ember-data-url-templates"; | ||
|
||
export default DS.RESTAdapter.extend(UrlTemplates, { | ||
urlTemplate: '{+host}/comments{/id}', | ||
queryUrlTemplate: '{+host}/comments{?query*}', | ||
createRecordUrlTemplate: '{+host}/users/{userId}/comments', | ||
|
||
session: Ember.inject.service(), | ||
|
||
urlSegments: { | ||
userId() { | ||
return this.get('session.userId'); | ||
} | ||
} | ||
}); | ||
</code> | ||
</pre> | ||
|
||
</section> | ||
</div> | ||
|
Oops, something went wrong.