Show More
@@ -1,47 +1,45 b'' | |||||
1 | // Copyright (c) IPython Development Team. |
|
1 | // Copyright (c) IPython Development Team. | |
2 | // Distributed under the terms of the Modified BSD License. |
|
2 | // Distributed under the terms of the Modified BSD License. | |
3 |
|
3 | |||
4 | define([ |
|
4 | define([ | |
5 | 'base/js/namespace', |
|
5 | 'base/js/namespace', | |
6 | 'base/js/utils', |
|
6 | 'base/js/utils', | |
7 | 'jquery', |
|
7 | 'jquery', | |
8 | ], function(IPython, utils, $){ |
|
8 | ], function(IPython, utils, $){ | |
9 | "use strict"; |
|
9 | "use strict"; | |
10 |
|
10 | |||
11 | var LoginWidget = function (selector, options) { |
|
11 | var LoginWidget = function (selector, options) { | |
12 | options = options || {}; |
|
12 | options = options || {}; | |
13 | this.base_url = options.base_url || utils.get_body_data("baseUrl"); |
|
13 | this.base_url = options.base_url || utils.get_body_data("baseUrl"); | |
14 | this.selector = selector; |
|
14 | this.selector = selector; | |
15 | if (this.selector !== undefined) { |
|
15 | if (this.selector !== undefined) { | |
16 | this.element = $(selector); |
|
16 | this.element = $(selector); | |
17 | this.style(); |
|
17 | this.style(); | |
18 | this.bind_events(); |
|
18 | this.bind_events(); | |
19 | } |
|
19 | } | |
20 | }; |
|
20 | }; | |
21 |
|
21 | |||
22 | LoginWidget.prototype.style = function () { |
|
22 | LoginWidget.prototype.style = function () {}; | |
23 | this.element.find("button").addClass("btn btn-default btn-sm"); |
|
|||
24 | }; |
|
|||
25 |
|
23 | |||
26 |
|
24 | |||
27 | LoginWidget.prototype.bind_events = function () { |
|
25 | LoginWidget.prototype.bind_events = function () { | |
28 | var that = this; |
|
26 | var that = this; | |
29 | this.element.find("button#logout").click(function () { |
|
27 | this.element.find("button#logout").click(function () { | |
30 | window.location = utils.url_join_encode( |
|
28 | window.location = utils.url_join_encode( | |
31 | that.base_url, |
|
29 | that.base_url, | |
32 | "logout" |
|
30 | "logout" | |
33 | ); |
|
31 | ); | |
34 | }); |
|
32 | }); | |
35 | this.element.find("button#login").click(function () { |
|
33 | this.element.find("button#login").click(function () { | |
36 | window.location = utils.url_join_encode( |
|
34 | window.location = utils.url_join_encode( | |
37 | that.base_url, |
|
35 | that.base_url, | |
38 | "login" |
|
36 | "login" | |
39 | ); |
|
37 | ); | |
40 | }); |
|
38 | }); | |
41 | }; |
|
39 | }; | |
42 |
|
40 | |||
43 | // Set module variables |
|
41 | // Set module variables | |
44 | IPython.LoginWidget = LoginWidget; |
|
42 | IPython.LoginWidget = LoginWidget; | |
45 |
|
43 | |||
46 | return {'LoginWidget': LoginWidget}; |
|
44 | return {'LoginWidget': LoginWidget}; | |
47 | }); No newline at end of file |
|
45 | }); |
@@ -1,102 +1,108 b'' | |||||
1 | /** |
|
1 | /** | |
2 | * Primary styles |
|
2 | * Primary styles | |
3 | * |
|
3 | * | |
4 | * Author: IPython Development Team |
|
4 | * Author: IPython Development Team | |
5 | */ |
|
5 | */ | |
6 |
|
6 | |||
7 |
|
7 | |||
8 | body { |
|
8 | body { | |
9 | background-color: white; |
|
9 | background-color: white; | |
10 | /* This makes sure that the body covers the entire window and needs to |
|
10 | /* This makes sure that the body covers the entire window and needs to | |
11 | be in a different element than the display: box in wrapper below */ |
|
11 | be in a different element than the display: box in wrapper below */ | |
12 | position: absolute; |
|
12 | position: absolute; | |
13 | left: 0px; |
|
13 | left: 0px; | |
14 | right: 0px; |
|
14 | right: 0px; | |
15 | top: 0px; |
|
15 | top: 0px; | |
16 | bottom: 0px; |
|
16 | bottom: 0px; | |
17 | overflow: visible; |
|
17 | overflow: visible; | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | div#header { |
|
20 | div#header { | |
21 | /* Initially hidden to prevent FLOUC */ |
|
21 | /* Initially hidden to prevent FLOUC */ | |
22 | display: none; |
|
22 | display: none; | |
23 | margin-bottom: 0px; |
|
23 | margin-bottom: 0px; | |
24 | padding-left: 30px; |
|
24 | padding-left: 30px; | |
25 | padding-bottom: 5px; |
|
25 | padding-bottom: 5px; | |
26 | border-bottom: 1px solid @navbar-default-border; |
|
26 | border-bottom: 1px solid @navbar-default-border; | |
27 | .border-box-sizing(); |
|
27 | .border-box-sizing(); | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | #ipython_notebook { |
|
30 | #ipython_notebook { | |
31 | padding-left: 0px; |
|
31 | padding-left: 0px; | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | #noscript { |
|
34 | #noscript { | |
35 | width: auto; |
|
35 | width: auto; | |
36 | padding-top: 16px; |
|
36 | padding-top: 16px; | |
37 | padding-bottom: 16px; |
|
37 | padding-bottom: 16px; | |
38 | text-align: center; |
|
38 | text-align: center; | |
39 | font-size: 22px; |
|
39 | font-size: 22px; | |
40 | color: red; |
|
40 | color: red; | |
41 | font-weight: bold; |
|
41 | font-weight: bold; | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | #ipython_notebook img { |
|
44 | #ipython_notebook img { | |
45 | font-family: Verdana, "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
45 | font-family: Verdana, "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; | |
46 | height: 24px; |
|
46 | height: 24px; | |
47 | text-decoration:none; |
|
47 | text-decoration:none; | |
48 | color: black; |
|
48 | color: black; | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | #site { |
|
51 | #site { | |
52 | width: 100%; |
|
52 | width: 100%; | |
53 | display: none; |
|
53 | display: none; | |
54 | .border-box-sizing(); |
|
54 | .border-box-sizing(); | |
55 | } |
|
55 | } | |
56 |
|
56 | |||
57 | /* Smaller buttons */ |
|
57 | /* Smaller buttons */ | |
58 | .ui-button .ui-button-text { |
|
58 | .ui-button .ui-button-text { | |
59 | padding: 0.2em 0.8em; |
|
59 | padding: 0.2em 0.8em; | |
60 | font-size: 77%; |
|
60 | font-size: 77%; | |
61 | } |
|
61 | } | |
62 |
|
62 | |||
63 | input.ui-button { |
|
63 | input.ui-button { | |
64 | padding: 0.3em 0.9em; |
|
64 | padding: 0.3em 0.9em; | |
65 | } |
|
65 | } | |
66 | .navbar span { |
|
66 | .navbar span { | |
67 | margin-top: 3px; |
|
67 | margin-top: 3px; | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 | span#login_widget { |
|
70 | span#login_widget { | |
71 | float: right; |
|
71 | float: right; | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
|
74 | span#login_widget > .button { | |||
|
75 | .btn(); | |||
|
76 | .btn-default(); | |||
|
77 | .btn-sm(); | |||
|
78 | } | |||
|
79 | ||||
74 | .nav-header { |
|
80 | .nav-header { | |
75 | text-transform: none; |
|
81 | text-transform: none; | |
76 | } |
|
82 | } | |
77 |
|
83 | |||
78 | #header > span { |
|
84 | #header > span { | |
79 | margin-top: 10px; |
|
85 | margin-top: 10px; | |
80 | } |
|
86 | } | |
81 |
|
87 | |||
82 | // class for stretching dialogs to fill the screen |
|
88 | // class for stretching dialogs to fill the screen | |
83 | .modal_stretch .modal-dialog { |
|
89 | .modal_stretch .modal-dialog { | |
84 | .vbox(); |
|
90 | .vbox(); | |
85 | min-height: 80%; |
|
91 | min-height: 80%; | |
86 | .modal-body { |
|
92 | .modal-body { | |
87 | max-height: none; |
|
93 | max-height: none; | |
88 | flex: 1; |
|
94 | flex: 1; | |
89 | } |
|
95 | } | |
90 | } |
|
96 | } | |
91 |
|
97 | |||
92 | @media (min-width: 768px) { |
|
98 | @media (min-width: 768px) { | |
93 | .modal .modal-dialog { |
|
99 | .modal .modal-dialog { | |
94 | width: 700px; |
|
100 | width: 700px; | |
95 | } |
|
101 | } | |
96 | } |
|
102 | } | |
97 |
|
103 | |||
98 | // less mixin to be sure to add the right class to get icons with font awesome. |
|
104 | // less mixin to be sure to add the right class to get icons with font awesome. | |
99 | .icon(@ico){ |
|
105 | .icon(@ico){ | |
100 | .fa(); |
|
106 | .fa(); | |
101 | content: @ico; |
|
107 | content: @ico; | |
102 | } |
|
108 | } |
General Comments 0
You need to be logged in to leave comments.
Login now