Forked from chrishowes/controllers.application.js
Last active
November 22, 2016 20:21
-
-
Save cepko33/89c15a309d570e6165899a295350f234 to your computer and use it in GitHub Desktop.
VisitDays
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'VisitDays' | |
}); |
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
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
firstName: attr("string"), | |
lastName: attr("string"), | |
visits: belongsTo("visit") | |
}); |
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
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
name: attr("string"), | |
users: hasMany("user"), | |
}); |
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
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('visit', { path: '/visit/:visit_id' }); | |
}); | |
export default Router; |
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
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
beforeModel() { | |
var user1 = this.store.createRecord("user", { | |
id: 1, | |
firstName: "First", | |
lastName: "User", | |
}); | |
var user2 = this.store.createRecord("user", { | |
id: 2, | |
firstName: "Second", | |
lastName: "User", | |
}); | |
var user3 = this.store.createRecord("user", { | |
id: 3, | |
firstName: "Third", | |
lastName: "User", | |
}); | |
var user4 = this.store.createRecord("user", { | |
id: 4, | |
firstName: "Fourth", | |
lastName: "User", | |
}); | |
var user5 = this.store.createRecord("user", { | |
id: 5, | |
firstName: "Fifth", | |
lastName: "User", | |
}); | |
var visit1 = this.store.createRecord("visit", { | |
id: 1, | |
name: "Morning Visit", | |
users: [user1, user2, user3] | |
}); | |
var visit2 = this.store.createRecord("visit", { | |
id: 2, | |
name: "Afternoon Visit", | |
users: [user4, user5] | |
}); | |
}, | |
model() { | |
return this.store.peekAll('visit'); | |
} | |
}); |
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
{ | |
"version": "0.10.5", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.8.0", | |
"ember-data": "2.8.0", | |
"ember-template-compiler": "2.8.0", | |
"ember-testing": "2.8.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment