From 580bc6fd6e3e3cc4006474143092863db49f60dc Mon Sep 17 00:00:00 2001 From: ilvalle Date: Thu, 17 Oct 2013 16:10:53 +0200 Subject: [PATCH] editor works again when is_mobile=True (No tabs when is mobile) --- applications/admin/controllers/default.py | 7 +- .../admin/views/default.mobile/edit.html | 81 +++++++++---------- 2 files changed, 42 insertions(+), 46 deletions(-) diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index e005e091..64d3aec5 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -568,7 +568,7 @@ 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 = {} @@ -769,7 +769,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/views/default.mobile/edit.html b/applications/admin/views/default.mobile/edit.html index 58e5eeb0..09e6c101 100644 --- a/applications/admin/views/default.mobile/edit.html +++ b/applications/admin/views/default.mobile/edit.html @@ -1,48 +1,41 @@ {{extend 'default.mobile/layout.html'}} - -{{ - def shortcut(combo, description): - return XML('
  • %s %s
  • ' % (combo, description)) -}} - - - - - - -{{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}} -

    + +{{cm=URL('static%s' % (response.static_version and '/_' + response.static_version or ''),'codemirror')}} + + + + + +{{if editor_settings['editor'] != 'default':}}{{pass}} + + + + + + + + + + + + + + + + + + + + +
    {{=XML(plain_html)}}