Created
June 22, 2016 21:38
-
-
Save zackthehuman/376d6890c34f868e6619c936438a7322 to your computer and use it in GitHub Desktop.
accordion thing
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({ | |
}); |
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({ | |
selectedIndex: 0, | |
init() { | |
this._super(); | |
this.selectIndex(this.get('selectedIndex')); | |
}, | |
selectIndex(index) { | |
let oldIndex = this.get('selectedIndex'); | |
let oldItem = this.get('items').objectAt(oldIndex); | |
oldItem.set('isSelected', false); | |
this.set('selectedIndex', index); | |
let newItem = this.get('items').objectAt(index); | |
newItem.set('isSelected', true); | |
} | |
}); |
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({ | |
appName: 'Ember Twiddle', | |
items: Ember.A([ | |
Ember.Object.create({ | |
label: "Section 1", | |
text: "Section 1 text!", | |
isExpanded: false | |
}), | |
Ember.Object.create({ | |
label: "Section 2", | |
text: "Section 2 text!", | |
isExpanded: false | |
}), | |
Ember.Object.create({ | |
label: "Section 3", | |
text: "Section 3 text!", | |
isExpanded: false | |
}) | |
]) | |
}); |
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.9.3", | |
"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.6.0", | |
"ember-data": "2.6.1", | |
"ember-template-compiler": "2.6.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment