Merge remote-tracking branch 'refs/remotes/kgiszewski/master'
This commit is contained in:
@@ -340,6 +340,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
}
|
||||
|
||||
$scope.focusFieldset(newFieldset);
|
||||
$scope.handleMandatoryValidation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,6 +350,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
$scope.setDirty();
|
||||
$scope.model.value.fieldsets.splice($index, 1);
|
||||
$scope.$broadcast("archetypeRemoveFieldset", {index: $index});
|
||||
$scope.handleMandatoryValidation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -808,6 +810,20 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
});
|
||||
});
|
||||
|
||||
$scope.$on("formSubmitting", function (ev, args) {
|
||||
$scope.handleMandatoryValidation();
|
||||
});
|
||||
|
||||
// handle mandatory validation of the entire Archetype
|
||||
// - no fieldsets = not valid
|
||||
$scope.handleMandatoryValidation = function () {
|
||||
var valid = true;
|
||||
if ($scope.model.validation && $scope.model.validation.mandatory) {
|
||||
valid = $scope.model.value.fieldsets && $scope.model.value.fieldsets.length > 0;
|
||||
}
|
||||
$scope.model.mandatoryValidation = valid ? "valid" : null;
|
||||
}
|
||||
|
||||
function toUtc(date) {
|
||||
if (!date) {
|
||||
return null;
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Mandatory validation. -->
|
||||
<input type="hidden" name="archetypeMandatory" ng-model="model.mandatoryValidation" ng-required="model.validation.mandatory" />
|
||||
<span class="help-inline" val-msg-for="archetypeMandatory" val-toggle-msg="required">Required</span>
|
||||
|
||||
<!-- Fieldsets. -->
|
||||
<ul ui-sortable="sortableOptions" class="archetypeSortable" ng-class="{archetypeEmpty: model.value.fieldsets.length === 0 || sortingLastItem()}" ng-model="model.value.fieldsets">
|
||||
<li ng-repeat="fieldset in model.value.fieldsets">
|
||||
|
||||
Reference in New Issue
Block a user