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:'Expandable list', | |
buttonName: 'expand all', | |
families: [{title:'parent a', | |
children: [ | |
{ title:'a son' },{ title:'a daughter' } | |
] | |
}, |
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:'Expandable list', | |
buttonName: 'expand all', | |
families: [{title:'parent a', | |
children: [ | |
{ title:'a son' },{ title:'a daughter' } | |
] | |
}, |
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
translateTarget(target, dx, dy){ | |
// dragged position in the data-x/data-y attributes | |
function attr(name, defaultVal) { | |
return (parseFloat(target.getAttribute('data-' + name)) || defaultVal); | |
} | |
function setAttrs(target, attrs){ | |
Object.keys(attrs).forEach((k)=> { | |
target.setAttribute('data-' + k, attrs[k]); | |
}); | |
} |