diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index e005e091..51faf83a 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -568,19 +568,10 @@ def edit(): section='editor', default_values=editor_defaults) preferences = config.read() - if not(request.ajax): + if not(request.ajax) and not(is_mobile): # return the scaffolding, the rest will be through ajax requests response.title = T('Editing %s') % app - editarea_preferences = {} - editarea_preferences['FONT_SIZE'] = '10' - editarea_preferences['FULL_SCREEN'] = 'false' - editarea_preferences['ALLOW_TOGGLE'] = 'true' - editarea_preferences['REPLACE_TAB_BY_SPACES'] = '4' - editarea_preferences['DISPLAY'] = 'onload' - for key in editarea_preferences: - if key in globals(): - editarea_preferences[key] = globals()[key] - return response.render ('default/edit.html', dict(app=request.args[0], editor_settings=preferences, editarea_preferences=editarea_preferences)) + return response.render ('default/edit.html', dict(app=request.args[0], editor_settings=preferences)) # show settings tab and save prefernces if 'settings' in request.vars: @@ -615,7 +606,7 @@ def edit(): elif filename[-4:] == '.css': filetype = 'css' elif filename[-3:] == '.js': - filetype = 'js' + filetype = 'javascript' else: filetype = 'html' @@ -769,7 +760,10 @@ def edit(): force= True if (request.vars.restore or request.vars.revert) else False) plain_html = response.render('default/edit_js.html', file_details) file_details['plain_html'] = plain_html - return response.json(file_details) + if is_mobile: + return response.render('default.mobile/edit.html', file_details, editor_settings=preferences) + else: + return response.json(file_details) def resolve(): diff --git a/applications/admin/models/0.py b/applications/admin/models/0.py index e91ea5cd..669ffd27 100644 --- a/applications/admin/models/0.py +++ b/applications/admin/models/0.py @@ -8,42 +8,6 @@ WEB2PY_VERSION_URL = WEB2PY_URL + '/examples/default/version' # the user-interface feature that allows you to edit files in your web # browser. -## Default editor (to change editor you need web2py.admin.editors.zip) -## old editors like 'ace' or 'edit_area' or 'amy' are no longer supported -TEXT_EDITOR = 'codemirror' - -## Editor Color scheme (only for ace) -TEXT_EDITOR_THEME = ( - "chrome", "clouds", "clouds_midnight", "cobalt", "crimson_editor", "dawn", - "dreamweaver", "eclipse", "idle_fingers", "kr_theme", "merbivore", - "merbivore_soft", "monokai", "mono_industrial", "pastel_on_dark", - "solarized_dark", "solarized_light", "textmate", "tomorrow", - "tomorrow_night", "tomorrow_night_blue", "tomorrow_night_bright", - "tomorrow_night_eighties", "twilight", "vibrant_ink")[0] - -## Editor Keyboard bindings (only for ace and codemirror) -TEXT_EDITOR_KEYBINDING = '' # 'emacs' or 'vi' - -### edit_area only -# The default font size, measured in 'points'. The value must be an integer > 0 -FONT_SIZE = 10 - -# Displays the editor in full screen mode. The value must be 'true' or 'false' -FULL_SCREEN = 'false' - -# Display a check box under the editor to allow the user to switch -# between the editor and a simple -# HTML text area. The value must be 'true' or 'false' -ALLOW_TOGGLE = 'true' - -# Replaces tab characters with space characters. -# The value can be 'false' (meaning that tabs are not replaced), -# or an integer > 0 that specifies the number of spaces to replace a tab with. -REPLACE_TAB_BY_SPACES = 4 - -# Toggle on/off the code editor instead of textarea on startup -DISPLAY = "onload" or "later" - # if demo mode is True then admin works readonly and does not require login DEMO_MODE = False diff --git a/applications/admin/views/default.mobile/amy_ajax.html b/applications/admin/views/default.mobile/amy_ajax.html deleted file mode 100644 index 718d27ed..00000000 --- a/applications/admin/views/default.mobile/amy_ajax.html +++ /dev/null @@ -1,77 +0,0 @@ - - - -{{if request.args[1]=="views":}} - -{{else:}} - -{{pass}} - - - - diff --git a/applications/admin/views/default.mobile/edit.html b/applications/admin/views/default.mobile/edit.html index c31bb0f9..09e6c101 100644 --- a/applications/admin/views/default.mobile/edit.html +++ b/applications/admin/views/default.mobile/edit.html @@ -1,55 +1,41 @@ {{extend 'default.mobile/layout.html'}} - -{{ - def shortcut(combo, description): - return XML('
  • %s %s
  • ' % (combo, description)) -}} - -{{if TEXT_EDITOR == 'amy':}} -{{include 'default/amy_ajax.html'}} + - - + var current_closetag = false; //Default closetag {{pass}} - -{{block sectionclass}}edit {{filename}}{{end}} - -{{if functions:}} -

    - - {{=B(T('exposes:'))}}{{=XML(', '.join([A(f,_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}} - -
    -
    - - {{=IMG(_src=URL('static', 'images/save_icon.png'), _alt=T('Save'))}} - - {{=T('Saved file hash:')}} - - {{=T('Last saved on:')}} - {{if TEXT_EDITOR=='amy':}} - - {{else:}} - - {{pass}} - - -
    -
    -
    +var current_font_incr = 0; // Default font-size, 0 means don't set + +{{cm=URL('static%s' % (response.static_version and '/_' + response.static_version or ''),'codemirror')}} + + + + + +{{if editor_settings['editor'] != 'default':}}{{pass}} + + + + + + + + + + + + + + + + + + + + +
    {{=XML(plain_html)}}
    diff --git a/applications/admin/views/default/amy_ajax.html b/applications/admin/views/default/amy_ajax.html deleted file mode 100644 index 718d27ed..00000000 --- a/applications/admin/views/default/amy_ajax.html +++ /dev/null @@ -1,77 +0,0 @@ - - - -{{if request.args[1]=="views":}} - -{{else:}} - -{{pass}} - - - - diff --git a/applications/admin/views/default/edit_js.html b/applications/admin/views/default/edit_js.html index 3239d930..8096fbd9 100644 --- a/applications/admin/views/default/edit_js.html +++ b/applications/admin/views/default/edit_js.html @@ -78,7 +78,7 @@ return marker; } - {{if filetype in ('html', 'js', 'css'):}} + {{if filetype in ('html', 'javascript', 'css'):}} // must be here or break emmet/zencoding CodeMirror.defaults.extraKeys["Ctrl-S"] = function(instance) { @@ -137,7 +137,7 @@
    - {{if TEXT_EDITOR == 'codemirror' and filetype=='html':}} + {{if filetype=='html':}}

    {{=T('Key bindings for ZenCoding Plugin')}}

    - {{elif TEXT_EDITOR == 'codemirror':}} + {{else:}}

    {{=T("Key bindings")}}