diff --git a/brewman/brewman/static/partial/journal.html b/brewman/brewman/static/partial/journal.html
index c4e5d397..fc02e3d4 100644
--- a/brewman/brewman/static/partial/journal.html
+++ b/brewman/brewman/static/partial/journal.html
@@ -74,9 +74,9 @@
-
diff --git a/brewman/brewman/static/partial/payment.html b/brewman/brewman/static/partial/payment.html
index 2872a0a7..1843a8f8 100644
--- a/brewman/brewman/static/partial/payment.html
+++ b/brewman/brewman/static/partial/payment.html
@@ -83,9 +83,9 @@
{{voucher.Posted | posted}}
-
- Delete
+ Delete
diff --git a/brewman/brewman/static/partial/purchase.html b/brewman/brewman/static/partial/purchase.html
index 9895e82e..8dc60227 100644
--- a/brewman/brewman/static/partial/purchase.html
+++ b/brewman/brewman/static/partial/purchase.html
@@ -98,9 +98,9 @@
{{voucher.Posted | posted}}
-
- Delete
+ Delete
diff --git a/brewman/brewman/static/partial/receipt.html b/brewman/brewman/static/partial/receipt.html
index df8a2d40..30633e5e 100644
--- a/brewman/brewman/static/partial/receipt.html
+++ b/brewman/brewman/static/partial/receipt.html
@@ -83,9 +83,9 @@
{{voucher.Posted | posted}}
-
- Delete
+ Delete
diff --git a/brewman/brewman/static/scripts/angular_directive.js b/brewman/brewman/static/scripts/angular_directive.js
index 4781accf..8a489548 100644
--- a/brewman/brewman/static/scripts/angular_directive.js
+++ b/brewman/brewman/static/scripts/angular_directive.js
@@ -127,6 +127,23 @@ overlord_directive.directive('fadey', function () {
return directiveDefinitionObject;
});
+overlord_directive.directive('ngConfirm', function(modal) {
+ return {
+ restrict: 'A',
+ link: function postLink(scope, element, attrs) {
+ // Could have custom or boostrap modal options here
+ var options = {};
+ element.bind("click", function()
+ {
+ var actionButton = {text:attrs["actionButtonText"], click:attrs["actionFunction"], class:attrs['class']};
+ var cancelButton = {text:attrs["cancelButtonText"], click:attrs["cancelFunction"]};
+ modal.confirm(attrs["title"], attrs["actionText"], actionButton, cancelButton, scope, options);
+ });
+ }
+ };
+
+});
+
(function (angular) {
/*
diff --git a/brewman/brewman/static/scripts/modal-service.js b/brewman/brewman/static/scripts/modal-service.js
new file mode 100644
index 00000000..4adced52
--- /dev/null
+++ b/brewman/brewman/static/scripts/modal-service.js
@@ -0,0 +1,85 @@
+overlord_service.factory('modal', function ($http, $compile) {
+ var modal = {};
+
+ modal.get = function (create) {
+ if (!modal.dialog && create) {
+ modal.dialog = $('
');
+ modal.dialog.appendTo('BODY');
+ }
+ return modal.dialog;
+ }
+
+ modal.compileAndRun = function (dialog, scope, options) {
+ $compile(dialog)(scope);
+ dialog.modal(options);
+ }
+
+ modal.alert = function (title, text, buttonText, alertFunction, scope, options) {
+ text = (text) ? text : "Alert";
+ buttonText = (buttonText) ? buttonText : "Ok";
+ var dialog = modal.get(true),
+ html = "";
+ if (title) {
+ html += "";
+ }
+ html += "
" + text + "
"
+ + "";
+ dialog.html(html);
+ if (!alertFunction) {
+ dialog.find(".btn").click(function () {
+ modal.close();
+ });
+ }
+ modal.compileAndRun(dialog, scope, options);
+ }
+
+ modal.confirm = function (title, actionText, actionButton, cancelButton, scope, options) {
+ actionText = (actionText) ? actionText : "Are you sure?";
+ actionButton.text = (actionButton.text) ? actionButton.text : "Ok";
+ cancelButton.text = (cancelButton.text) ? cancelButton.text : "Cancel";
+
+ var dialog = modal.get(true),
+ html = "";
+ if (title) {
+ html += "";
+ }
+ html += "
" + actionText + "
"
+ + "";
+ dialog.html(html);
+
+ dialog.find("#action").click(function () {
+ if (actionButton.click) {
+ scope.$eval(actionButton.click);
+ }
+ modal.close();
+ });
+ dialog.find("#cancel").click(function () {
+ if (cancelButton.click) {
+ scope.$eval(cancelButton.click);
+ }
+ modal.close();
+ });
+ modal.compileAndRun(dialog, scope, options);
+
+ }
+
+ modal.close = function () {
+ var popup = modal.get()
+ if (popup) {
+ popup.modal('hide');
+ }
+ }
+
+ return modal;
+
+});
diff --git a/brewman/brewman/static/scripts/overlord.js b/brewman/brewman/static/scripts/overlord.js
index fea8972d..87582db3 100644
--- a/brewman/brewman/static/scripts/overlord.js
+++ b/brewman/brewman/static/scripts/overlord.js
@@ -163,7 +163,6 @@ function BaseCtrl($rootScope, $scope, Auth, $location) {
}
};
-
$rootScope.$on("$routeChangeStart", function (event, next, current) {
$rootScope.$broadcast('spinnerStart', 'route');
Auth.get(function (u, putResponseHeaders) {
diff --git a/brewman/brewman/templates/angular_base.mako b/brewman/brewman/templates/angular_base.mako
index 1cf53dc8..7b56441f 100644
--- a/brewman/brewman/templates/angular_base.mako
+++ b/brewman/brewman/templates/angular_base.mako
@@ -30,6 +30,7 @@
+
@@ -68,7 +69,7 @@
-
+
diff --git a/brewman/brewman/views/__init__.py b/brewman/brewman/views/__init__.py
index f5e50bb0..ac8dbbf3 100644
--- a/brewman/brewman/views/__init__.py
+++ b/brewman/brewman/views/__init__.py
@@ -13,7 +13,7 @@ from pyramid.view import view_config
def home(request):
return {}
-@view_config(context=HTTPForbidden, renderer='brewman:templates/angular_base.mako', xhr=False)
+@view_config(context=HTTPForbidden, renderer='brewman:templates/angular_base.mako')
def forbidden(request):
if 'X-Requested-With' in request.headers and request.headers['X-Requested-With'] == 'XMLHttpRequest':
response = Response("Forbidden")