Initial setup of public access dialog

This commit is contained in:
Kenn Jacobsen
2018-11-23 16:16:06 +01:00
parent 31b4e944e7
commit 18258fe487
3 changed files with 131 additions and 3 deletions
@@ -0,0 +1,46 @@
(function () {
"use strict";
function ContentProtectController($scope, $routeParams, contentResource, memberGroupResource, navigationService) {
var vm = this;
var id = $scope.currentNode.id;
vm.loading = false;
vm.saveButtonState = "init";
vm.next = next;
vm.save = save;
vm.close = close;
vm.type = null;
function onInit() {
vm.loading = true;
// Get all member groups
memberGroupResource.getGroups().then(function (groups) {
vm.groups = groups;
vm.step = "type";
vm.loading = false;
});
}
function next() {
vm.step = vm.type;
}
function save() {
vm.saveButtonState = "busy";
console.log("TODO: SAVE!")
}
function close() {
navigationService.hideDialog();
}
onInit();
}
angular.module("umbraco").controller("Umbraco.Editors.Content.ProtectController", ContentProtectController);
})();
@@ -0,0 +1,82 @@
<div ng-controller="Umbraco.Editors.Content.ProtectController as vm">
<div class="umb-dialog-body form-horizontal" ng-cloak>
<div class="umb-pane">
<div ng-show="error">
<div class="alert alert-error">
<div><strong>{{error.errorMsg}}</strong></div>
<div>{{error.data.message}}</div>
</div>
</div>
<umb-load-indicator ng-show="vm.loading">
</umb-load-indicator>
<umb-pane ng-show="vm.step === 'type'">
<p class="abstract" ng-hide="success">
<localize key="publicAccess_paHowWould">Choose how to restrict access to the page</localize> <strong>{{currentNode.name}}</strong>
</p>
<div class="pa-select-type">
<input id="protectionTypeUser" type="radio" name="protectionType" value="user" ng-model="vm.type">
<label for="protectionTypeUser">
<h5 class="pa-access-header"><localize key="publicAccess_paSimple">Single user protection</localize></h5>
<p><localize key="publicAccess_paSimpleHelp">If you just want to setup simple protection using a single login and password.</localize></p>
</label>
</div>
<div class="pa-select-type">
<input id="protectionTypeRole" type="radio" name="protectionType" value="role" ng-model="vm.type">
<label for="protectionTypeRole">
<h5 class="pa-access-header"><localize key="publicAccess_paAdvanced">Role based protection</localize></h5>
<p><localize key="publicAccess_paAdvancedHelp">If you wish to control access to the page using role-based authentication, using Umbraco's member groups.</localize></p>
</label>
</div>
</umb-pane>
<umb-pane ng-show="vm.step === 'user'">
TODO: user config
</umb-pane>
<umb-pane ng-show="vm.step === 'role' && !vm.groups.length">
<p><localize key="publicAccess_paAdvancedNoGroups">You need to create a membergroup before you can use role-based authentication.</localize></p>
</umb-pane>
<umb-pane ng-show="vm.step === 'role' && vm.groups.length">
TODO: role config
</umb-pane>
<!--<pre>{{vm | json}}</pre>-->
</div>
</div>
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-hide="success">
<umb-button
type="button"
button-style="link"
action="vm.close()"
label-key="general_close">
</umb-button>
<umb-button
ng-hide="vm.step !== 'type'"
type="button"
action="vm.next()"
button-style="success"
label-key="general_next">
</umb-button>
<umb-button
ng-show="vm.step !== 'type'"
type="button"
action="vm.save()"
state="vm.saveButtonState"
button-style="success"
label-key="buttons_save"
disabled="vm.buttonState === 'busy' || !TODO">
</umb-button>
</div>
</div>
@@ -1126,10 +1126,10 @@ To manage your website, simply open the Umbraco back office and start adding con
<area alias="publicAccess">
<key alias="paAdvanced">Role based protection</key>
<key alias="paAdvancedHelp">If you wish to control access to the page using role-based authentication, using Umbraco's member groups.</key>
<key alias="paAdvancedNoGroups">You need to create a membergroup before you can use role-based authentication</key>
<key alias="paAdvancedNoGroups">You need to create a membergroup before you can use role-based authentication.</key>
<key alias="paErrorPage">Error Page</key>
<key alias="paErrorPageHelp">Used when people are logged on, but do not have access</key>
<key alias="paHowWould">Choose how to restrict access to this page</key>
<key alias="paHowWould">Choose how to restrict access to the page</key>
<key alias="paIsProtected">%0% is now protected</key>
<key alias="paIsRemoved">Protection removed from %0%</key>
<key alias="paLoginPage">Login Page</key>
@@ -1139,7 +1139,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="paSelectRoles">Pick the roles who have access to this page</key>
<key alias="paSetLogin">Set the login and password for this page</key>
<key alias="paSimple">Single user protection</key>
<key alias="paSimpleHelp">If you just want to setup simple protection using a single login and password</key>
<key alias="paSimpleHelp">If you just want to setup simple protection using a single login and password.</key>
</area>
<area alias="publish">
<key alias="contentPublishedFailedAwaitingRelease"><![CDATA[