Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
es6 and ember
import SortableListMixin from '../mixins/sortable-list';
import Part from '../models/part';
import Section from '../models/section';
var PartsController = Ember.ArrayController.extend(SortableListMixin, {
init: function(){
// ISSUE #1 - probably unrelated the es6 change.
// Shouldn't the content be set automatically to an array?
if (Ember.isNone(this.get('content'))){
this.set('content', [])
this.set('arrangedContent', [])
sortProperties: ['position'],
sortAscending : true,
actions: {
addAbove: function(part){
var newPart = Part.create()
// ISSUE #2:
// newPart.toString() == "(subclass of Ember.Model)"
// instead of "<app@model:part:>"
newPart.set('section', Section.create({_parent: newPart}))
newPart.set('_parent', this.get('content'))
this.addModelAbove(part, newPart)
export default PartsController;
import Course from './course';
import Section from './section';
var Part = Ember.Model.extend({
* Attributes
courseId: Ember.attr(),
position: Ember.attr(Number),
* Relationships
section: Ember.belongsTo(Section, {embedded: true, key: 'section'}),
course: Ember.belongsTo(Course, {key: 'courseId'}),
courseDate: function(){
return this.get('')
}.property('courseId', ''),
export default Part;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.