Fixes dashboard redirect on login

This commit is contained in:
perploug
2013-08-20 15:20:46 +02:00
parent ab2be923ff
commit 2e90e354bc
5 changed files with 28 additions and 15 deletions

View File

@@ -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) {

View File

@@ -8,11 +8,13 @@
*
*/
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);

View File

@@ -1,3 +1,3 @@
<div ng-controller="Umbraco.LegacyController" id="legacyContainer" style="width: 100%; height: 100%;overflow: hidden;">
<iframe name="right" id="right" ng-src="{{legacyPath}}"></iframe>
<div ng-controller="Umbraco.LegacyController" id="legacyContainer" style="width: 100%; height: 100%;overflow: hidden;">
<iframe name="right" id="right" ng-src="{{legacyPath}}" data-src="{{legacyPath}}"></iframe>
</div>

View File

@@ -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.");

View File

@@ -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,