From df6bb368766f6f72374bd986f6363b40e0cd9b6d Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 1 Apr 2015 16:04:19 +1100 Subject: [PATCH] moves notification logic to umbnotifications.directive instead of in main (not sure why it was there). Updates the AuthorizeUpgrade screen to be able to show YSOD or alert messages when there are server errors. Adds htmlhelper extensions to share between Default.cshtml and AuthorizeUpgrade.cshtml. Adds null check for BackOfficeUserManager. --- .../directives/umbnavigation.directive.js | 4 +- .../directives/umbnotifications.directive.js | 15 ++- .../src/common/services/dialog.service.js | 4 +- .../src/controllers/main.controller.js | 8 +- src/Umbraco.Web.UI.Client/src/less/grid.less | 9 ++ .../src/less/modals.less | 3 + .../src/views/common/dialogs/ysod.html | 2 +- .../Umbraco/Views/AuthorizeUpgrade.cshtml | 47 ++++----- .../umbraco/Views/Default.cshtml | 94 ++++-------------- .../Editors/AuthenticationController.cs | 14 ++- .../Editors/BackOfficeController.cs | 2 + .../HtmlHelperBackOfficeExtensions.cs | 95 +++++++++++++++++++ src/Umbraco.Web/HtmlHelperRenderExtensions.cs | 1 - src/Umbraco.Web/Umbraco.Web.csproj | 1 + 14 files changed, 187 insertions(+), 112 deletions(-) create mode 100644 src/Umbraco.Web/HtmlHelperBackOfficeExtensions.cs diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbnavigation.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbnavigation.directive.js index b3ce9cbd15..dfee6c1daf 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbnavigation.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbnavigation.directive.js @@ -3,7 +3,7 @@ * @name umbraco.directives.directive:umbNavigation * @restrict E **/ -function leftColumnDirective() { +function umbNavigationDirective() { return { restrict: "E", // restrict to an element replace: true, // replace the html element with the template @@ -11,4 +11,4 @@ function leftColumnDirective() { }; } -angular.module('umbraco.directives').directive("umbNavigation", leftColumnDirective); +angular.module('umbraco.directives').directive("umbNavigation", umbNavigationDirective); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbnotifications.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbnotifications.directive.js index 607ae97f3f..365c212f42 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbnotifications.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbnotifications.directive.js @@ -2,11 +2,22 @@ * @ngdoc directive * @name umbraco.directives.directive:umbNotifications */ -function notificationDirective() { +function notificationDirective(notificationsService) { return { restrict: "E", // restrict to an element replace: true, // replace the html element with the template - templateUrl: 'views/directives/umb-notifications.html' + templateUrl: 'views/directives/umb-notifications.html', + link: function (scope, element, attr, ctrl) { + + //subscribes to notifications in the notification service + scope.notifications = notificationsService.current; + scope.$watch('notificationsService.current', function (newVal, oldVal, scope) { + if (newVal) { + scope.notifications = newVal; + } + }); + + } }; } diff --git a/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js b/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js index 5746fd022c..1dc25363b3 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js @@ -508,7 +508,7 @@ angular.module('umbraco.services') /** * @ngdoc method - * @name umbraco.services.dialogService#ysodDialog + * @name umbraco.services.dialogService#embedDialog * @methodOf umbraco.services.dialogService * @description * Opens a dialog to an embed dialog @@ -531,7 +531,7 @@ angular.module('umbraco.services') var newScope = $rootScope.$new(); newScope.error = ysodError; return openDialog({ - modalClass: "umb-modal wide", + modalClass: "umb-modal wide ysod", scope: newScope, //callback: options.callback, template: 'views/common/dialogs/ysod.html', diff --git a/src/Umbraco.Web.UI.Client/src/controllers/main.controller.js b/src/Umbraco.Web.UI.Client/src/controllers/main.controller.js index cc5dc314d1..5bf230a91b 100644 --- a/src/Umbraco.Web.UI.Client/src/controllers/main.controller.js +++ b/src/Umbraco.Web.UI.Client/src/controllers/main.controller.js @@ -15,13 +15,7 @@ function MainController($scope, $rootScope, $location, $routeParams, $timeout, $ $scope.authenticated = null; $scope.avatar = "assets/img/application/logo.png"; $scope.touchDevice = appState.getGlobalState("touchDevice"); - //subscribes to notifications in the notification service - $scope.notifications = notificationsService.current; - $scope.$watch('notificationsService.current', function (newVal, oldVal, scope) { - if (newVal) { - $scope.notifications = newVal; - } - }); + $scope.removeNotification = function (index) { notificationsService.remove(index); diff --git a/src/Umbraco.Web.UI.Client/src/less/grid.less b/src/Umbraco.Web.UI.Client/src/less/grid.less index 22ea5d9836..74c2d17f7e 100644 --- a/src/Umbraco.Web.UI.Client/src/less/grid.less +++ b/src/Umbraco.Web.UI.Client/src/less/grid.less @@ -176,3 +176,12 @@ body { .emptySection #contentwrapper {left: 80px;} .emptySection #speechbubble {left: 0;} .emptySection #navigation {display: none} + + +.login-only #speechbubble { + z-index: 10000; + left: 0 !important; +} +.login-only #speechbubble ul { + padding-left:20px +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/less/modals.less b/src/Umbraco.Web.UI.Client/src/less/modals.less index dbfd4d7841..3a5b4abe27 100644 --- a/src/Umbraco.Web.UI.Client/src/less/modals.less +++ b/src/Umbraco.Web.UI.Client/src/less/modals.less @@ -193,3 +193,6 @@ height: 12px } +.umb-modal.ysod { + z-index: 10000; +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/ysod.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/ysod.html index d6b980fa3c..4d8a000d43 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/ysod.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/ysod.html @@ -1,4 +1,4 @@ -
+