Files
ember-panda/addon/components/project/instance-action-value-display.js
T
2023-11-28 14:30:02 -05:00

65 lines
1.9 KiB
JavaScript

// Generated by CoffeeScript 2.7.0
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'span',
classNames: ['project-instance-action-value-display'],
eventIO: null,
project_instance_action: null,
value_type: Ember.computed.alias('project_instance_action.workflow_action_definition.value_type'),
save: function() {},
// https://stackoverflow.com/questions/26967855/handling-click-and-doubleclick-on-same-view-in-emberjs
doubleClick: function() {
var eventIO;
eventIO = this.get('eventIO');
if (eventIO != null) {
Ember.run.cancel(eventIO);
this.set('eventIO', null);
}
if (this.get('value_type') === 'boolean') {
//@toggleProperty 'project_instance_action.boolean_value'
//@get('project_instance_action').save()
// always modal, otherwise implement authorizations overhere
return this.modal('project/edit-instance-action', {
model: this.get('project_instance_action'),
save: this.save,
close: this.save
});
} else {
// fallback to single click behaviour
return this.modal('project/edit-instance-action', {
model: this.get('project_instance_action'),
save: this.save,
close: this.save
});
}
},
click: function() {
var eventIO;
if (this.get('eventIO') === null) {
eventIO = Ember.run.later(this, function() {
this.modal('project/edit-instance-action', {
model: this.get('project_instance_action'),
save: this.save,
close: this.save
});
if (this.get('eventIO') !== null) {
Ember.run.cancel(this.get('eventIO'));
return this.set('eventIO', null);
}
}, 500);
return this.set('eventIO', eventIO);
}
},
actions: {
right_click: function() {
return false;
}
}
});
//edit_record: ->
// @modal 'project/edit-instance-action', model: @get('project_instance_action')
// false