Skip to content

Commit

Permalink
improve job deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
nraynaud committed Jan 2, 2020
1 parent 6c37307 commit 79999f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion webapp/cnc/app/job/jobController.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ define(['Ember', 'jQuery', 'cnc/util', 'cnc/cam/cam'], function (Ember, $, util,
this.transitionToRoute('shape', shape);
},
'delete': function () {
console.log('delete')
var _this = this;
var ops = this.get('operations').toArray();
return Ember.RSVP.all(ops.map(function (op) {
_this.get('operations').removeObject(op);
console.log('destroying ' + op.get('name'))
//_this.get('operations').removeObject(op);
return op.destroyRecord();
})).finally(function () {
return _this.get('model').destroyRecord();
Expand Down
8 changes: 4 additions & 4 deletions webapp/cnc/app/job/jobView.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ define(['Ember', 'cnc/import/svgImporter', 'cnc/import/gerberImporter', 'cnc/imp
_this.displayFakeDelete(false);
}, function () {
$(this).data('hovering', false);
if (_this.get('controller.deleteSlider') === 0)
if (_this.get('controller.deleteSlider') == '0')
_this.displayFakeDelete(true);
});
this.$('#deleteSlider').mouseup(function () {
if (_this.get('controller.deleteSlider') === 1) {
if (_this.get('controller.deleteSlider') == '1') {
_this.get('controller').send('delete');
_this.displayFakeDelete(true);
}
Expand Down Expand Up @@ -121,14 +121,14 @@ define(['Ember', 'cnc/import/svgImporter', 'cnc/import/gerberImporter', 'cnc/imp
var val = this.get('controller.deleteSlider');
if (this.$()) {
this.$('#deleteBlock').css('background-color', 'rgba(255, 0, 0, ' + val + ')');
if (val === 1) {
if (val === '1') {
$('#slideToDelete').hide();
$('#releaseToDelete').show();
} else {
$('#slideToDelete').show();
$('#releaseToDelete').hide();
}
if (val === 0 && !this.$('#deleteBlock').data('hovering'))
if (val == 0 && !this.$('#deleteBlock').data('hovering'))
this.displayFakeDelete(true);
}
}.observes('controller.deleteSlider')
Expand Down

0 comments on commit 79999f1

Please sign in to comment.