Skip to content

Instantly share code, notes, and snippets.

@svasva
Created November 13, 2013 19:57
Show Gist options
  • Save svasva/7455342 to your computer and use it in GitHub Desktop.
Save svasva/7455342 to your computer and use it in GitHub Desktop.
Cx.User = DS.Model.extend
email: DS.attr('string')
nickname: DS.attr('string')
createdAt: DS.attr('date')
notifications: DS.hasMany('notification', {async: true})
Cx.Notification = DS.Model.extend
user: DS.belongsTo('user')
title: DS.attr('string')
body: DS.attr('string')
created_at: DS.attr('date')
updated_at: DS.attr('date')
ack: DS.attr('boolean')
Cx.NotificationsBoxComponent = Ember.Component.extend
ctrl: Ember.ArrayController.create
sortProperties: ['created_at']
sortAscending: false
sortedItems: (->
@ctrl.set('content', @get('user.notifications.content'))
@ctrl.get('arrangedContent')
).property('user.notifications.@each')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment