diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/hotkey.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/hotkey.directive.js index 4406ad4edd..fbe3d2d636 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/hotkey.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/hotkey.directive.js @@ -5,22 +5,13 @@ angular.module("umbraco.directives") .directive('hotkey', function ($window, keyboardService, $log) { return function (scope, el, attrs) { - var keyCombo = attrs["hotkey"]; - $log.log(keyCombo); - keyboardService.bind(keyCombo, function() { var element = $(el); - - $log.log(element); - if(element.is("a,button,input[type='button'],input[type='submit']")){ element.click(); - $log.log("click"); - }else{ element.focus(); - $log.log("focus"); } }); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js b/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js index 8328d3e476..fda9f007cc 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js @@ -25,6 +25,7 @@ angular.module('umbraco.services') elt = document.getElementById(opt.target); } + fct = function (e) { e = e || $window.event; @@ -217,7 +218,6 @@ angular.module('umbraco.services') return false; } } - }; // Store shortcut keyboardManagerService.keyboardEvent[label] = { diff --git a/src/Umbraco.Web.UI.Client/src/routes.js b/src/Umbraco.Web.UI.Client/src/routes.js index deb972df24..d26a5ae4a8 100644 --- a/src/Umbraco.Web.UI.Client/src/routes.js +++ b/src/Umbraco.Web.UI.Client/src/routes.js @@ -2,7 +2,7 @@ app.config(function ($routeProvider) { $routeProvider .when('/:section', { templateUrl: function (rp) { - if (rp.section === "default") + if (rp.section === "default" || rp.section === "") { rp.section = "content"; } diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.controller.js index 8976706456..f6cf8b6e41 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.controller.js @@ -1,4 +1,4 @@ -angular.module("umbraco").controller("Umbraco.Dialogs.LoginController", function ($scope, userService, legacyJsLoader) { +angular.module("umbraco").controller("Umbraco.Dialogs.LoginController", function ($scope, userService, legacyJsLoader, $routeParams) { /** * @ngdoc function @@ -13,11 +13,9 @@ var weekday = new Array("Super Sunday", "Manic Monday", "Tremendous Tuesday", "Wonderfull Wednesday", "Thunder Thursday", "Friendly Friday", "Shiny Saturday"); $scope.today = weekday[d.getDay()]; - $scope.errorMsg = ""; - $scope.loginSubmit = function (login, password) { - + $scope.loginSubmit = function (login, password) { if ($scope.loginForm.$invalid) { return; } @@ -27,11 +25,15 @@ //We need to load in the legacy tree js. legacyJsLoader.loadLegacyTreeJs($scope).then( function(result) { - var iframe = document.getElementById("right"); + var iframe = $("#right"); if(iframe){ - iframe.contentDocument.location.reload(true); + var url = decodeURIComponent($routeParams.url); + if(!url){ + url ="dashboard.aspx"; + } + iframe.attr("src", url); } - + $scope.submit(true); }); }, function (reason) { diff --git a/src/Umbraco.Web.UI.Client/src/views/common/legacy.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/legacy.controller.js index 7fdaf50322..520c22e4a4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/legacy.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/legacy.controller.js @@ -8,11 +8,12 @@ * */ function LegacyController($scope, $routeParams, $element) { - //set the legacy path - $scope.legacyPath = decodeURIComponent($routeParams.url); + + $scope.legacyPath = decodeURIComponent($routeParams.url); //$scope.$on('$routeChangeSuccess', function () { // var asdf = $element; //}); } + angular.module("umbraco").controller('Umbraco.LegacyController', LegacyController); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/common/legacy.html b/src/Umbraco.Web.UI.Client/src/views/common/legacy.html index 4dc61c234f..78d9e141d7 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/legacy.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/legacy.html @@ -1,3 +1,3 @@ -
- +
+
\ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/common/main.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/main.controller.js index fdfc4c349f..cd1c6c0162 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/main.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/main.controller.js @@ -8,7 +8,7 @@ * The main application controller * */ -function MainController($scope, $routeParams, $rootScope, $timeout, notificationsService, userService, navigationService, legacyJsLoader) { +function MainController($scope, $routeParams, $rootScope, $timeout, $http, notificationsService, userService, navigationService, legacyJsLoader) { //debugmode so I can easily turn on/off json output of property models: //TODO: find a better way $scope.$umbdebugmode = true; @@ -17,6 +17,7 @@ function MainController($scope, $routeParams, $rootScope, $timeout, notification //the null is important because we do an explicit bool check on this in the view $scope.authenticated = null; + $scope.avatar = "assets/img/application/logo.png"; //subscribes to notifications in the notification service $scope.notifications = notificationsService.current; @@ -58,6 +59,15 @@ function MainController($scope, $routeParams, $rootScope, $timeout, notification $scope.authenticated = data.authenticated; $scope.user = data.user; + + + if($scope.user.avatar){ + $http.get($scope.user.avatar).then(function(){ + alert($scope.user.avatar); + $scope.avatar = $scope.user.avatar; + }); + } + }, function (reason) { notificationsService.error("An error occurred checking authentication."); diff --git a/src/Umbraco.Web.UI.Client/src/views/common/navigation.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/navigation.controller.js index 6186cb7532..c285532917 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/navigation.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/navigation.controller.js @@ -18,7 +18,7 @@ function NavigationController($scope,$rootScope, $location, $log, navigationServ //trigger search with a hotkey: keyboardService.bind("ctrl+shift+s", function(){ - $scope.nav.showTree($scope.ui.currentSection); + $scope.nav.showTree($scope.nav.currentSection); }); //the tree event handler i used to subscribe to the main tree click events @@ -90,8 +90,7 @@ function NavigationController($scope,$rootScope, $location, $log, navigationServ }); /** Opens a dialog but passes in this scope instance to be used for the dialog */ - $scope.openDialog = function (currentNode, action, currentSection) { - + $scope.openDialog = function (currentNode, action, currentSection) { navigationService.showDialog({ scope: $scope, node: currentNode, diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js index 1c15c89b08..8b34ef129b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js @@ -1,114 +1,114 @@ -/** - * @ngdoc controller - * @name Umbraco.Editors.Content.EditController - * @function - * - * @description - * The controller for the content editor - */ -function ContentEditController($scope, $routeParams, $location, contentResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper) { - - if ($routeParams.create) { - //we are creating so get an empty content item - contentResource.getScaffold($routeParams.id, $routeParams.doctype) - .then(function(data) { - $scope.loaded = true; - $scope.content = data; - }); - } - else { - //we are editing so get the content item from the server - contentResource.getById($routeParams.id) - .then(function(data) { - $scope.loaded = true; - $scope.content = data; - - //in one particular special case, after we've created a new item we redirect back to the edit - // route but there might be server validation errors in the collection which we need to display - // after the redirect, so we will bind all subscriptions which will show the server validation errors - // if there are any and then clear them so the collection no longer persists them. - serverValidationManager.executeAndClearAllSubscriptions(); - }); - } - - $scope.files = []; - $scope.addFiles = function (propertyId, files) { - //this will clear the files for the current property and then add the new ones for the current property - $scope.files = _.reject($scope.files, function (item) { - return item.id == propertyId; - }); - for (var i = 0; i < files.length; i++) { - //save the file object to the scope's files collection - $scope.files.push({ id: propertyId, file: files[i] }); - } - }; - - //TODO: Need to figure out a way to share the saving and event broadcasting with all editors! - - $scope.saveAndPublish = function () { - $scope.$broadcast("saving", { scope: $scope }); - - var currentForm = angularHelper.getRequiredCurrentForm($scope); - - //don't continue if the form is invalid - if (currentForm.$invalid) return; - - serverValidationManager.reset(); - - contentResource.publish($scope.content, $routeParams.create, $scope.files) - .then(function (data) { - - contentEditingHelper.handleSuccessfulSave({ - scope: $scope, - newContent: data, - rebindCallback: contentEditingHelper.reBindChangedProperties( - contentEditingHelper.getAllProps($scope.content), - contentEditingHelper.getAllProps(data)) - }); - - }, function (err) { - - var allNewProps = contentEditingHelper.getAllProps(err.data); - var allOrigProps = contentEditingHelper.getAllProps($scope.content); - - contentEditingHelper.handleSaveError({ - err: err, - redirectOnFailure: true, - allNewProps: allNewProps, - allOrigProps: contentEditingHelper.getAllProps($scope.content), - rebindCallback: contentEditingHelper.reBindChangedProperties(allOrigProps, allNewProps) - }); - }); - }; - - $scope.save = function () { - $scope.$broadcast("saving", { scope: $scope }); - - var currentForm = angularHelper.getRequiredCurrentForm($scope); - - //don't continue if the form is invalid - if (currentForm.$invalid) return; - - serverValidationManager.reset(); - - contentResource.save($scope.content, $routeParams.create, $scope.files) - .then(function (data) { - - contentEditingHelper.handleSuccessfulSave({ - scope: $scope, - newContent: data, - rebindCallback: contentEditingHelper.reBindChangedProperties(scope.content, data) - }); - - }, function (err) { - contentEditingHelper.handleSaveError({ - err: err, - allNewProps: contentEditingHelper.getAllProps(err.data), - allOrigProps: contentEditingHelper.getAllProps($scope.content) - }); - }); - }; - -} - -angular.module("umbraco").controller("Umbraco.Editors.Content.EditController", ContentEditController); +/** + * @ngdoc controller + * @name Umbraco.Editors.Content.EditController + * @function + * + * @description + * The controller for the content editor + */ +function ContentEditController($scope, $routeParams, $location, contentResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper) { + + if ($routeParams.create) { + //we are creating so get an empty content item + contentResource.getScaffold($routeParams.id, $routeParams.doctype) + .then(function(data) { + $scope.loaded = true; + $scope.content = data; + }); + } + else { + //we are editing so get the content item from the server + contentResource.getById($routeParams.id) + .then(function(data) { + $scope.loaded = true; + $scope.content = data; + + //in one particular special case, after we've created a new item we redirect back to the edit + // route but there might be server validation errors in the collection which we need to display + // after the redirect, so we will bind all subscriptions which will show the server validation errors + // if there are any and then clear them so the collection no longer persists them. + serverValidationManager.executeAndClearAllSubscriptions(); + }); + } + + $scope.files = []; + $scope.addFiles = function (propertyId, files) { + //this will clear the files for the current property and then add the new ones for the current property + $scope.files = _.reject($scope.files, function (item) { + return item.id == propertyId; + }); + for (var i = 0; i < files.length; i++) { + //save the file object to the scope's files collection + $scope.files.push({ id: propertyId, file: files[i] }); + } + }; + + //TODO: Need to figure out a way to share the saving and event broadcasting with all editors! + + $scope.saveAndPublish = function () { + $scope.$broadcast("saving", { scope: $scope }); + + var currentForm = angularHelper.getRequiredCurrentForm($scope); + + //don't continue if the form is invalid + if (currentForm.$invalid) return; + + serverValidationManager.reset(); + + contentResource.publish($scope.content, $routeParams.create, $scope.files) + .then(function (data) { + + contentEditingHelper.handleSuccessfulSave({ + scope: $scope, + newContent: data, + rebindCallback: contentEditingHelper.reBindChangedProperties( + contentEditingHelper.getAllProps($scope.content), + contentEditingHelper.getAllProps(data)) + }); + + }, function (err) { + + var allNewProps = contentEditingHelper.getAllProps(err.data); + var allOrigProps = contentEditingHelper.getAllProps($scope.content); + + contentEditingHelper.handleSaveError({ + err: err, + redirectOnFailure: true, + allNewProps: allNewProps, + allOrigProps: contentEditingHelper.getAllProps($scope.content), + rebindCallback: contentEditingHelper.reBindChangedProperties(allOrigProps, allNewProps) + }); + }); + }; + + $scope.save = function () { + $scope.$broadcast("saving", { scope: $scope }); + + var currentForm = angularHelper.getRequiredCurrentForm($scope); + + //don't continue if the form is invalid + if (currentForm.$invalid) return; + + serverValidationManager.reset(); + + contentResource.save($scope.content, $routeParams.create, $scope.files) + .then(function (data) { + + contentEditingHelper.handleSuccessfulSave({ + scope: $scope, + newContent: data, + rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data) + }); + + }, function (err) { + contentEditingHelper.handleSaveError({ + err: err, + allNewProps: contentEditingHelper.getAllProps(err.data), + allOrigProps: contentEditingHelper.getAllProps($scope.content) + }); + }); + }; + +} + +angular.module("umbraco").controller("Umbraco.Editors.Content.EditController", ContentEditController); diff --git a/src/Umbraco.Web.UI.Client/src/views/directives/umb-navigation.html b/src/Umbraco.Web.UI.Client/src/views/directives/umb-navigation.html index 6cc0e2e1de..adbfb642c0 100644 --- a/src/Umbraco.Web.UI.Client/src/views/directives/umb-navigation.html +++ b/src/Umbraco.Web.UI.Client/src/views/directives/umb-navigation.html @@ -4,7 +4,7 @@
  • - +
  • diff --git a/src/Umbraco.Web.UI.Client/test/unit/common/services/keyboard-service.spec.js b/src/Umbraco.Web.UI.Client/test/unit/common/services/keyboard-service.spec.js index 32888d9a02..82f7766d40 100644 --- a/src/Umbraco.Web.UI.Client/test/unit/common/services/keyboard-service.spec.js +++ b/src/Umbraco.Web.UI.Client/test/unit/common/services/keyboard-service.spec.js @@ -2,7 +2,7 @@ describe('keyboard service tests', function () { var keyboardService, $window; var createKeyEvent = function (mainKey, alt, ctrl, shift, meta) { - var keyEvent = jQuery.Event("keypress"); + var keyEvent = jQuery.Event("keydown"); keyEvent.keyCode = mainKey.charCodeAt(0); keyEvent.altKey = alt; keyEvent.ctrlKey = ctrl; @@ -26,17 +26,8 @@ describe('keyboard service tests', function () { var el = $(""); var ev = createKeyEvent("s", false, true, false); - el.keypress(function(ev) { - console.log(ev); - console.log("Handler for .keypress() called."); - }); - - - console.log("loaded"); - keyboardService.bind("ctrl+s", function(){ ctrls = true; - console.log("triggered"); }, el); //initially it should be false @@ -45,12 +36,9 @@ describe('keyboard service tests', function () { //trigger the ctrls+s event el.trigger(ev); - //it should now be true -// expect(ctrls).toBe(true); - - // expect(iconHelper.isFileBasedIcon(legacyBased)).toBe(false); - // expect(iconHelper.isFileBasedIcon(belleBased)).toBe(false); - }); + //it should now be true - this failes for some reason + //expect(ctrls).toBe(true); + }); /* it('detects a legacy icon', function () {