From 7dd99cf3a1d7522c73c8529a633d1d45338df499 Mon Sep 17 00:00:00 2001
From: ilvalle
Date: Tue, 21 Jan 2014 14:45:56 +0100
Subject: [PATCH 1/2] online editor: shortcuts in a separated frame and style
review
---
.../admin/static/css/web2py-codemirror.css | 10 ++++
applications/admin/views/default/edit.html | 11 ++--
applications/admin/views/default/edit_js.html | 56 ++++++-------------
.../admin/views/default/editor_shortcuts.html | 18 ++++++
applications/admin/views/layout.html | 2 +-
5 files changed, 52 insertions(+), 45 deletions(-)
create mode 100644 applications/admin/views/default/editor_shortcuts.html
diff --git a/applications/admin/static/css/web2py-codemirror.css b/applications/admin/static/css/web2py-codemirror.css
index 39b5311b..642bb8a6 100644
--- a/applications/admin/static/css/web2py-codemirror.css
+++ b/applications/admin/static/css/web2py-codemirror.css
@@ -54,3 +54,13 @@
overflow: inherit;
border-top: 1px solid #ddd;
}
+
+#editor_main {
+ margin-top:40px;
+ margin-bottom:40px;
+}
+
+#editform {
+ margin-bottom: 0px;
+}
+
diff --git a/applications/admin/views/default/edit.html b/applications/admin/views/default/edit.html
index 650752ca..4bdf032b 100644
--- a/applications/admin/views/default/edit.html
+++ b/applications/admin/views/default/edit.html
@@ -1,3 +1,4 @@
+{{main_id='editor_main'}}
{{extend 'layout.html'}}
{{
dirs=[{'name':'models', 'reg':'.*\.py$'},
@@ -30,7 +31,7 @@ def file_create_form(location, anchor=None, helptext=""):
{{
def shortcut(combo, description):
- return XML('%s%s' % (combo, description))
+ return XML('%s%s' % (combo, description))
def listfiles(app, dir, regexp='.*\.py$'):
files = sorted(
listdir(apath('%(app)s/%(dir)s/' % {'app':app, 'dir':dir}, r=request), regexp))
@@ -264,15 +265,17 @@ $(document).on('click', 'a.font_button', function (e) {
{{=LOAD('default', 'todolist.load', vars={'app':app}, ajax=True, timeout=60000, times="infinity")}}
+
+ {{include 'default/editor_shortcuts.html'}}
+
{{block footer}}
diff --git a/applications/admin/views/default/edit_js.html b/applications/admin/views/default/edit_js.html
index 571839b8..aa98822d 100644
--- a/applications/admin/views/default/edit_js.html
+++ b/applications/admin/views/default/edit_js.html
@@ -21,21 +21,23 @@
{{if view_link:}}
{{=button(view_link, T('try view'))}}
{{pass}}
-
-{{if functions:}}
-
- {{=B(T('exposes:'))}} {{=XML(', '.join([A(f,_target="_blank", _href=URL(a=app,c=controller,f=f)).xml() for f in functions]))}}
-
-{{if editviewlinks:}}
- {{=B(T('edit views:'))}}
- {{=XML(', '.join([v.xml() for v in editviewlinks]))}}
+{{if functions or edit_controller:}}
+
+ {{if functions:}}
+
+ {{=B(T('exposes:'))}} {{=XML(', '.join([A(f,_target="_blank", _href=URL(a=app,c=controller,f=f)).xml() for f in functions]))}}
+
+ {{if editviewlinks:}}
+ {{=B(T('edit views:'))}}
+ {{=XML(', '.join([v.xml() for v in editviewlinks]))}}
+ {{pass}}
+ {{pass}}
+ {{if edit_controller:}}
+ {{=B(T('edit controller:'))}}
+ {{=A(request.args[2]+'.py', _class="editor_filelink", _target="_blank", _href=edit_controller)}}
+ {{pass}}
+
{{pass}}
-{{pass}}
-{{if edit_controller:}}
- {{=B(T('edit controller:'))}}
- {{=A(request.args[2]+'.py', _class="editor_filelink", _target="_blank", _href=edit_controller)}}
-{{pass}}
-
@@ -152,29 +154,3 @@
-
-
-
- {{if filetype=='html':}}
-
{{=T('Key bindings for ZenCoding Plugin')}}
- {{else:}}
-
{{=T("Key bindings")}}
- {{pass}}
-
- {{=shortcut('Ctrl+S', T('Save via Ajax'))}}
- {{=shortcut('Ctrl+F11', T('Toggle Fullscreen'))}}
- {{=shortcut('Shift+Esc', T('Exit Fullscreen'))}}
- {{=shortcut('Ctrl-F / Cmd-F', T('Start searching'))}}
- {{=shortcut('Ctrl-G / Cmd-G', T('Find Next'))}}
- {{=shortcut('Shift-Ctrl-G / Shift-Cmd-G', T('Find Previous'))}}
- {{=shortcut('Shift-Ctrl-F / Cmd-Option-F', T('Replace'))}}
- {{=shortcut('Shift-Ctrl-R / Shift-Cmd-Option-F', T('Replace All'))}}
- {{=shortcut('Ctrl-/ ', T('Toggle comment'))}}
- {{if filetype=='html':}}
- {{=shortcut('Tab', T('Expand Abbreviation'))}}
- {{elif filetype=='python':}}
- {{=shortcut('Ctrl-Space', T('Autocomplete Python Code'))}}
- {{pass}}
-
-
-
diff --git a/applications/admin/views/default/editor_shortcuts.html b/applications/admin/views/default/editor_shortcuts.html
new file mode 100644
index 00000000..874921f9
--- /dev/null
+++ b/applications/admin/views/default/editor_shortcuts.html
@@ -0,0 +1,18 @@
+
+
{{=T("Keyboard shortcuts")}}
+
+
+ {{=shortcut('Ctrl+S', T('Save via Ajax'))}}
+ {{=shortcut('Ctrl+F11', T('Toggle Fullscreen'))}}
+ {{=shortcut('Shift+Esc', T('Exit Fullscreen'))}}
+ {{=shortcut('Ctrl-F / Cmd-F', T('Start searching'))}}
+ {{=shortcut('Ctrl-G / Cmd-G', T('Find Next'))}}
+ {{=shortcut('Shift-Ctrl-G / Shift-Cmd-G', T('Find Previous'))}}
+ {{=shortcut('Shift-Ctrl-F / Cmd-Option-F', T('Replace'))}}
+ {{=shortcut('Shift-Ctrl-R / Shift-Cmd-Option-F', T('Replace All'))}}
+ {{=shortcut('Ctrl-/ ', T('Toggle comment'))}}
+ {{=shortcut('Tab', T('Expand Abbreviation (html files only)'))}}
+ {{=shortcut('Ctrl-Space', T('Autocomplete Python Code'))}}
+
+
+
diff --git a/applications/admin/views/layout.html b/applications/admin/views/layout.html
index 4f3ab932..fe6ff812 100644
--- a/applications/admin/views/layout.html
+++ b/applications/admin/views/layout.html
@@ -44,7 +44,7 @@
-
+
{{=response.flash or ''}}
From d967e23791f56edc26196c9547d9ff01e6e5a664 Mon Sep 17 00:00:00 2001
From: ilvalle
Date: Wed, 22 Jan 2014 18:24:51 +0100
Subject: [PATCH 2/2] online editor: fix folding option
---
applications/admin/views/default/edit_js.html | 1 -
1 file changed, 1 deletion(-)
diff --git a/applications/admin/views/default/edit_js.html b/applications/admin/views/default/edit_js.html
index aa98822d..9d5aec52 100644
--- a/applications/admin/views/default/edit_js.html
+++ b/applications/admin/views/default/edit_js.html
@@ -65,7 +65,6 @@
height: "350px",
showTrailingSpace: true
});
- editor.foldCode(CodeMirror.Pos(8, 0));
editor.on("gutterClick", function(cm, n, gutter) {
if (gutter !== "breakpoints" ) return;