Switch the old checkbox to use the umb-toggle directive in the views instead. Added a toggle function to deal with this in each of the two controllers

This commit is contained in:
Jan Skovgaard
2018-06-14 12:33:48 +02:00
parent 02a00eca49
commit 785dc4864a
4 changed files with 38 additions and 8 deletions

View File

@@ -23,6 +23,7 @@
vm.addChild = addChild;
vm.removeChild = removeChild;
vm.toggle = toggle;
/* ---------- INIT ---------- */
@@ -75,6 +76,18 @@
$scope.model.allowedContentTypes.splice(selectedChildIndex, 1);
}
/**
* Toggle the $scope.model.allowAsRoot value to either true or false
*/
function toggle(){
if($scope.model.allowAsRoot){
$scope.model.allowAsRoot = false;
return;
}
$scope.model.allowAsRoot = true;
}
}
angular.module("umbraco").controller("Umbraco.Editors.DocumentType.PermissionsController", PermissionsController);

View File

@@ -7,10 +7,12 @@
<small><localize key="contentTypeEditor_allowAsRootDescription" /></small>
</div>
<div class="sub-view-column-right">
<label class="checkbox no-indent" >
<input type="checkbox" ng-model="model.allowAsRoot" hotkey="alt+shift+r" />
<localize key="contentTypeEditor_allowAsRootCheckbox" />
</label>
<umb-toggle
checked="model.allowAsRoot"
on-click="vm.toggle()"
hotkey="alt+shift+r"
>
</umb-toggle>
</div>
</div>

View File

@@ -13,6 +13,7 @@
vm.addChild = addChild;
vm.removeChild = removeChild;
vm.toggle = toggle;
/* ---------- INIT ---------- */
@@ -65,6 +66,18 @@
$scope.model.allowedContentTypes.splice(selectedChildIndex, 1);
}
/**
* Toggle the $scope.model.allowAsRoot value to either true or false
*/
function toggle(){
if($scope.model.allowAsRoot){
$scope.model.allowAsRoot = false;
return;
}
$scope.model.allowAsRoot = true;
}
}
angular.module("umbraco").controller("Umbraco.Editors.MediaType.PermissionsController", PermissionsController);

View File

@@ -7,10 +7,12 @@
<small><localize key="contentTypeEditor_allowAsRootDescription" /></small>
</div>
<div class="sub-view-column-right">
<label class="checkbox no-indent" >
<input type="checkbox" ng-model="model.allowAsRoot" hotkey="alt+shift+r" />
<localize key="contentTypeEditor_allowAsRootCheckbox" />
</label>
<umb-toggle
checked="model.allowAsRoot"
on-click="vm.toggle()"
hotkey="alt+shift+r"
>
</umb-toggle>
</div>
</div>