Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
60527 views
1
//----------------------------------------------------------------------------
2
// Copyright (C) 2008-2011 The IPython Development Team
3
//
4
// Distributed under the terms of the BSD License. The full license is in
5
// the file COPYING, distributed as part of this software.
6
//----------------------------------------------------------------------------
7
8
//============================================================================
9
// Login button
10
//============================================================================
11
12
var IPython = (function (IPython) {
13
"use strict";
14
15
var LoginWidget = function (selector, options) {
16
options = options || {};
17
this.base_url = options.base_url || IPython.utils.get_body_data("baseUrl");
18
this.selector = selector;
19
if (this.selector !== undefined) {
20
this.element = $(selector);
21
this.style();
22
this.bind_events();
23
}
24
};
25
26
LoginWidget.prototype.style = function () {
27
this.element.find("button").addClass("btn btn-small");
28
};
29
30
31
LoginWidget.prototype.bind_events = function () {
32
var that = this;
33
this.element.find("button#logout").click(function () {
34
window.location = IPython.utils.url_join_encode(
35
that.base_url,
36
"logout"
37
);
38
});
39
this.element.find("button#login").click(function () {
40
window.location = IPython.utils.url_join_encode(
41
that.base_url,
42
"login"
43
);
44
});
45
};
46
47
// Set module variables
48
IPython.LoginWidget = LoginWidget;
49
50
return IPython;
51
52
}(IPython));
53
54