Created
December 11, 2019 14:53
-
-
Save luxzeitlos/57ca6b111fb9fff87ef81d6d454ee7c4 to your computer and use it in GitHub Desktop.
New Twiddle
This file contains hidden or 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({ | |
isSelected: Ember.computed('selectedDirs.[]', 'path', function() { | |
return this.get('selectedDirs') | |
.some(d => this.get('path').startsWith(d)); | |
}) | |
}); |
This file contains hidden or 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({ | |
init() { | |
this._super(...arguments); | |
this.set('selectedDirs', []); | |
}, | |
actions: { | |
toggle(elem) { | |
if(!this.get('selectedDirs').includes(elem)) { | |
this.set('selectedDirs', [elem, ...this.get('selectedDirs')]); | |
} else { | |
this.set('selectedDirs', this.get('selectedDirs').filter(x => x != elem)); | |
} | |
} | |
} | |
}); |
This file contains hidden or 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({ | |
tree: { | |
europe: { | |
germany: { berlin: {}, munich: {} }, | |
france: { paris: {}, milano: {} } | |
}, | |
africa: {} | |
} | |
}); |
This file contains hidden or 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; | |
} | |
.dir { | |
margin: .25rem; | |
margin-left: 1rem; | |
border: 2px solid black; | |
padding: .25rem; | |
} | |
.dir.selected { | |
border-color: blue; | |
} |
This file contains hidden or 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.15.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.4.3", | |
"ember-template-compiler": "3.4.3", | |
"ember-testing": "3.4.3" | |
}, | |
"addons": { | |
"ember-data": "3.4.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment