Skip to content

Commit

Permalink
Fix configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
stropitek committed Nov 10, 2014
1 parent 946db9b commit f5a388f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
6 changes: 0 additions & 6 deletions src/modules/types/edition/alpaca/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ define(['modules/default/defaultcontroller', 'lib/json-schema/schema'], function
default: ['show'],
options: {show: 'Show'}
},
sendOnChange: {
type: 'checkbox',
title: 'Send on change',
options: {yes: 'Yes'},
default: ['yes']
},
button_text: {
type: 'text',
title: 'Text of the export button',
Expand Down
22 changes: 10 additions & 12 deletions src/modules/types/edition/alpaca/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ define(['modules/default/defaultview', 'src/util/util', 'jquery', 'forms/button'
}
});

if(this.module.getConfiguration('hasButton', 'show')) {
if(this.module.getConfigurationCheckbox('hasButton', 'show')) {
this.module.getDomContent().append(new Button(this.module.getConfiguration('button_text'), function () {
if(that._form) {
that.module.controller.onSubmit(that._form.getValue());
Expand All @@ -59,18 +59,16 @@ define(['modules/default/defaultview', 'src/util/util', 'jquery', 'forms/button'
}));
}

if(this.module.getConfiguration('sendOnChange', 'yes')) {
var debouncing = this.module.getConfiguration('debouncing', -1);
if (debouncing > -1) {
var cb = function () {
that.module.controller.onSubmit(that._form.getValue());
};
if (debouncing > 0) {
cb = _.debounce(cb, debouncing);
}
this.$alpaca.off('input change', cb);
this.$alpaca.on('input change', cb);
var debouncing = this.module.getConfiguration('debouncing', -1);
if (debouncing > -1) {
var cb = function () {
that.module.controller.onSubmit(that._form.getValue());
};
if (debouncing > 0) {
cb = _.debounce(cb, debouncing);
}
this.$alpaca.off('input change', cb);
this.$alpaca.on('input change', cb);
}


Expand Down

0 comments on commit f5a388f

Please sign in to comment.