initial import for tabs in the online editor
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
{{def shortcut(combo, description):
|
||||
return XML('<li><span class="teletype-text">%s</span><span>%s</span></li>' % (combo, description))
|
||||
|
||||
##TODO
|
||||
#eseguire dolistbreakpoint ogni volta che si fa una load
|
||||
}}
|
||||
|
||||
<form action="{{=URL('edit', args=filename)}}" method="post" name="editform" id="editform" class="form-inline">
|
||||
<div class="span12 well well-small">
|
||||
<label class="">{{=T('Save file:')}}</label>
|
||||
<a value="save" title="{{=T('Save file: %s', filename)}}" href="#" name="save" onclick="return doClickSave();" class="icon saveicon" style="background-image: -webkit-linear-gradient(top,white,#E6E6E6);">{{=IMG(_src=URL('static', 'images/save_icon.png'), _alt=T('Save'))}}</a>
|
||||
<label class="">{{=T('Saved file hash:')}}</label>
|
||||
<input type="input" name="file_hash" value="{{=file_hash}}" class="input-long uneditable-input" readonly="readonly"/>
|
||||
<label>{{=T('Last saved on:')}}</label>
|
||||
<input type="input" name="saved_on" value="{{=saved_on}}" class="input-normal uneditable-input" readonly="readonly"/>
|
||||
{{if filetype=='python':}}
|
||||
{{=A(SPAN(T('toggle breakpoint')),
|
||||
_value="breakpoint", _name="breakpoint",
|
||||
_onclick="return doToggleBreakpoint('%s','%s://%s%s',null);" % (filename,
|
||||
request.env['wsgi_url_scheme'], request.env['http_host'],
|
||||
URL(c='debug', f='toggle_breakpoint')),
|
||||
_class="button special btn btn-inverse")}}
|
||||
{{pass}}
|
||||
{{if view_link:}}
|
||||
{{=button(view_link, T('try view'))}}
|
||||
{{pass}}
|
||||
<p class="formfield">
|
||||
{{if functions:}}
|
||||
<span style="text-align:left;" id="exposed">
|
||||
{{=B(T('exposes:'))}} {{=XML(', '.join([A(f,_target="_blank", _href=URL(a=app,c=controller,f=f)).xml() for f in functions]))}}
|
||||
</span>
|
||||
{{if editviewlinks:}}<br/>
|
||||
{{=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}}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<textarea style=" height:100%; direction:ltr;" id="textarea_{{=id}}" class="input-block-level" name="data" >{{=data}}</textarea>
|
||||
<script>
|
||||
var cm_opts = {
|
||||
{{if filetype=='html':}}
|
||||
mode : "text/html", lineNumbers : true,
|
||||
profile: 'xhtml',
|
||||
{{else:}}
|
||||
mode: { name: '{{=filetype}}'{{if filetype=='python':}},version: 2,singleLineStringErrors: false{{pass}} },
|
||||
{{pass}}
|
||||
lineNumbers: true,
|
||||
indentUnit: 4,
|
||||
theme: "web2py",
|
||||
tabMode: "shift",
|
||||
lineWrapping: true,
|
||||
{{if TEXT_EDITOR_KEYBINDING == 'emacs':}}keyMap: "emacs",{{pass}}
|
||||
{{if TEXT_EDITOR_KEYBINDING == 'vi':}}keyMap: "vim",{{pass}}
|
||||
matchBrackets: true,
|
||||
autofocus: false,
|
||||
height: "350px",
|
||||
onCursorActivity: function() {
|
||||
editor.setLineClass(hlLine, null, null);
|
||||
hlLine = editor.setLineClass(editor.getCursor().line, null, "activeline");},
|
||||
onGutterClick: function(cm, n) {
|
||||
sel = {start: n, end: n, data: ''};
|
||||
doToggleBreakpoint({{=XML("'%s','%s://%s%s',sel" % (filename,
|
||||
request.env['wsgi_url_scheme'], request.env['http_host'],
|
||||
URL(c='debug', f='toggle_breakpoint')))}});
|
||||
}
|
||||
};
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("textarea_{{=id}}"),cm_opts);
|
||||
// save the editor as textarea data attribute
|
||||
jQuery("#{{=id}} textarea").data('editor', editor);
|
||||
var hlLine = editor.setLineClass(0, "activeline");
|
||||
window.mirror = editor; //backward compatibility
|
||||
</script>
|
||||
|
||||
<div class="editor-bar-bottom" style="margin-top:9px;">
|
||||
<a class="editbutton btn" href="{{=URL('edit', args=request.args, vars={'restore':True})}}" id="restore">{{=T('restore')}}</a>
|
||||
{{=T('currently saved or')}}
|
||||
<a class="editbutton btn" href="{{=URL('edit', args=request.args, vars={'revert':True})}}" id="revert">{{=T('revert')}}</a>
|
||||
{{=T('to previous version.')}}
|
||||
</div>
|
||||
<br/>
|
||||
</form>
|
||||
|
||||
<div class="span10 row-fluid">
|
||||
<div class="help span4 alert alert-block alert-info">
|
||||
{{if TEXT_EDITOR == 'codemirror' and filetype=='html':}}
|
||||
<h3>{{=T('Key bindings for ZenCoding Plugin')}}</h3>
|
||||
<ul class="keybindings unstyled">
|
||||
{{=shortcut('Ctrl+S', T('Save via Ajax'))}}
|
||||
{{=shortcut('Ctrl+F11', T('Toggle 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('Tab', T('Expand Abbreviation'))}}
|
||||
</ul>
|
||||
{{elif TEXT_EDITOR == 'codemirror':}}
|
||||
<h3>{{=T("Key bindings")}}</h3>
|
||||
<ul class="keybindings unstyled">
|
||||
{{=shortcut('Ctrl+S', T('Save via Ajax'))}}
|
||||
{{=shortcut('Ctrl+F11', T('Toggle 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'))}}
|
||||
</ul>
|
||||
{{pass}}
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user