[Forms] Communicate dirty state

Communicate dirty state out of generated forms;
WTD-530.
This commit is contained in:
Victor Woeltjen 2014-11-26 13:08:57 -08:00
parent 77c1b150d9
commit b31b4770d1
7 changed files with 31 additions and 26 deletions

View File

@ -2,10 +2,11 @@
"platform/framework", "platform/framework",
"platform/core", "platform/core",
"platform/representation", "platform/representation",
"platform/commonUI/browse",
"platform/commonUI/edit",
"platform/commonUI/dialog", "platform/commonUI/dialog",
"platform/commonUI/general", "platform/commonUI/general",
"platform/forms",
"example/forms",
"example/persistence" "example/persistence"
] ]

View File

@ -1,7 +1,7 @@
<label class="checkbox custom no-text"> <label class="checkbox custom no-text">
<input type="checkbox" <input type="checkbox"
name="{{name}}" name="mctControl"
ng-model="ngModel[name]" ng-model="ngModel[field]"
ng-disabled="ngDisabled"> ng-disabled="ngDisabled">
<em>&nbsp;</em> <em>&nbsp;</em>
</label> </label>

View File

@ -1,7 +1,7 @@
<select class='form-control input select' <select class='form-control input select'
ng-model="ngModel[name]" ng-model="ngModel[field]"
ng-options="o.name for o in options" ng-options="o.name for o in options"
name="name"> name="mctControl">
<option value="" ng-if="!ngModel[name]">- Select One -</option> <option value="" ng-if="!ngModel[field]">- Select One -</option>
<span class='ui-symbol arw colorKey'>v</span> <span class='ui-symbol arw colorKey'>v</span>
</select> </select>

View File

@ -1,7 +1,7 @@
<span class='form-control shell'> <span class='form-control shell'>
<span class='field control'> <span class='field control'>
<input type="text" <input type="text"
ng-model="ngModel[name]" ng-model="ngModel[field]"
name="{{name}}"> name="mctControl">
</span> </span>
</span> </span>

View File

@ -18,23 +18,26 @@
</span> </span>
</div> </div>
<div class='controls'> <div class='controls'>
<div class="wrapper" ng-if="row.control">> <div class="wrapper" ng-if="row.control">
<mct-control key="row.control" <ng-form name="mctFormInner">
ng-model="ngModel" <mct-control key="row.control"
ng-required="row.required" ng-model="ngModel"
options="row.options" ng-required="row.required"
structure="row" options="row.options"
name="{{row.key}}"> structure="row"
</mct-control> field="row.key">
</mct-control>
</ng-form>
</div> </div>
<div ng-repeat="item in row.items" class="validates"> <div ng-repeat="item in row.items" class="validates">
<mct-control key="item.control" <ng-form name="mctFormInner">
ng-model="ngModel" <mct-control key="item.control"
ng-required="item.required" ng-model="ngModel"
options="item.options" ng-required="item.required"
structure="item" options="item.options"
name="{{item.key}}"> structure="item">
</mct-control> </mct-control>
</ng-form>
</div> </div>
</div> </div>

View File

@ -60,7 +60,7 @@ define(
structure: "=", structure: "=",
// Name, as in "<input name="... // Name, as in "<input name="...
name: "@" field: "="
} }
}; };
} }

View File

@ -21,8 +21,9 @@ define(
function controller($scope) { function controller($scope) {
$scope.$watch("mctForm", function (mctForm) { $scope.$watch("mctForm", function (mctForm) {
console.log(JSON.stringify(mctForm));
if ($scope.name) { if ($scope.name) {
$scope.$parent.mctForm = mctForm; $scope.$parent[$scope.name] = mctForm;
} }
}); });
} }