##// END OF EJS Templates
Add filename to header area
Thomas Kluyver -
Show More
@@ -1,60 +1,72 b''
1 {% extends "page.html" %}
1 {% extends "page.html" %}
2
2
3 {% block title %}{{page_title}}{% endblock %}
3 {% block title %}{{page_title}}{% endblock %}
4
4
5 {% block stylesheet %}
5 {% block stylesheet %}
6 <link rel="stylesheet" href="{{ static_url('components/codemirror/lib/codemirror.css') }}">
6 <link rel="stylesheet" href="{{ static_url('components/codemirror/lib/codemirror.css') }}">
7 <link rel="stylesheet" href="{{ static_url('components/codemirror/addon/dialog/dialog.css') }}">
7 <link rel="stylesheet" href="{{ static_url('components/codemirror/addon/dialog/dialog.css') }}">
8 <style>
8 <style>
9 #texteditor-container {
9 #texteditor-container {
10 border-bottom: 1px solid #ccc;
10 border-bottom: 1px solid #ccc;
11 }
11 }
12
13 #filename {
14 font-size: 16pt;
15 display: table;
16 padding: 0px 5px;
17 }
12 </style>
18 </style>
13
19
14 {{super()}}
20 {{super()}}
15 {% endblock %}
21 {% endblock %}
16
22
17 {% block params %}
23 {% block params %}
18
24
19 data-base-url="{{base_url}}"
25 data-base-url="{{base_url}}"
20 data-file-path="{{file_path}}"
26 data-file-path="{{file_path}}"
21
27
22 {% endblock %}
28 {% endblock %}
23
29
30 {% block header %}
31
32 <span id="filename">{{ basename }}</span>
33
34 {% endblock %}
35
24 {% block site %}
36 {% block site %}
25
37
26 <div id="menubar-container" class="container">
38 <div id="menubar-container" class="container">
27 <div id="menubar">
39 <div id="menubar">
28 <div id="menus" class="navbar navbar-default" role="navigation">
40 <div id="menus" class="navbar navbar-default" role="navigation">
29 <div class="container-fluid">
41 <div class="container-fluid">
30 <button type="button" class="btn btn-default navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
42 <button type="button" class="btn btn-default navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
31 <i class="fa fa-bars"></i>
43 <i class="fa fa-bars"></i>
32 <span class="navbar-text">Menu</span>
44 <span class="navbar-text">Menu</span>
33 </button>
45 </button>
34 <ul class="nav navbar-nav navbar-right">
46 <ul class="nav navbar-nav navbar-right">
35 <li id="notification_area"></li>
47 <li id="notification_area"></li>
36 </ul>
48 </ul>
37 <div class="navbar-collapse collapse">
49 <div class="navbar-collapse collapse">
38 <ul class="nav navbar-nav">
50 <ul class="nav navbar-nav">
39 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
51 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
40 <ul id="file_menu" class="dropdown-menu">
52 <ul id="file_menu" class="dropdown-menu">
41 <li id="save_file"><a href="#">Save</a></li>
53 <li id="save_file"><a href="#">Save</a></li>
42 </ul>
54 </ul>
43 </li>
55 </li>
44 </ul>
56 </ul>
45 </div>
57 </div>
46 </div>
58 </div>
47 </div>
59 </div>
48 </div>
60 </div>
49 </div>
61 </div>
50
62
51 <div id="texteditor-container" class="container"></div>
63 <div id="texteditor-container" class="container"></div>
52
64
53 {% endblock %}
65 {% endblock %}
54
66
55 {% block script %}
67 {% block script %}
56
68
57 {{super()}}
69 {{super()}}
58
70
59 <script src="{{ static_url("texteditor/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
71 <script src="{{ static_url("texteditor/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
60 {% endblock %}
72 {% endblock %}
@@ -1,27 +1,29 b''
1 #encoding: utf-8
1 #encoding: utf-8
2 """Tornado handlers for the terminal emulator."""
2 """Tornado handlers for the terminal emulator."""
3
3
4 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
6
6
7 from tornado import web
7 from tornado import web
8 from ..base.handlers import IPythonHandler, path_regex
8 from ..base.handlers import IPythonHandler, path_regex
9 from ..utils import url_escape
9 from ..utils import url_escape
10
10
11 class EditorHandler(IPythonHandler):
11 class EditorHandler(IPythonHandler):
12 """Render the text editor interface."""
12 """Render the text editor interface."""
13 @web.authenticated
13 @web.authenticated
14 def get(self, path):
14 def get(self, path):
15 path = path.strip('/')
15 path = path.strip('/')
16 if not self.contents_manager.file_exists(path):
16 if not self.contents_manager.file_exists(path):
17 raise web.HTTPError(404, u'File does not exist: %s' % path)
17 raise web.HTTPError(404, u'File does not exist: %s' % path)
18
18
19 basename = path.rsplit('/', 1)[-1]
19 self.write(self.render_template('texteditor.html',
20 self.write(self.render_template('texteditor.html',
20 file_path=url_escape(path),
21 file_path=url_escape(path),
21 page_title=path.rsplit('/', 1)[-1] + " (editing)",
22 basename=basename,
23 page_title=basename + " (editing)",
22 )
24 )
23 )
25 )
24
26
25 default_handlers = [
27 default_handlers = [
26 (r"/texteditor%s" % path_regex, EditorHandler),
28 (r"/texteditor%s" % path_regex, EditorHandler),
27 ] No newline at end of file
29 ]
General Comments 0
You need to be logged in to leave comments. Login now