Last active
September 6, 2016 23:57
-
-
Save Bestra/999630ff7c579e98264cdd657d4eaf90 to your computer and use it in GitHub Desktop.
kata
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({ | |
item: null, | |
openItem: null, | |
isOpen: Ember.computed('item', 'openItem', function() { | |
return this.get('item') === this.get('openItem'); | |
}), | |
classNames: ['item'], | |
click() { | |
this.get('clicked')(this.get('isOpen')); | |
} | |
}); |
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({ | |
items: null, //passed-in | |
openItem: null, | |
actions: { | |
toggleItem(item, itemWasOpen) { | |
this.set('itemWasOpen', itemWasOpen); | |
if (this.get('openItem') === item) { | |
this.set('openItem', null); | |
} else { | |
this.set('openItem', item); | |
} | |
} | |
} | |
}); |
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({ | |
listItems: [ | |
{title: "foo"}, | |
{title: "bar"} | |
] | |
}); |
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
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.item { | |
padding: 10px 10px; | |
cursor: pointer; | |
border: 1px solid gray; | |
} | |
.item .open { | |
background-color: green; | |
height: 50px; | |
} |
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.4", | |
"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.7.0", | |
"ember-data": "2.7.0", | |
"ember-template-compiler": "2.7.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment