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 Sep 2, 2019
1 parent bfdd31c commit c3001f1
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"karma-webpack": "1.8.0",
"lodash": "^4.17.2",
"ng-annotate-webpack-plugin": "0.1.3",
"node-sass": "^3.13.0",
"node-sass": "^4.12.0",
"numeral": "^2.0.6",
"patternfly": "^3.15.0",
"patternfly-bootstrap-treeview": "^2.1.5",
Expand Down
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 @@ -6,6 +6,7 @@
pf-datepicker
date="vm.modalData.default_value">
</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 @@ -16,6 +16,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 @@ -223,6 +223,16 @@ class ModalController {
this.modalData.values.push(['', '']);
}

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

/**
* Remove entry for radio button / dropdown select
* @memberof ModalFieldController
Expand Down Expand Up @@ -318,6 +328,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 c3001f1

Please sign in to comment.