Jack Park | 2 Jul 2012 01:45
Picon

[Lift] Odd menu behavior?

Could be my code, of course, but I don't see the bug. I am putting
menus across the top, inspired by the Twitter Bootstrap stuff. My code
is painting all the menus in the LocGroup "main" but no in the
LocGroup "user".

default.html in that region looks like this:

<span class="lift:TBNav.menuToTBNav?eager_eval=true">
  <span data-lift="lift:Menu.builder?top:class=nav;li_item:class=active;linkToSelf=true;expandAll=true;group=main"></span>
</span>
<span data-lift="lift:TBNav.menuToTBNav?eager_eval=true">
  <span data-lift="lift:Menu.builder?top:class=nav
secondary-nav;li_item:class=active;linkToSelf=true;expandAll=true;group=user"></span>
</span>

The first <span> is painting content, the second <span> is empty when
viewing elements.

The boot.scala code which drives this looks like this:

    val entries = List(Menu("Home") / "index" >> LocGroup("main"),
     Menu("Bookmarklet") / "bookmarklet" >> LocGroup("main"),
     Menu("WebSearch") / "websearch" >> LocGroup("main"),
     Menu("RecentChanges") / "recentchanges" >> LocGroup("main"),
     User.loginMenuLoc.open_!,
     User.createUserMenuLoc.open_!,
     Menu("user",userLinkText)  / "#" >>
       MustBeLoggedIn >> LocGroup("user") >> PlaceHolder submenus (
           User.logoutMenuLoc.open_!,
           User.editUserMenuLoc.open_!,
(Continue reading)

Jack Park | 3 Jul 2012 03:57
Picon

[Lift] Re: Odd menu behavior?

I found out where I got the ideas from: they are my version of an
interpretation of code provided in Damian Helme's project at
https://github.com/dph01/lift-TBUtils
It's not clear I got the user menus right because he didn't declare
them in his readme, but his default.html template called form the just
as described below. That provoked removing the declarations for them
in my boot.scala; no change in behavior. Clearly, I'm searching in the
dark at the moment.

Cheers
Jack

On Sun, Jul 1, 2012 at 4:45 PM, Jack Park <jackpark@...> wrote:
> Could be my code, of course, but I don't see the bug. I am putting
> menus across the top, inspired by the Twitter Bootstrap stuff. My code
> is painting all the menus in the LocGroup "main" but no in the
> LocGroup "user".
>
> default.html in that region looks like this:
>
> <span class="lift:TBNav.menuToTBNav?eager_eval=true">
>   <span data-lift="lift:Menu.builder?top:class=nav;li_item:class=active;linkToSelf=true;expandAll=true;group=main"></span>
> </span>
> <span data-lift="lift:TBNav.menuToTBNav?eager_eval=true">
>   <span data-lift="lift:Menu.builder?top:class=nav
> secondary-nav;li_item:class=active;linkToSelf=true;expandAll=true;group=user"></span>
> </span>
>
> The first <span> is painting content, the second <span> is empty when
> viewing elements.
(Continue reading)

IL | 3 Jul 2012 16:57
Picon

[Lift] Re: Odd menu behavior?

Try <lift:Menu.builder top:class="nav" li_item:class="active" linkToSelf="true" expandAll="true" group="main"/>


Or you can post a demo to github and let me see if I can help.


IL

On Monday, July 2, 2012 7:45:30 AM UTC+8, jackpark wrote:
Could be my code, of course, but I don't see the bug. I am putting
menus across the top, inspired by the Twitter Bootstrap stuff. My code
is painting all the menus in the LocGroup "main" but no in the
LocGroup "user".

default.html in that region looks like this:

<span class="lift:TBNav.menuToTBNav?eager_eval=true">
  <span data-lift="lift:Menu.builder?top:class=nav;li_item:class=active;linkToSelf=true;expandAll=true;group=main"></span>
</span>
<span data-lift="lift:TBNav.menuToTBNav?eager_eval=true">
  <span data-lift="lift:Menu.builder?top:class=nav
secondary-nav;li_item:class=active;linkToSelf=true;expandAll=true;group=user"></span>
</span>

The first <span> is painting content, the second <span> is empty when
viewing elements.

The boot.scala code which drives this looks like this:

    val entries = List(Menu("Home") / "index" >> LocGroup("main"),
     Menu("Bookmarklet") / "bookmarklet" >> LocGroup("main"),
     Menu("WebSearch") / "websearch" >> LocGroup("main"),
     Menu("RecentChanges") / "recentchanges" >> LocGroup("main"),
     User.loginMenuLoc.open_!,
     User.createUserMenuLoc.open_!,
     Menu("user",userLinkText)  / "#" >>
       MustBeLoggedIn >> LocGroup("user") >> PlaceHolder submenus (
           User.logoutMenuLoc.open_!,
           User.editUserMenuLoc.open_!,
           User.changePasswordMenuLoc.open_!
       )
    )

To be really honest, I cannot recall where I got that code.

When I do a println on "entries", I get this:
List(net.liftweb.sitemap.Menu$Menuable <at> 7118a4, net.liftweb.sitemap.Menu$Men
uable <at> 108b736, net.liftweb.sitemap.Menu$Menuable <at> 63343ac1, net.liftweb.sitemap.M
enu$Menuable <at> 79fd87c8,
Menu(Loc(Login, <function1>, LinkText(<function1>),
 List(If(<function0>,<function0>),
Template(<function0>))),WrappedArray()), Menu(Loc(C
reateUser, <function1>, LinkText(<function1>), List(Template(<function0>), If(<f
unction0>,<function0>))),WrappedArray()), net.liftweb.sitemap.Menu$Menuable <at> 59ac
004c)

I can see a Login menu in the list, but not in the HTML.  This is a
new kind of bug for me; console is not showing any javascript errors.

I'll greatly appreciate any available insight.

Many thanks
Jack

--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

Jack Park | 3 Jul 2012 18:33
Picon

Re: [Lift] Re: Odd menu behavior?

Hi.

That addition gets me a repeat of the "main" group on the next line.
So, the "main" LocGroup is working fine. When I look at the printline
from TBNav which performs some transformations on what it gets, when
passed "user" data, it gets blank.

What this is now suggesting to me is that the code for creating the
User menus is not being assigned to LocGroup("user").  My intuition
suggests that I'm going to have to override the User (ProtoUser) menu
stuff and create the same menus, assigned to LocGroup("user").

My naive attempt to just assign those items as they are constructed in
boot.scala fails; the compiler says I cannot simply >>
LocGroup("user")  (which reveals deep ignorance on my part).

Before creating a demo at github (which I'm happy to do), is there
some relatively obvious way to assign the user menus in my code below
to LocGroup("user")?

Many thanks
Jack

On Tue, Jul 3, 2012 at 7:57 AM, IL <iron9light@...> wrote:
> Try <lift:Menu.builder top:class="nav" li_item:class="active"
> linkToSelf="true" expandAll="true" group="main"/>
>
> Or you can post a demo to github and let me see if I can help.
>
>
> IL
>
> On Monday, July 2, 2012 7:45:30 AM UTC+8, jackpark wrote:
>>
>> Could be my code, of course, but I don't see the bug. I am putting
>> menus across the top, inspired by the Twitter Bootstrap stuff. My code
>> is painting all the menus in the LocGroup "main" but no in the
>> LocGroup "user".
>>
>> default.html in that region looks like this:
>>
>> <span class="lift:TBNav.menuToTBNav?eager_eval=true">
>>   <span
>> data-lift="lift:Menu.builder?top:class=nav;li_item:class=active;linkToSelf=true;expandAll=true;group=main"></span>
>> </span>
>> <span data-lift="lift:TBNav.menuToTBNav?eager_eval=true">
>>   <span data-lift="lift:Menu.builder?top:class=nav
>>
>> secondary-nav;li_item:class=active;linkToSelf=true;expandAll=true;group=user"></span>
>> </span>
>>
>> The first <span> is painting content, the second <span> is empty when
>> viewing elements.
>>
>> The boot.scala code which drives this looks like this:
>>
>>     val entries = List(Menu("Home") / "index" >> LocGroup("main"),
>>      Menu("Bookmarklet") / "bookmarklet" >> LocGroup("main"),
>>      Menu("WebSearch") / "websearch" >> LocGroup("main"),
>>      Menu("RecentChanges") / "recentchanges" >> LocGroup("main"),
>>      User.loginMenuLoc.open_!,
>>      User.createUserMenuLoc.open_!,
>>      Menu("user",userLinkText)  / "#" >>
>>        MustBeLoggedIn >> LocGroup("user") >> PlaceHolder submenus (
>>            User.logoutMenuLoc.open_!,
>>            User.editUserMenuLoc.open_!,
>>            User.changePasswordMenuLoc.open_!
>>        )
>>     )
>>
>> To be really honest, I cannot recall where I got that code.
>>
>> When I do a println on "entries", I get this:
>> List(net.liftweb.sitemap.Menu$Menuable <at> 7118a4,
>> net.liftweb.sitemap.Menu$Men
>> uable <at> 108b736, net.liftweb.sitemap.Menu$Menuable <at> 63343ac1,
>> net.liftweb.sitemap.M
>> enu$Menuable <at> 79fd87c8,
>> Menu(Loc(Login, <function1>, LinkText(<function1>),
>>  List(If(<function0>,<function0>),
>> Template(<function0>))),WrappedArray()), Menu(Loc(C
>> reateUser, <function1>, LinkText(<function1>), List(Template(<function0>),
>> If(<f
>> unction0>,<function0>))),WrappedArray()),
>> net.liftweb.sitemap.Menu$Menuable <at> 59ac
>> 004c)
>>
>> I can see a Login menu in the list, but not in the HTML.  This is a
>> new kind of bug for me; console is not showing any javascript errors.
>>
>> I'll greatly appreciate any available insight.
>>
>> Many thanks
>> Jack
>
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code

--

-- 
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

Damian Helme | 3 Jul 2012 19:43
Picon

Re: [Lift] Re: Odd menu behavior?

Hi,


I can't see where you've gone wrong, but there's some example code that shows how to do what what you're looking for: 


with a running instance of the app here:


If this doesn't help you find the error, let me know.

Cheers

Damian.

On Tuesday, July 3, 2012 5:33:40 PM UTC+1, jackpark wrote:
Hi.

That addition gets me a repeat of the "main" group on the next line.
So, the "main" LocGroup is working fine. When I look at the printline
from TBNav which performs some transformations on what it gets, when
passed "user" data, it gets blank.

What this is now suggesting to me is that the code for creating the
User menus is not being assigned to LocGroup("user").  My intuition
suggests that I'm going to have to override the User (ProtoUser) menu
stuff and create the same menus, assigned to LocGroup("user").

My naive attempt to just assign those items as they are constructed in
boot.scala fails; the compiler says I cannot simply >>
LocGroup("user")  (which reveals deep ignorance on my part).

Before creating a demo at github (which I'm happy to do), is there
some relatively obvious way to assign the user menus in my code below
to LocGroup("user")?

Many thanks
Jack

On Tue, Jul 3, 2012 at 7:57 AM, IL <iron9light-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Try <lift:Menu.builder top:class="nav" li_item:class="active"
> linkToSelf="true" expandAll="true" group="main"/>
>
> Or you can post a demo to github and let me see if I can help.
>
>
> IL
>
> On Monday, July 2, 2012 7:45:30 AM UTC+8, jackpark wrote:
>>
>> Could be my code, of course, but I don't see the bug. I am putting
>> menus across the top, inspired by the Twitter Bootstrap stuff. My code
>> is painting all the menus in the LocGroup "main" but no in the
>> LocGroup "user".
>>
>> default.html in that region looks like this:
>>
>> <span class="lift:TBNav.menuToTBNav?eager_eval=true">
>>   <span
>> data-lift="lift:Menu.builder?top:class=nav;li_item:class=active;linkToSelf=true;expandAll=true;group=main"></span>
>> </span>
>> <span data-lift="lift:TBNav.menuToTBNav?eager_eval=true">
>>   <span data-lift="lift:Menu.builder?top:class=nav
>>
>> secondary-nav;li_item:class=active;linkToSelf=true;expandAll=true;group=user"></span>
>> </span>
>>
>> The first <span> is painting content, the second <span> is empty when
>> viewing elements.
>>
>> The boot.scala code which drives this looks like this:
>>
>>     val entries = List(Menu("Home") / "index" >> LocGroup("main"),
>>      Menu("Bookmarklet") / "bookmarklet" >> LocGroup("main"),
>>      Menu("WebSearch") / "websearch" >> LocGroup("main"),
>>      Menu("RecentChanges") / "recentchanges" >> LocGroup("main"),
>>      User.loginMenuLoc.open_!,
>>      User.createUserMenuLoc.open_!,
>>      Menu("user",userLinkText)  / "#" >>
>>        MustBeLoggedIn >> LocGroup("user") >> PlaceHolder submenus (
>>            User.logoutMenuLoc.open_!,
>>            User.editUserMenuLoc.open_!,
>>            User.changePasswordMenuLoc.open_!
>>        )
>>     )
>>
>> To be really honest, I cannot recall where I got that code.
>>
>> When I do a println on "entries", I get this:
>> List(net.liftweb.sitemap.Menu$Menuable <at> 7118a4,
>> net.liftweb.sitemap.Menu$Men
>> uable <at> 108b736, net.liftweb.sitemap.Menu$Menuable <at> 63343ac1,
>> net.liftweb.sitemap.M
>> enu$Menuable <at> 79fd87c8,
>> Menu(Loc(Login, <function1>, LinkText(<function1>),
>>  List(If(<function0>,<function0>),
>> Template(<function0>))),WrappedArray()), Menu(Loc(C
>> reateUser, <function1>, LinkText(<function1>), List(Template(<function0>),
>> If(<f
>> unction0>,<function0>))),WrappedArray()),
>> net.liftweb.sitemap.Menu$Menuable <at> 59ac
>> 004c)
>>
>> I can see a Login menu in the list, but not in the HTML.  This is a
>> new kind of bug for me; console is not showing any javascript errors.
>>
>> I'll greatly appreciate any available insight.
>>
>> Many thanks
>> Jack
>
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code

--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
Jack Park | 3 Jul 2012 19:53
Picon

Re: [Lift] Re: Odd menu behavior?

Problem solved!!!!!
Thank you very much :-)

I had narrowed it down to LocGroup("user") and finally discovered how
you initialized it in User. That did it.

Thank you very much.
Best regards
Jack

On Tue, Jul 3, 2012 at 10:43 AM, Damian Helme <damianhelme@...> wrote:
> Hi,
>
> I can't see where you've gone wrong, but there's some example code that
> shows how to do what what you're looking for:
>
> https://github.com/dph01/lift-TBNavbarTemplate
>
> with a running instance of the app here:
>
> http://www.damianhelme.com/tbnav/
>
> If this doesn't help you find the error, let me know.
>
> Cheers
>
> Damian.
>
> On Tuesday, July 3, 2012 5:33:40 PM UTC+1, jackpark wrote:
>>
>> Hi.
>>
>> That addition gets me a repeat of the "main" group on the next line.
>> So, the "main" LocGroup is working fine. When I look at the printline
>> from TBNav which performs some transformations on what it gets, when
>> passed "user" data, it gets blank.
>>
>> What this is now suggesting to me is that the code for creating the
>> User menus is not being assigned to LocGroup("user").  My intuition
>> suggests that I'm going to have to override the User (ProtoUser) menu
>> stuff and create the same menus, assigned to LocGroup("user").
>>
>> My naive attempt to just assign those items as they are constructed in
>> boot.scala fails; the compiler says I cannot simply >>
>> LocGroup("user")  (which reveals deep ignorance on my part).
>>
>> Before creating a demo at github (which I'm happy to do), is there
>> some relatively obvious way to assign the user menus in my code below
>> to LocGroup("user")?
>>
>> Many thanks
>> Jack
>>
>> On Tue, Jul 3, 2012 at 7:57 AM, IL <iron9light@...> wrote:
>> > Try <lift:Menu.builder top:class="nav" li_item:class="active"
>> > linkToSelf="true" expandAll="true" group="main"/>
>> >
>> > Or you can post a demo to github and let me see if I can help.
>> >
>> >
>> > IL
>> >
>> > On Monday, July 2, 2012 7:45:30 AM UTC+8, jackpark wrote:
>> >>
>> >> Could be my code, of course, but I don't see the bug. I am putting
>> >> menus across the top, inspired by the Twitter Bootstrap stuff. My code
>> >> is painting all the menus in the LocGroup "main" but no in the
>> >> LocGroup "user".
>> >>
>> >> default.html in that region looks like this:
>> >>
>> >> <span class="lift:TBNav.menuToTBNav?eager_eval=true">
>> >>   <span
>> >>
>> >> data-lift="lift:Menu.builder?top:class=nav;li_item:class=active;linkToSelf=true;expandAll=true;group=main"></span>
>> >> </span>
>> >> <span data-lift="lift:TBNav.menuToTBNav?eager_eval=true">
>> >>   <span data-lift="lift:Menu.builder?top:class=nav
>> >>
>> >>
>> >> secondary-nav;li_item:class=active;linkToSelf=true;expandAll=true;group=user"></span>
>> >> </span>
>> >>
>> >> The first <span> is painting content, the second <span> is empty when
>> >> viewing elements.
>> >>
>> >> The boot.scala code which drives this looks like this:
>> >>
>> >>     val entries = List(Menu("Home") / "index" >> LocGroup("main"),
>> >>      Menu("Bookmarklet") / "bookmarklet" >> LocGroup("main"),
>> >>      Menu("WebSearch") / "websearch" >> LocGroup("main"),
>> >>      Menu("RecentChanges") / "recentchanges" >> LocGroup("main"),
>> >>      User.loginMenuLoc.open_!,
>> >>      User.createUserMenuLoc.open_!,
>> >>      Menu("user",userLinkText)  / "#" >>
>> >>        MustBeLoggedIn >> LocGroup("user") >> PlaceHolder submenus (
>> >>            User.logoutMenuLoc.open_!,
>> >>            User.editUserMenuLoc.open_!,
>> >>            User.changePasswordMenuLoc.open_!
>> >>        )
>> >>     )
>> >>
>> >> To be really honest, I cannot recall where I got that code.
>> >>
>> >> When I do a println on "entries", I get this:
>> >> List(net.liftweb.sitemap.Menu$Menuable <at> 7118a4,
>> >> net.liftweb.sitemap.Menu$Men
>> >> uable <at> 108b736, net.liftweb.sitemap.Menu$Menuable <at> 63343ac1,
>> >> net.liftweb.sitemap.M
>> >> enu$Menuable <at> 79fd87c8,
>> >> Menu(Loc(Login, <function1>, LinkText(<function1>),
>> >>  List(If(<function0>,<function0>),
>> >> Template(<function0>))),WrappedArray()), Menu(Loc(C
>> >> reateUser, <function1>, LinkText(<function1>),
>> >> List(Template(<function0>),
>> >> If(<f
>> >> unction0>,<function0>))),WrappedArray()),
>> >> net.liftweb.sitemap.Menu$Menuable <at> 59ac
>> >> 004c)
>> >>
>> >> I can see a Login menu in the list, but not in the HTML.  This is a
>> >> new kind of bug for me; console is not showing any javascript errors.
>> >>
>> >> I'll greatly appreciate any available insight.
>> >>
>> >> Many thanks
>> >> Jack
>> >
>> > --
>> > Lift, the simply functional web framework: http://liftweb.net
>> > Code: http://github.com/lift
>> > Discussion: http://groups.google.com/group/liftweb
>> > Stuck? Help us help you:
>> > https://www.assembla.com/wiki/show/liftweb/Posting_example_code
>
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code

--

-- 
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

Jack Park | 3 Jul 2012 19:56
Picon

Re: [Lift] Re: Odd menu behavior?

That's precisely what I discovered in your code :-)

On Tue, Jul 3, 2012 at 10:53 AM, Damian Helme <damianhelme@...> wrote:
> Also, you need to add:
>
> object User {
> ...
>
> override def loginMenuLocParams = LocGroup("user") ::
> super.loginMenuLocParams
> override def createUserMenuLocParams = LocGroup("user") ::
> super.createUserMenuLocParams
> ...
> }
>
> in order to get the login and create user menu items into the 'user' group.
>
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code

--

-- 
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code


Gmane