I got tired of going through the edit page to get to the view after
editing a controller so I modified admin/controllers/default.py and
admin/view/default/edit.html as shown below. The changes cause an
extra line of links to the views associated with the controller to
appear at the top of the page just above the 'exposes' line.  Not
heavily tested yet, but it seems to be working pretty well, so I
thought I'd share it.  No warranties and YMMV, as always :-)

Cheers,
Mike

Diffs are relative to 1.74.8
DEFAULT.PY
$ diff controllers/default.py ~/Downloads/web2py/applications/admin/
controllers/default.py
5c5
< from glob import glob
---
>
345d344
<     editviewlinks = None
353,375c352
<     elif filetype == 'python' and request.args[1] == 'controllers':
<         ## it's a controller file.
<         ## Create links to all of the associated view files.
<         app = request.args[0]
<         #print request.args
<         viewname = os.path.splitext(request.args[2])[0]
<         viewpath = os.path.join(app,'views',viewname)
<         aviewpath = apath(viewpath, r=request)
<         #print aviewpath
<         viewlist = []
<         if os.path.exists(aviewpath):
<             if os.path.isdir(aviewpath):
<                 viewlist = glob(os.path.join(aviewpath,'*.html'))
<         elif os.path.exists(aviewpath+'.html'):
<             viewlist.append(aviewpath+'.html')
<         #print viewlist
<         if len(viewlist):
<             editviewlinks = []
<             for v in viewlist:
<                 vfilepath = v[v.find(viewpath):]
<                 vfilebase = os.path.splitext(os.path.basename
(vfilepath))[0]
<                 editviewlinks.append(A(T(vfilebase), _href=URL
(r=request,f='edit',args=[vfilepath])))
<         #print editviewlinks
---
>
404,405c381
<                     editarea_preferences=editarea_preferences,
<                     editviewlinks=editviewlinks)
---
>                     editarea_preferences=editarea_preferences)

EDIT.HTML
$ diff views/default/edit.html ~/Downloads/web2py/applications/admin/
views/default/edit.html
19,24d18
< {{if editviewlinks:}}
< <br/>
< {{=T('Edit view:')}}
< {{=XML(', '.join([v.xml() for v in editviewlinks]))}} {{pass}}
< <br/>
< {{pass}}

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to