Skip to content

Instantly share code, notes, and snippets.

@bj-mcduck
Created August 15, 2014 13:53
Show Gist options
  • Save bj-mcduck/6c98e150ea61082442c6 to your computer and use it in GitHub Desktop.
Save bj-mcduck/6c98e150ea61082442c6 to your computer and use it in GitHub Desktop.
# Show action
App.DreamSymbolsShowController = Ember.ObjectController.extend
checkParent: (value)->
parent = @get 'model.parent'
value = value or 'name'
if parent
parent.get value
else
if value is 'name' then 'Dream Symbol' else 'Dream Symbols'
hasImage: (->
true if @get('model.image') != null
).property 'model.image'
sidebar: (->
siblingCount = @get 'model.siblings.length'
childrenCount = @get 'model.children.length'
true if ( siblingCount + childrenCount ) > 0
).property 'model.siblings', 'model.children'
kidsCount: (->
@get 'model.kids.length'
).property 'model.kids.length'
siblingsCount: (->
@get 'model.siblings.length'
).property 'model.siblings.length'
parentName: (->
checkParent()
).property 'model.parent.name'
pluralParentName: (->
checkParent 'pluralName'
).property 'model.parent.name'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment