Add example logout action

This commit is contained in:
Brian Federle 2011-11-23 15:34:15 -08:00
parent 19f297577e
commit e2a889ed5f
2 changed files with 20 additions and 5 deletions

View File

@ -29,8 +29,7 @@
$(function() {
var $container = $('#cloudStack3-container');
// Login
cloudStack.uiCustom.login({
var loginArgs = {
$container: $container,
// Use this for checking the session, to bypass login screen
@ -66,6 +65,10 @@
return args.response.error();
},
logoutAction: function(args) {
document.location.reload();
},
complete: function(args) {
var context = {
users: [args.user]
@ -94,7 +97,17 @@
}
}
});
// Logout action
$('#user-options a').live('click', function() {
loginArgs.logoutAction({
context: cloudStack.context
});
});
}
});
};
// Login
cloudStack.uiCustom.login(loginArgs);
});
})(cloudStack, jQuery, testData);

View File

@ -36,7 +36,7 @@
$(function() {
var $container = $('#cloudStack3-container');
cloudStack.uiCustom.login({
var loginArgs = {
$container: $container,
// Use this for checking the session, to bypass login screen
@ -180,6 +180,8 @@
}
});
}
});
};
cloudStack.uiCustom.login(loginArgs);
});
})(cloudStack, jQuery, testData);