[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/core",
"platform/representation",
"platform/commonUI/browse",
"platform/commonUI/edit",
"platform/commonUI/dialog",
"platform/commonUI/general",
"platform/forms",
"example/forms",
"example/persistence"
]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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