Last active
February 6, 2018 19:41
-
-
Save ELepolt/e527df8034af5af46f70e56d22fb18dc to your computer and use it in GitHub Desktop.
New Twiddle
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({ | |
classNames: ['draggable-component'], | |
attributeBindings: ['draggable', ], | |
draggable: "true", | |
dragStart: function(event) { | |
let item = this.get('content'); | |
return event.dataTransfer.setData('text/data', item.id); | |
}, | |
}); |
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({ | |
classNames: ['draggable-dropzone'], | |
classNameBindings: ['dragClass'], | |
dragClass: 'deactivated', | |
dragLeave: function(event) { | |
event.preventDefault(); | |
return this.set('dragClass', 'deactivated'); | |
}, | |
dragOver: function(event) { | |
event.preventDefault(); | |
return this.set('dragClass', 'activated'); | |
}, | |
drop: function(event) { | |
let data = event.dataTransfer.getData('text/data');; | |
let dropZoneData = this.get('current-content').id; | |
this.set('dragClass', 'deactivated'); | |
return this.sendAction('dropped', data, dropZoneData); | |
} | |
}); |
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' | |
}); |
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.Route.extend({ | |
model: function() { | |
return [ | |
{ | |
id: 1, | |
firstName: 'Trek', | |
lastName: 'Glowacki' | |
}, { | |
id: 2, | |
firstName: 'Tom', | |
lastName: 'Dale' | |
}, { | |
id: 3, | |
firstName: 'Yehuda', | |
lastName: 'Katz' | |
} | |
]; | |
}, | |
actions: { | |
changeTimes(droppedId, dropZoneId){ | |
let droppedUser = this.model().findBy('id', parseInt(droppedId)); | |
let dropZoneUser = this.model().findBy('id', dropZoneId); | |
//console.log(droppedUser); | |
} | |
} | |
}); |
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.13.0", | |
"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.16.2", | |
"ember-template-compiler": "2.16.2", | |
"ember-testing": "2.16.2" | |
}, | |
"addons": { | |
"ember-data": "2.16.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment