##// END OF EJS Templates
shrink login button
MinRK -
Show More
@@ -1,45 +1,45
1 //----------------------------------------------------------------------------
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2008-2011 The IPython Development Team
2 // Copyright (C) 2008-2011 The IPython Development Team
3 //
3 //
4 // Distributed under the terms of the BSD License. The full license is in
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
6 //----------------------------------------------------------------------------
7
7
8 //============================================================================
8 //============================================================================
9 // Login button
9 // Login button
10 //============================================================================
10 //============================================================================
11
11
12 var IPython = (function (IPython) {
12 var IPython = (function (IPython) {
13
13
14 var LoginWidget = function (selector, options) {
14 var LoginWidget = function (selector, options) {
15 var options = options || {};
15 var options = options || {};
16 this.base_url = options.baseProjectUrl || $('body').data('baseProjectUrl') ;
16 this.base_url = options.baseProjectUrl || $('body').data('baseProjectUrl') ;
17 this.selector = selector;
17 this.selector = selector;
18 if (this.selector !== undefined) {
18 if (this.selector !== undefined) {
19 this.element = $(selector);
19 this.element = $(selector);
20 this.style();
20 this.style();
21 this.bind_events();
21 this.bind_events();
22 }
22 }
23 };
23 };
24
24
25 LoginWidget.prototype.style = function () {
25 LoginWidget.prototype.style = function () {
26 this.element.find("button").addClass("btn");
26 this.element.find("button").addClass("btn btn-small");
27 };
27 };
28
28
29
29
30 LoginWidget.prototype.bind_events = function () {
30 LoginWidget.prototype.bind_events = function () {
31 var that = this;
31 var that = this;
32 this.element.find("button#logout").click(function () {
32 this.element.find("button#logout").click(function () {
33 window.location = that.base_url+"logout";
33 window.location = that.base_url+"logout";
34 });
34 });
35 this.element.find("button#login").click(function () {
35 this.element.find("button#login").click(function () {
36 window.location = that.base_url+"login";
36 window.location = that.base_url+"login";
37 });
37 });
38 };
38 };
39
39
40 // Set module variables
40 // Set module variables
41 IPython.LoginWidget = LoginWidget;
41 IPython.LoginWidget = LoginWidget;
42
42
43 return IPython;
43 return IPython;
44
44
45 }(IPython));
45 }(IPython));
General Comments 0
You need to be logged in to leave comments. Login now