From 1c77fdd9e1e0aee6b75efde31f303e8a019befba Mon Sep 17 00:00:00 2001 From: ilvalle Date: Mon, 29 Apr 2013 08:52:24 +0200 Subject: [PATCH] 'File list' sidebar when editing a page in admin --- applications/admin/views/default/edit.html | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/applications/admin/views/default/edit.html b/applications/admin/views/default/edit.html index 8f6e6559..a3ed3eff 100644 --- a/applications/admin/views/default/edit.html +++ b/applications/admin/views/default/edit.html @@ -3,6 +3,16 @@ {{ def shortcut(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)) + files = [x.replace('\\', '/') for x in files if not x.endswith('.bak')] + return files + + def editfile(path,file,vars={}): + args=(path,file) if 'app' in vars else (app,path,file) + return A(file, _class='', _href=URL('edit', args=args, vars=vars), _style='word-wrap: break-word;') + }} {{if TEXT_EDITOR == 'amy':}} {{include 'default/amy_ajax.html'}} @@ -128,8 +138,31 @@ jQuery(document).ready(function(){ {{=T('docs')}}

    -
    -
    +
    + + + +