Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start a documentation website using ember-cli-addon-docs #35

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions config/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* jshint node: true */

module.exports = function(deployTarget) {
var ENV = {
build: {}
// include other plugin configuration that applies to all deploy targets here
};

if (deployTarget === 'development') {
ENV.build.environment = 'development';
// configure other plugins for development deploy target here
}

if (deployTarget === 'staging') {
ENV.build.environment = 'production';
// configure other plugins for staging deploy target here
}

if (deployTarget === 'production') {
ENV.build.environment = 'production';
// configure other plugins for production deploy target here
}

// Note: if you need to build some configuration asynchronously, you can return
// a promise that resolves with the ENV object instead of returning the
// ENV object synchronously.
return ENV;
};
6 changes: 5 additions & 1 deletion config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
'use strict';

module.exports = function(/* environment, appConfig */) {
return { };
return {
'ember-cli-mirage': {
enabled: true, // always enable mirage, even in production
},
};
};
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
"ember-ajax": "^3.0.0",
"ember-chrome-devtools": "^0.1.1",
"ember-cli": "2.13.2",
"ember-cli-addon-docs": "https://github.com/ember-learn/ember-cli-addon-docs",
"ember-cli-dependency-checker": "^1.3.0",
"ember-cli-deploy": "^1.0.1",
"ember-cli-deploy-build": "^1.1.0",
"ember-cli-deploy-git": "^1.1.1",
"ember-cli-eslint": "^3.0.0",
"ember-cli-htmlbars": "^1.1.1",
"ember-cli-htmlbars-inline-precompile": "^0.4.0",
Expand All @@ -46,7 +50,7 @@
"loader.js": "^4.2.3"
},
"engines": {
"node": ">= 4"
"node": "^6.11.1"
},
"ember-addon": {
"configPath": "tests/dummy/config"
Expand Down
11 changes: 11 additions & 0 deletions tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ const Router = Ember.Router.extend({
});

Router.map(function() {
// Documentation
this.route('docs', function() {
this.route('quickstart');
this.route('patterns');
this.route('cookbook', function() {
this.route('queries');
this.route('relationships');
});
});

// Tests
this.route('posts');
this.route('post', { path: '/posts/:slug' });
});
Expand Down
6 changes: 6 additions & 0 deletions tests/dummy/app/templates/application.hbs
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}}
24 changes: 24 additions & 0 deletions tests/dummy/app/templates/docs.hbs
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}}
23 changes: 23 additions & 0 deletions tests/dummy/app/templates/docs/index.md
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, {
});
```


1 change: 1 addition & 0 deletions tests/dummy/app/templates/docs/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Coming soon
44 changes: 44 additions & 0 deletions tests/dummy/app/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{docs-hero
logo="ember-data"
slim-heading='URL'
strong-heading='Templates'
byline='build urls with templates instead of defining buildURL'
}}


<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>

12 changes: 2 additions & 10 deletions tests/dummy/mirage/scenarios/default.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
export default function(/* server */) {

/*
Seed your development database using your factories.
This data will not be loaded in your tests.

Make sure to define a factory for each model you want to create.
*/

// server.createList('post', 10);
export default function(server) {
server.createList('post', 10);
}
Loading