-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/Cogworks.ContentGuard.Web/App_Plugins/Cogworks.ContentGuard/contentguard.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(function () { | ||
"use strict"; | ||
|
||
angular.module("umbraco") | ||
.controller("Cogworks.Guard.Controller", | ||
function ($scope, editorState, contentGuardService) { | ||
var vm = this; | ||
|
||
vm.buttonState = "init"; | ||
vm.clickCommand = clickCommand; | ||
vm.notification = ""; | ||
|
||
function clickCommand() { | ||
vm.buttonState = "busy"; | ||
var pageId = editorState.current.id; | ||
|
||
contentGuardService.unlockPage(pageId) | ||
.then(function () { | ||
vm.buttonState = "success"; | ||
vm.notification = "Page successfully unlocked. You will be redirected to root page in a moment."; | ||
|
||
setTimeout(function () { | ||
window.location.href = "/umbraco#/content"; | ||
}, 2500); | ||
}, function (error) { | ||
vm.buttonState = "error"; | ||
vm.notification = "There was a problem unlocking this page. Please try again."; | ||
|
||
console.log("Unlocking page failed", error); | ||
}); | ||
} | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/Cogworks.ContentGuard.Web/App_Plugins/Cogworks.ContentGuard/guard-button.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div ng-controller="Cogworks.Guard.Controller as vm"> | ||
<umb-box> | ||
<umb-box-header title="Contend Guard"></umb-box-header> | ||
<umb-box-content> | ||
<div> | ||
<p>Have you finished editing this page? Would you like to unlock this page to allow other editors access.</p> | ||
</div> | ||
|
||
<umb-button action="vm.clickCommand()" | ||
type="button" | ||
button-style="action" | ||
state="vm.buttonState" | ||
label="Unlock" | ||
disabled="vm.buttonState === 'busy'"> | ||
</umb-button> | ||
|
||
<hr /> | ||
<div ng-if="vm.notification"> | ||
<p>{{vm.notification}}</p> | ||
</div> | ||
</umb-box-content> | ||
</umb-box> | ||
</div> |
18 changes: 17 additions & 1 deletion
18
src/Cogworks.ContentGuard.Web/App_Plugins/Cogworks.ContentGuard/package.manifest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
{ | ||
"contentApps": [ | ||
{ | ||
"name": "Content Guard", | ||
"alias": "contentGuard", | ||
"weidht": "1", | ||
"icon": "icon-shield", | ||
"view": "~/App_Plugins/Cogworks.ContentGuard/guard-button.html", | ||
"show": [ | ||
"+content/*", | ||
"-media/*", | ||
"-member/*", | ||
"-contentType/*" | ||
] | ||
} | ||
], | ||
"javascript": [ | ||
"~/App_Plugins/Cogworks.ContentGuard/contentguard.resources.js", | ||
"~/App_Plugins/Cogworks.ContentGuard/contentguard.interceptor.js" | ||
"~/App_Plugins/Cogworks.ContentGuard/contentguard.interceptor.js", | ||
"~/App_Plugins/Cogworks.ContentGuard/contentguard.controller.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters