5) may be though
6) I believe this works already.
On Apr 5, 1:24 am, Brian <[email protected]> wrote:
> These might be some additional requirements (let me know what you
> think):
>
> 5) Make it still functional when javascript is turned off. If this
> doesn't work, sites that require Section 508 compliance won't be able
> to use jDIV.
>
> 6) Nested containers should work (might work already, I haven't tested
> it)
>
> I really like where this is going.
>
> Cheers,
> Brian
>
> On Apr 4, 11:50 am, mdipierro <[email protected]> wrote:
>
> > Note to self. Things to be fixed:
>
> > 1) the action needs knowledge on whether it is in a container.
> > Solution: add a header that says so.
>
> > 2) the action response needs to be able to reference other containers
> > in order to trigger actions there. Right now each container is
> > identified by a unique but random id and there is no way to guess it.
> > Solution: have the user specify the "name" of each container.
>
> > 3) if a container contains a form that selft submit and then redirect
> > the content to a another action that also has a form. This second form
> > will not work properly. Solution 1: the programmer needs to specify
> > the [SQL]FORM(_action=) but this is a problem form legacy code that
> > you want to ajaxify. Solution 2: have the jDiv code automatically
> > determine the action from context.
>
> > 4) right now every container has a link (that triggers the loading of
> > the content) and a div with the content. To what extent should this be
> > customizable? For example, you may want the container to have a top
> > bar with additional buttons. Should this customization be a feature of
> > the current container class (jDiv) or should the class be subclassed?
> > This opens a big can of worms since the "frame" of the components
> > needs to have some standard hooks in order to expose functions like
> > "reload the content", "close it", etc. (what else?).
>
> > can you think of anything else?
>
> > Massimo
>
> > On Apr 4, 1:02 am, mdipierro <[email protected]> wrote:
>
> > > I re-posted a slightly better version.
>
> > > The new version work in this way:
>
> > > say you have an action like:
>
> > > def myform():
> > > form=SQLFORM(...)
> > > if form.accepts(....):
> > > # do something
> > > redirect(URL(....));
> > > return dict(form=form)
>
> > > You can turn it into a partial by replacing "redirect" with
> > > "jDiv.redirect or "jDiv.flash"
>
> > > def myform():
> > > form=SQLFORM(...)
> > > if form.accepts(....):
> > > # do something
> > > jDiv.redirect("done!!!");
> > > return dict(form=form)
>
> > > and create a view that DOES NOT extend the layout and does not have
> > > HTML and BODY tags. Something like this will do:
>
> > > {{=form}}
>
> > > Then create a parent action and in the view embed this partial
>
> > > {{=jDiv("click me to ajax the partial",URL(r=request,f="myform"))}}
>
> > > Mind that a partial can be served by another application (within the
> > > same web2py installation), can be a proxy to a different web-site and
> > > can contain an IFRAME (not recommended but possible).
>
> > > @Yarko. I agree that this that this is not yet a complete solution but
> > > more of a hack. Nevertheless it lets you take forms you have already
> > > created and turn them into ajax forms. It does not require any
> > > modification in web2py nor any third party libraries (it only requires
> > > the new layout and new web2py_ajax.html).
>
> > > I have been looking but I cannot really find a detailed decsription of
> > > how those other systems work.
>
> > > On Apr 3, 11:19 pm, ceej <[email protected]> wrote:
>
> > > > I'm really liking this idea Massimo, I'm going to be using it in a
> > > > project I'm about to start and grow on it :)
>
> > > > Keeps using ajax very DRY.
>
> > > > On Apr 3, 4:08 pm, mdipierro <[email protected]> wrote:
>
> > > > > There has been a lot of discussion in the past about forms that submit
> > > > > via ajax and may or may not refresh the entire page. It is also useful
> > > > > to be able to break html pages into "modules" or "plugins" or
> > > > > "components" each with its own model, view, controller in such a way
> > > > > that they communicate both serversize (by sharing session and
> > > > > database) and clientsize (one boxed component should be able for
> > > > > example to refresh the entire page or trigger a flash).
>
> > > > > I have prototype application that does this.
>
> > > > > http://www.web2py.com/examples/static/web2py.app.events.tar
>
> > > > > It uses jquery publisher subscriber mechanism. All the code is in a
> > > > > new web2py_ajax and a class call jDiv (similar to Rails Partial but
> > > > > more powerful in my opinion) which I could include in html.py
>
> > > > > It allows you to write code like this:
>
> > > > > def index():
> > > > > return dict(partial1=jDiv('click me for text','mycallback1'),
> > > > > partial2=jDiv('click me for flash','mycallback2'),
> > > > > partial3=jDiv('click me to redirect','mycallback3'),
> > > > > partial4=jDiv('click me for form','mycallback4'))
>
> > > > > def mycallback1():
> > > > > return 'hello world'
>
> > > > > def mycallback2():
> > > > > return jDiv.flash('this is a test') # flash on the container page
>
> > > > > def mycallback3():
> > > > > return jDiv.redirect('http://www.yahoo.com') # redirects entire
> > > > > page
>
> > > > > def mycallback4():
> > > > > form=FORM('your name:',
> > > > > INPUT(_name='name',requires=IS_NOT_EMPTY()),
> > > > > INPUT(_type='submit'))
> > > > > if form.accepts(request.vars):
> > > > > return jDiv.flash('hello '+form.vars.name)
> > > > > return form
>
> > > > > Can you figure out what it does?
> > > > > Not that the page is never reloaded. Only parts (partials, jDivs) of
> > > > > the reloaded. Each jDiv lives in its own container, has one action,
> > > > > can have a view, and can talk to each other.
>
> > > > > This may require some more thought.
>
> > > > > Comments?
>
> > > > > Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---