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