Dang... I'd looked at that section of the manual, and I'd compared my code 
with the example from the text I'm working out of and I would have sworn 
that it was identical and correct.  Heck, it took me a few passes to pick 
up what was missing even in your example.  Guess that happens when you keep 
staring at the same thing too long - you start seeing things that *aren't* 
there.

Thanks,

Monte

On Tuesday, May 7, 2013 5:31:51 PM UTC-7, 黄祥 wrote:
>
> please check the book on :
> http://web2py.com/books/default/chapter/29/05?search=menu#Page-layout
>
> response.menu menu is a list of 3-tuples or 4-tuples. The three elements 
> are: the link name, a boolean representing whether the link is active (is 
> the current link), and the URL of the linked page. For example:
>
> response.menu = [('Google', False, 'http://www.google.com',[]),
>                  ('Index',  True,  URL('index'), [])]
>
> sub-menu
>
> The fourth tuple element is an optional sub-menu.
> response.menu = [
>     (T('Home'), False, URL('default', 'index'), []),
>     (T('Add project'), URL('default', 'add'), []),
>     (T('Add company'), URL('default', 'company'), []),
>     (T('Employees'), URL('default', 'employee'), [])]
>
> should be
> response.menu = [
>     (T('Home'), False, URL('default', 'index'), []),
>     (T('Add project'), False, URL('default', 'add'), []),
>     (T('Add company'), False, URL('default', 'company'), []),
>     (T('Employees'),False,  URL('default', 'employee'), [])]
>
> best regards
>
> On Wednesday, May 8, 2013 7:04:15 AM UTC+7, Monte Milanuk wrote:
>>
>> So... I have a couple functions defined in default.py:
>>
>> @auth.requires_login()
>> def index():
>>     response.flash = T('Welcome!')
>>     grid = SQLFORM.grid(db.project, create=False,
>>             fields=[db.project.name, db.project.employee_name,
>>                 db.project.company_name, db.project.start_date,
>>                 db.project.due_date, db.project.completed],
>>             deletable=False, maxtextlength=50)
>>     return locals()
>>
>> @auth.requires_login()
>> def company():
>>     company_form = SQLFORM(db.company).process()
>>     return dict(company_form=company_form)
>>
>> @auth.requires_login()
>> def add():
>>     project_form = SQLFORM(db.project).process()
>>     return dict(project_form=project_form)
>>
>> ...and corresponding views that work when I go to them directly by typing 
>> the URL into the browser i.e. 
>> http://127.0.0.1:8000/task_manager/default/add or 
>> http://127.0.0.1:8000/task_manager/default/company.  I've added some 
>> code to define menu options in menu.py.  
>>
>> response.menu = [
>>     (T('Home'), False, URL('default', 'index'), []),
>>     (T('Add project'), URL('default', 'add'), []),
>>     (T('Add company'), URL('default', 'company'), []),
>>     (T('Employees'), URL('default', 'employee'), [])]
>>
>> DEVELOPMENT_MENU = False
>>
>> The links appear in the nav bar region, but they don't work and the URLs 
>> aren't what was defined.  If I'm on the main index page, all the URLs link 
>> to 'http://127.0.0.1:8000/task_manager/default/index/#'.  If I'm on the 
>> 'Add Project' page, all the URLs other than 'Home' link to '
>> http://127.0.0.1:8000/task_manager/default/add/#', and so on for the 
>> 'Company' page, etc.
>>
>> What do I need to do to get my nav bar menu working correctly?
>>
>> TIA,
>>
>> Monte
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to