[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

My second Wee example, together with some more things.

Joao Pedrosa

2/23/2005 4:22:00 AM

Hi,

I was just itching I guess to create my second Wee example. This time
I try to create a really really fake copy of the Joel on Software
site.

I posted a couple of screenshots of some application windows that I
created using Ruby-GNOME2 mainly to edit the tables for this example.

You can find more at:
http://sinsalabintrix.blogspot.com/2005/02/wee-revol...

Cheers,
Joao


7 Answers

Michael Neumann

2/23/2005 9:26:00 AM

0

Joao Pedrosa wrote:
> Hi,
>
> I was just itching I guess to create my second Wee example. This time
> I try to create a really really fake copy of the Joel on Software
> site.

One minor thing: If you show a discussion on the right, you can no
further click on another topic on the right (you have to click "back to
the topics" first). Is that intended?

What's coming next? ;-)

Especially for the forum, one thing would be cool to try out:
Bookmarkable pages. That would require to encode the current viewed
entry in some way in the URL, and if there's no session, this
information would be used to setup the initial state of the component-tree.

Regards,

Michael


Michael Neumann

2/23/2005 9:36:00 AM

0

Michael Neumann wrote:
> Joao Pedrosa wrote:
>
>> Hi,
>>
>> I was just itching I guess to create my second Wee example. This time
>> I try to create a really really fake copy of the Joel on Software
>> site.
>
>
> One minor thing: If you show a discussion on the right, you can no
> further click on another topic on the right (you have to click "back to

^^^^^
this should be "left"!

Regards,

Michael


Joao Pedrosa

2/23/2005 12:12:00 PM

0

Hi,

On Wed, 23 Feb 2005 18:26:16 +0900, Michael Neumann <mneumann@ntecs.de> wrote:
> Joao Pedrosa wrote:
> > Hi,
> >
> > I was just itching I guess to create my second Wee example. This time
> > I try to create a really really fake copy of the Joel on Software
> > site.
>
> One minor thing: If you show a discussion on the right, you can no
> further click on another topic on the right (you have to click "back to
> the topics" first). Is that intended?

Not really. I tried to "answer" for the thread component from the
click on the left menu but it didn't work in my first try. Is it
possible?

> What's coming next? ;-)

Not sure. :-)

> Especially for the forum, one thing would be cool to try out:
> Bookmarkable pages. That would require to encode the current viewed
> entry in some way in the URL, and if there's no session, this
> information would be used to setup the initial state of the component-tree.

This is an interesting idea to try out.

Cheers,
Joao


Michael Neumann

2/23/2005 12:39:00 PM

0

Joao Pedrosa wrote:
> Hi,
>
> On Wed, 23 Feb 2005 18:26:16 +0900, Michael Neumann <mneumann@ntecs.de> wrote:
>
>>Joao Pedrosa wrote:
>>
>>>Hi,
>>>
>>>I was just itching I guess to create my second Wee example. This time
>>>I try to create a really really fake copy of the Joel on Software
>>>site.
>>
>>One minor thing: If you show a discussion on the right, you can no
>>further click on another topic on the right (you have to click "back to
>>the topics" first). Is that intended?
>
>
> Not really. I tried to "answer" for the thread component from the
> click on the left menu but it didn't work in my first try. Is it
> possible?

Well, you call @tread in Topics. If you do this, then of course the
Topics component will not render itself and will not react on actions
(until you answer from @tread).
You should not use call in this situation, use #render and if statements.

Regards,

Michael


Joao Pedrosa

2/23/2005 1:20:00 PM

0

Hi,

> Well, you call @tread in Topics. If you do this, then of course the
> Topics component will not render itself and will not react on actions
> (until you answer from @tread).
> You should not use call in this situation, use #render and if statements.

Done, thanks. :-) Pretty easy once we have decided about it. hehe. 6
lines have been changed for this.

About turning off the Session and creating and interpreting custom
URLs, could you give me some direction beforehand? It would be great
to try this out as soon as possible, because URL is a pending issue to
me. :-)

Cheers,
Joao


Michael Neumann

2/23/2005 2:14:00 PM

0

Joao Pedrosa wrote:
> Hi,
>
>
>>Well, you call @tread in Topics. If you do this, then of course the
>>Topics component will not render itself and will not react on actions
>>(until you answer from @tread).
>>You should not use call in this situation, use #render and if statements.
>
>
> Done, thanks. :-) Pretty easy once we have decided about it. hehe. 6
> lines have been changed for this.
>
> About turning off the Session and creating and interpreting custom
> URLs, could you give me some direction beforehand? It would be great
> to try this out as soon as possible, because URL is a pending issue to
> me. :-)

I'm not sure what the best way of doing this. Seaside has an updateUrl
method, which is called for each component (similar to
process_callbacks), and which can be used to modify the URL after an
action has occured and processed, but before the redirect to the render
phase is done.

For example, if you have the following component tree:

Topics (topic_id)
|
|-- Thread (thread_id)


the Topics component update_url method, could append "/#{ topic_id }" to
the current url, then the Thread component could add "/#{ thread_id }",
so at the end we have:

/app/1/2/=/session_id/...

where 1 is the topic_id and 2 is the thread_id.

Of course this is only one part of the story. The other is to
reconstruct the component tree from the URL (only neccessary if the
session has timed-out).

That should be simple to implement, but I've not yet done this (there's
no update_url method yet). If you like, take a look at
wee/core/session.rb (this file needs refactoring ;-), method
handle_new_page_view, the line which starts with "redirect_url". If you
use there a different redirect_url, this will show up in your browser.
Additionally, you'd need to modify wee/request.rb, methods build_url and
parse_path, to remember the extra URL information that you have
specified (@app_path is used in build_url, whereas you'd need to use
full_app_path of method parse_path).

I've currently (the next weeks) not the time to try this out on my own.
But I'd like to add this to Wee in the future. Patches are welcome ;-)

To turn off displaying the session inside the URL, use Pageless mode.
But be aware that this also disabled backtracking. See the ChangeLog for
informations on how to use pageless mode.

Regards,

Michael


Michael Neumann

2/24/2005 9:29:00 AM

0

Michael Neumann wrote:
> Joao Pedrosa wrote:
>
>> Hi,
>>
>>
>>> Well, you call @tread in Topics. If you do this, then of course the
>>> Topics component will not render itself and will not react on actions
>>> (until you answer from @tread).
>>> You should not use call in this situation, use #render and if
>>> statements.
>>
>>
>>
>> Done, thanks. :-) Pretty easy once we have decided about it. hehe. 6
>> lines have been changed for this.
>>
>> About turning off the Session and creating and interpreting custom
>> URLs, could you give me some direction beforehand? It would be great
>> to try this out as soon as possible, because URL is a pending issue to
>> me. :-)
>
>
> I'm not sure what the best way of doing this. Seaside has an updateUrl
> method, which is called for each component (similar to
> process_callbacks), and which can be used to modify the URL after an
> action has occured and processed, but before the redirect to the render
> phase is done.

There probably an easier way to accomplish that. Wee already supports
named_callbacks:

r.anchor.named_callback('test') { ... }

All you have to do is, after the action was invoked, to put the
action-callback name into the regual URL, e.g. from

# before action was invoked (URL generated from render phase)
/app/?test

to:

# after action was invoked (redirected URL)
/app/test

That should be pretty easy to do.

Regards,

Michael