Last active
October 29, 2015 12:04
-
-
Save ryanto/a3ae9cc8119ca0f2f235 to your computer and use it in GitHub Desktop.
Declarative CPs
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.Component.extend({ | |
channelTalk: null, | |
classNames: 'Channel-table-row', | |
channel: Ember.computed.readOnly('channelTalk.channel'), | |
talk: Ember.computed.readOnly('channelTalk.talk'), | |
confirmRemoveChannelTalkAction: "confirmRemoveChannelTalk", | |
hasTalkMedia: Ember.computed.bool('talk.media'), | |
hasTalkContext: Ember.computed.bool('talk.talkContext'), | |
primaryPhoto: Ember.computed.readOnly('talk.primaryTalkPhoto'), | |
hasPrimaryPhoto: Ember.computed.bool('talk.primaryTalkPhoto'), | |
expectedAspectRatios: Ember.computed.readOnly('channel.aspectRatios'), | |
photoSizes: Ember.computed.readOnly('primaryPhoto.photoSizes'), | |
photoSizeAspectRatios: Ember.computed.mapBy('photoSizes', 'apsectRatio'), | |
missingAspectRatios: Ember.computed.setDiff( | |
'expectedAspectRatios', | |
'photoSizeAspectRatios' | |
), | |
hasAllAspectRatios: Ember.computed.equal('missingAspectRatios.length', 0), | |
speakers: Ember.computed.readOnly('talk.speakers'), | |
symfonySpeakers: Ember.computed.filterBy('speakers', 'isSymfonySpeaker'), | |
nonSymfonySpeakers: Ember.computed.setDiff('speakers', 'symfonySpeakers'), | |
hasAllSymfonySpeakers: Ember.computed.equal('nonSymfonySpeakers.length', 0), | |
canPublishTalk: Ember.computed.and( | |
'hasTalkMedia', | |
'hasTalkContext', | |
'hasPrimaryPhoto', | |
'hasAllAspectRatios', | |
'hasAllSymfonySpeakers' | |
), | |
cannotPublishTalk: Ember.computed.not('canPublishTalk'), | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment