2017-04-05 15:58:01 +00:00
|
|
|
import DropLab from '@gitlab-org/droplab';
|
|
|
|
import InputSetter from '@gitlab-org/droplab/dist/plugins/InputSetter';
|
|
|
|
|
|
|
|
class CommentTypeToggle {
|
|
|
|
constructor(trigger, list, input, button, secondaryButton) {
|
|
|
|
this.trigger = trigger;
|
|
|
|
this.list = list;
|
|
|
|
this.input = input;
|
|
|
|
this.button = button;
|
|
|
|
this.secondaryButton = secondaryButton;
|
|
|
|
}
|
|
|
|
|
|
|
|
initDroplab() {
|
|
|
|
this.droplab = new DropLab();
|
2017-04-06 01:11:38 +00:00
|
|
|
|
|
|
|
const inputSetterConfig = [{
|
|
|
|
input: this.input,
|
|
|
|
valueAttribute: 'data-value',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: this.button,
|
|
|
|
valueAttribute: 'data-button-text',
|
|
|
|
}];
|
|
|
|
if (this.secondaryButton) {
|
|
|
|
inputSetterConfig.push({
|
2017-04-05 15:58:01 +00:00
|
|
|
input: this.secondaryButton,
|
|
|
|
valueAttribute: 'data-secondary-button-text',
|
2017-04-06 01:11:38 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
this.droplab.init(this.trigger, this.list, [InputSetter], {
|
|
|
|
InputSetter: inputSetterConfig
|
2017-04-05 15:58:01 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default CommentTypeToggle;
|