Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Strange behavior with insert_bottom and insert_top

#47

Hi,

I was playing with Nitrogen 2.0.0 and I wanted to try the insert_top action :

-module (bug). -compile(export_all). -include_lib("nitrogen/include/wf.hrl"). -include("records.hrl").

main() -> #template { file="./site/templates/bare.html" }.

body() ->

[
    #link{id=button, text="add a new H1", postback=add_h1}
].

event(add_h1) ->

wf:insert_top(button, #h1 {text="new heading 1"}).

The problem is that each new heading behave like the link.
It seems to happen when we want to insert a new element before or after a link.
In fact, the new element is inserted INSIDE the link but not before or after.

I'm totally new to the framework, so maybe i'm missing something...

Thanks

Pierre

Reported by pierre · April 15th, 2010 @ 05:00 PM

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. Brian O
    Brian O

    Hi Pierre,

    I think this is the expected behavior. When you insert_bottom() or insert_top(), you are inserting INTO the element that you identify. If you want to insert above or below, you might try creating a panel above or below and then wf:insert_bottom() or wf:update() into that panel. Alternatively, you might want to request that insert_above() and insert_below() functions are added to the API.

    April 22nd, 2010 @ 01:37 PM

  2. Rusty Klophaus
    Rusty Klophaus
    • State changed from new to invalid

    Brian O is correct. You should use insert_bottom and insert_top on a panel (which equals a div).

    June 14th, 2010 @ 06:20 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.