|
a/compass-app/www/js/app.js |
|
b/compass-app/www/js/app.js |
1 |
App = Ember.Application.create();
|
1 |
App = Ember.Application.create();
|
|
|
2 |
|
|
|
3 |
App.ApplicationAdapter = DS.LSAdapter.extend({
|
|
|
4 |
namespace: 'compass'
|
|
|
5 |
});
|
|
|
6 |
|
|
|
7 |
App.Question = DS.Model.extend({
|
|
|
8 |
detail : DS.attr('string')
|
|
|
9 |
});
|
|
|
10 |
|
|
|
11 |
App.ApplicationRoute = Ember.Route.extend({
|
|
|
12 |
model: function() {
|
|
|
13 |
this.store.push('question', {
|
|
|
14 |
id: 1,
|
|
|
15 |
detail: "Did you create software?"
|
|
|
16 |
});
|
|
|
17 |
|
|
|
18 |
this.store.push('question', {
|
|
|
19 |
id: 2,
|
|
|
20 |
detail: "Do you hold copyright?"
|
|
|
21 |
});
|
|
|
22 |
|
|
|
23 |
this.store.push('question', {
|
|
|
24 |
id: 3,
|
|
|
25 |
detail: "Have you obtained rights to code?"
|
|
|
26 |
});
|
|
|
27 |
|
|
|
28 |
this.store.push('question', {
|
|
|
29 |
id: 4,
|
|
|
30 |
detail: "Do you want to share source?"
|
|
|
31 |
});
|
|
|
32 |
|
|
|
33 |
this.store.push('question', {
|
|
|
34 |
id: 5,
|
|
|
35 |
detail: "Should any future distributions be required to use your licence choice?"
|
|
|
36 |
});
|
|
|
37 |
|
|
|
38 |
this.store.push('question', {
|
|
|
39 |
id: 6,
|
|
|
40 |
detail: "May users distribute their extensions and modifications on a different licence ?"
|
|
|
41 |
});
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
}
|
|
|
45 |
});
|
2 |
|
46 |
|
3 |
App.Router.map(function() {
|
47 |
App.Router.map(function() {
|
4 |
// put your routes here
|
48 |
// put your routes here
|
|
|
49 |
|
|
|
50 |
this.route('questions', { path: '/' });
|
|
|
51 |
|
5 |
});
|
52 |
});
|
6 |
|
53 |
|
7 |
App.IndexRoute = Ember.Route.extend({
|
54 |
App.QuestionsRoute = Ember.Route.extend({
|
8 |
model: function() {
|
55 |
model: function() {
|
9 |
return ['red', 'yellow', 'blue'];
|
56 |
// the model is an Array of all of the posts
|
|
|
57 |
return this.store.find('question');
|
10 |
}
|
58 |
}
|
11 |
});
|
59 |
});
|