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
Showing
67 changed files
with
104,716 additions
and
106 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
import DS from 'ember-data'; | ||
|
||
export default DS.RESTAdapter.extend({ | ||
}); |
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,18 @@ | ||
import Ember from 'ember'; | ||
import Resolver from 'ember/resolver'; | ||
import loadInitializers from 'ember/load-initializers'; | ||
import config from './config/environment'; | ||
|
||
var App; | ||
|
||
Ember.MODEL_FACTORY_INJECTIONS = true; | ||
|
||
App = Ember.Application.extend({ | ||
modulePrefix: config.modulePrefix, | ||
podModulePrefix: config.podModulePrefix, | ||
Resolver: Resolver | ||
}); | ||
|
||
loadInitializers(App, config.modulePrefix); | ||
|
||
export default App; |
Empty file.
Empty file.
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,7 @@ | ||
// app/controllers/blog-post.js | ||
|
||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend({ | ||
|
||
}); |
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,8 @@ | ||
// app/controllers/comments.js | ||
|
||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend({ | ||
postController: Ember.inject.controller('post'), | ||
post: Ember.computed.reads('postController.model') | ||
}); |
4 changes: 4 additions & 0 deletions
4
chapter5_controllers/app/controllers/managing-dependencies-route.js
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,4 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend({ | ||
}); |
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,4 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend({ | ||
}); |
Empty file.
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,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<title>Chapter5Controllers</title> | ||
<meta name="description" content=""> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
{{content-for 'head'}} | ||
|
||
<link rel="stylesheet" href="assets/vendor.css"> | ||
<link rel="stylesheet" href="assets/chapter5-controllers.css"> | ||
|
||
{{content-for 'head-footer'}} | ||
</head> | ||
<body> | ||
{{content-for 'body'}} | ||
|
||
<script src="assets/vendor.js"></script> | ||
<script src="assets/chapter5-controllers.js"></script> | ||
|
||
{{content-for 'body-footer'}} | ||
</body> | ||
</html> |
Empty file.
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,10 @@ | ||
// app/models/blog-post.js | ||
|
||
import DS from 'ember-data'; | ||
|
||
export default DS.Model.extend({ | ||
title: DS.attr('string'), // 属性默认为string类型,可以不指定 | ||
intro: DS.attr('string'), | ||
body: DS.attr('string'), | ||
author: DS.attr('string') | ||
}); |
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,8 @@ | ||
import DS from 'ember-data'; | ||
|
||
export default DS.Model.extend({ | ||
title: DS.attr('string'), // 属性默认为string类型,可以不指定 | ||
intro: DS.attr('string'), | ||
body: DS.attr('string'), | ||
author: DS.attr('string') | ||
}); |
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,17 @@ | ||
// router.js | ||
|
||
import Ember from 'ember'; | ||
import config from './config/environment'; | ||
|
||
var Router = Ember.Router.extend({ | ||
location: config.locationType | ||
}); | ||
|
||
Router.map(function() { | ||
this.route('blog-post'); | ||
this.route('post', { path: '/posts/:post_id' }, function() { | ||
this.route('comments'); | ||
}); | ||
}); | ||
|
||
export default Router; |
Empty file.
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,16 @@ | ||
// app/routes/blog-post.js | ||
|
||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({ | ||
model: function() { | ||
var blogPost = this.store.createRecord('blog-post', { | ||
title: 'DEFINING A COMPONENT', // 属性默认为string类型,可以不指定 | ||
intro: "Components must have at least one dash in their name. ", | ||
body: "Components must have at least one dash in their name. So blog-post is an acceptable name, and so is audio-player-controls, but post is not. This prevents clashes with current or future HTML element names, aligns Ember components with the W3C Custom Elements spec, and ensures Ember detects the components automatically.", | ||
author: 'ubuntuvim' | ||
}); | ||
// 直接返回一个model,或者你可以返回promises, | ||
return blogPost; | ||
} | ||
}); |
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,4 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({ | ||
}); |
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,4 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({ | ||
}); |
Empty file.
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,3 @@ | ||
<h2 id="title">Welcome to Ember</h2> | ||
|
||
{{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,19 @@ | ||
<!-- app/templates/blog-post.hbs --> | ||
|
||
<h1>{{model.title}}</h1> | ||
<h2>{{model.author}}</h2> | ||
|
||
<div class="intro"> | ||
{{model.intro}} | ||
</div> | ||
|
||
<hr> | ||
{{#if isExpanded}} | ||
<button {{action 'toggleBody'}}>hide body</button> | ||
<div class="body"> | ||
{{model.body}} | ||
</div> | ||
{{else}} | ||
<button {{action 'toggleBody'}}>Show body</button> | ||
{{/if}} | ||
|
Empty file.
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 @@ | ||
{{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,6 @@ | ||
<h1>Comments for {{post.title}}</h1> | ||
<ul> | ||
{{#each model as |comment|}} | ||
<li>{{comment.text}}</li> | ||
{{/each}} | ||
</ul> |
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,16 @@ | ||
{ | ||
"name": "chapter5-controllers", | ||
"dependencies": { | ||
"ember": "1.13.7", | ||
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", | ||
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3", | ||
"ember-data": "1.13.8", | ||
"ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5", | ||
"ember-qunit": "0.4.9", | ||
"ember-qunit-notifications": "0.0.7", | ||
"ember-resolver": "~0.1.18", | ||
"jquery": "^1.11.3", | ||
"loader.js": "ember-cli/loader.js#3.2.1", | ||
"qunit": "~1.18.0" | ||
} | ||
} |
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,47 @@ | ||
/* jshint node: true */ | ||
|
||
module.exports = function(environment) { | ||
var ENV = { | ||
modulePrefix: 'chapter5-controllers', | ||
environment: environment, | ||
baseURL: '/', | ||
locationType: 'auto', | ||
EmberENV: { | ||
FEATURES: { | ||
// Here you can enable experimental features on an ember canary build | ||
// e.g. 'with-controller': true | ||
} | ||
}, | ||
|
||
APP: { | ||
// Here you can pass flags/options to your application instance | ||
// when it is created | ||
} | ||
}; | ||
|
||
if (environment === 'development') { | ||
// ENV.APP.LOG_RESOLVER = true; | ||
// ENV.APP.LOG_ACTIVE_GENERATION = true; | ||
// ENV.APP.LOG_TRANSITIONS = true; | ||
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true; | ||
// ENV.APP.LOG_VIEW_LOOKUPS = true; | ||
} | ||
|
||
if (environment === 'test') { | ||
// Testem prefers this... | ||
ENV.baseURL = '/'; | ||
ENV.locationType = 'none'; | ||
|
||
// keep test console output quieter | ||
ENV.APP.LOG_ACTIVE_GENERATION = false; | ||
ENV.APP.LOG_VIEW_LOOKUPS = false; | ||
|
||
ENV.APP.rootElement = '#ember-testing'; | ||
} | ||
|
||
if (environment === 'production') { | ||
|
||
} | ||
|
||
return ENV; | ||
}; |
Empty file.
Oops, something went wrong.