Skip to content

Commit

Permalink
[WIP] Add a button to clear default value
Browse files Browse the repository at this point in the history
  • Loading branch information
romanblanco committed Mar 29, 2019
1 parent 77e37a9 commit 8d3ab25
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dialog-editor/components/abstractModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class AbstractModal {
categories: '=?',
addEntry: '=?',
removeEntry: '=?',
clearDefaultValue: '=?',
currentCategoryEntries: '=?',
setupCategoryOptions: '=?',
updateDialogFieldResponders: '=?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<div >
<uib-timepicker ng-model="vm.modalData.default_value"></uib-timepicker>
</div>
<button class="btn btn-default" ng-click="vm.clearDefaultValue()" translate>Clear</button>
</div>
<div pf-form-group pf-label="{{'Read only'|translate}}">
<input bs-switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default class ModalFieldTemplate {
categories: '=?',
addEntry: '=?',
removeEntry: '=?',
clearDefaultValue: '=?',
currentCategoryEntries: '=?',
setupCategoryOptions: '=?',
resolveCategories: '=?',
Expand Down
2 changes: 2 additions & 0 deletions src/dialog-editor/components/modal-field/field.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ <h4 class="modal-title" id="myModalLabel" translate>Edit Field Details</h4>
template="date-control.html"
show-fully-qualified-name="vm.showFullyQualifiedName"
tree-options="vm.treeOptions"
clear-default-value="vm.clearDefaultValue"
modal-tab-is-set="vm.modalTabIsSet"
modal-tab="vm.modalTab"
modal-data="vm.modalData">
Expand All @@ -87,6 +88,7 @@ <h4 class="modal-title" id="myModalLabel" translate>Edit Field Details</h4>
template="date-time-control.html"
show-fully-qualified-name="vm.showFullyQualifiedName"
tree-options="vm.treeOptions"
clear-default-value="vm.clearDefaultValue"
modal-tab-is-set="vm.modalTabIsSet"
modal-tab="vm.modalTab"
modal-data="vm.modalData">
Expand Down
11 changes: 11 additions & 0 deletions src/dialog-editor/components/modal/modalComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,16 @@ class ModalController {
this.modalData.values.push(['', '']);
}

/**
* Removes default value by setting `default_value` as
* `undefined`
* @memberof ModalFieldController
* @function clearDefaultValue
*/
public clearDefaultValue() {
this.modalData.default_value = undefined;
}

/**
* Remove entry for radio button / dropdown select
* @memberof ModalFieldController
Expand Down Expand Up @@ -312,6 +322,7 @@ class ModalController {
categories="modalCtrl.parent.categories"
add-entry="modalCtrl.parent.addEntry"
remove-entry="modalCtrl.parent.removeEntry"
clear-default-value="modalCtrl.parent.clearDefaultValue"
current-category-entries="modalCtrl.parent.currentCategoryEntries"
resolve-categories="modalCtrl.parent.resolveCategories"
modal-tab-is-set="modalCtrl.parent.modalTabIsSet"
Expand Down

0 comments on commit 8d3ab25

Please sign in to comment.