From a4379e89b12fc31910c3cf8f9c0465f4db83564f Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Thu, 25 Sep 2014 18:51:40 +1000 Subject: [PATCH] Add empty type to triggerapi --- modules/backend/assets/js/october.triggerapi.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/backend/assets/js/october.triggerapi.js b/modules/backend/assets/js/october.triggerapi.js index aa5b811da..a57c3f52b 100644 --- a/modules/backend/assets/js/october.triggerapi.js +++ b/modules/backend/assets/js/october.triggerapi.js @@ -1,22 +1,22 @@ /* * The trigger API. * - * The API allows to change elements' visibility or status (enabled/disabled) basing on + * The API allows to change elements' visibility or status (enabled/disabled) basing on * other elements' statuses. Example: enable a button if any checkbox inside another * element is checked. * * Supported data attributes: - * - data-trigger-type, values: display, hide, enable, disable + * - data-trigger-type, values: display, hide, enable, disable, empty * - data-trigger: a CSS selector for elements that trigger the action (checkboxes) - * - data-trigger-condition, values: + * - data-trigger-condition, values: * - checked: determines the condition the elements specified in the data-trigger * should satisfy in order the condition to be considered as "true". * - value[somevalue]: determines if the value of data-trigger equals the specified value (somevalue) * the condition is considered "true". * - * Example: * * Supported events: @@ -83,6 +83,8 @@ this.$el.prop('disabled', !status).trigger('disable', [!status]).toggleClass('control-disabled', !status) else if (this.options.triggerType == 'disable') this.$el.prop('disabled', status).trigger('disable', [status]).toggleClass('control-disabled', status) + else if (this.options.triggerType == 'empty' && status) + this.$el.trigger('empty').val('') if (this.options.triggerType == 'display' || this.options.triggerType == 'hide') this.fixButtonClasses()