Links and Components doubts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Links and Components doubts

Sebastia Van Lacke
Hello,
 
I'm from Argentina and I am working on a Seaside project. I don't speak English very well, so I hope you understand...
 
I need to recreate an old site using Seaside, and I and I'm having problems with the structure of the site.
 
My page has a header, menu, and a footer (which are repeated throughout the site) and a body that changes for each page of the site,
depending on the option chosen on the menu.
 
CSRootComponent>>renderContentOn: html
 html div
  id:'allContent';
  with:[
   html render: header.
   html render: menu.
   self renderBodyOn: html.
   html render: footer.
  ]
 
---------------------------------------------------------------------------------------------
The component menu, displays a horizontal menu with links to different pages on the site.
 
CSMenuComponent>>renderContentOn: html
 html div
  id: 'menu';
  with: [
   html unorderedList: [
    self  renderMenuItemsOn: html.
    ].
  ].
---------------------------------------------------------------------------------------------
CSMenuComponent>>renderMenuItemsOn: html
 
 menuItems do: [:item |
  html listItem with: [
   html anchor
    callback: item value;
    with: item key.
  ].
 ]
 
----------------------------------------------------------------------------------------------
CSMenuComponent>>initialize
 
 super initialize.
 menuItems := OrderedCollection new.
 self addMenuItem: 'Company Info' withBlock: [ self companyInfo].
 self addMenuItem: 'Products' withBlock: [ self products ].
 self addMenuItem: 'Downloads' withBlock: [ self downloads ].
 self addMenuItem: 'Resources' withBlock: [ self resources ].
 self addMenuItem: 'Support' withBlock: [ self support ].
 self addMenuItem: 'Contact Us' withBlock: [ self contactUs ].
 
----------------------------------------------------------------------------------------------
 
where each of the links should display a new page with the same structure as before, but with a different body.
 
It is right to create a component for each link ? For example, CSCompanyInfoComponent for companyInfo link.
How I call that component, from CSMenuComponent>>companyInfo method, to render in a new page??
I am confused by the fact that I don't have a renderCanvas to speak in that context.
 
Thanks!!!
 
Sebastian
 
Sebastian Van Lacke | Developer |  caesar systems | see clearly. decide smarter.
 
[hidden email]  | t: +1.281.598.8790 | t: +54.11.4389.0126 | www.caesarsystems.com
 
 
 
This message and any attached documents contain information from Caesar Systems LLC that may be confidential/trade secret and/or privileged.  If you are not the intended recipient, you may not read, copy, distribute or use this information.  If you have received this transmission in error, please notify the sender immediately by telephone or by reply e-mail and then delete this message.
 
 

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Links and Components doubts

Julian Fitzell-2
On Thu, Oct 23, 2008 at 7:38 PM, Sebastian Van Lacke
<[hidden email]> wrote:
> Hello,
>
> I'm from Argentina and I am working on a Seaside project. I don't speak
> English very well, so I hope you understand...

Hi! Not to worry... plus your English sounds totally fluent. I don't
think I saw a single mistake in your whole email. Seriously.

> I need to recreate an old site using Seaside, and I and I'm having problems
> with the structure of the site.
>
> My page has a header, menu, and a footer (which are repeated throughout the
> site) and a body that changes for each page of the site,
> depending on the option chosen on the menu.
>
> CSRootComponent>>renderContentOn: html
>  html div
>   id:'allContent';
>   with:[
>    html render: header.
>    html render: menu.
>    self renderBodyOn: html.
>    html render: footer.
>   ]
>
> ---------------------------------------------------------------------------------------------
> The component menu, displays a horizontal menu with links to different pages
> on the site.
>
> CSMenuComponent>>renderContentOn: html
>  html div
>   id: 'menu';
>   with: [
>    html unorderedList: [
>     self  renderMenuItemsOn: html.
>     ].
>   ].
> ---------------------------------------------------------------------------------------------
> CSMenuComponent>>renderMenuItemsOn: html
>
>  menuItems do: [:item |
>   html listItem with: [
>    html anchor
>     callback: item value;
>     with: item key.
>   ].
>  ]
>
> ----------------------------------------------------------------------------------------------
> CSMenuComponent>>initialize
>
>  super initialize.
>  menuItems := OrderedCollection new.
>  self addMenuItem: 'Company Info' withBlock: [ self companyInfo].
>  self addMenuItem: 'Products' withBlock: [ self products ].
>  self addMenuItem: 'Downloads' withBlock: [ self downloads ].
>  self addMenuItem: 'Resources' withBlock: [ self resources ].
>  self addMenuItem: 'Support' withBlock: [ self support ].
>  self addMenuItem: 'Contact Us' withBlock: [ self contactUs ].
>
> ----------------------------------------------------------------------------------------------
>
> where each of the links should display a new page with the same structure as
> before, but with a different body.

Everything looks totally reasonable so far...

> It is right to create a component for each link ? For example,
> CSCompanyInfoComponent for companyInfo link.
> How I call that component, from CSMenuComponent>>companyInfo method, to
> render in a new page??
> I am confused by the fact that I don't have a renderCanvas to speak in that
> context.

Yes, you likely want a component for each menu item.

What you probably want is a "currentItem" instance variable or
something to store the currently viewed page (if you want the back
button to work, you'll want to make sure to use #updateStates: to
register your component for backtracking). Also make sure you return
any components you are storing in #children. You could either create
new components each time the menu changes or you could keep a
dictionary of them keyed by symbols or something (this might actually
help if you need to visibly mark the currently selected menu item
somehow).

In any case, in your menu callbacks you put the correct item in the
currentItem instvar, and then in the render phase you just do "html
render: currentItem".

There are other ways to do it but that's probably the simplest.

Hope that's clear,

Julian
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Links and Components doubts

Andres Fortier-2
In reply to this post by Sebastia Van Lacke
Hi Sebastian,
                       you may be interested in WANavigation and
WASimpleNavigation for the menu stuff (I based on those classes to
make a custom menu).

You may also want to take a look at WADecoration, which can help you
to decouple the header/footer from the main page:

WADecoration:
I am an abstract decoration around instances of WAComponent. I can be
added to aComponent by calling #addDecoration: and I change the basic
behaviour or look of a component. There are several methods that can
be overriden to archive this:

- #renderContentOn: to emit xhtml around the decorated component. Call
#renderOwnerOn: to let the owner emit its output.
- #processChildCallbacks: to intercept the callback processing of the
owner.
- #handleAnswer: to intercept the answer processing.

HTH,
         Andrés

Sebastian Van Lacke escribió:

> Hello,
>
> I'm from Argentina and I am working on a Seaside project. I don't speak English very well, so I hope you understand...
>
> I need to recreate an old site using Seaside, and I and I'm having problems with the structure of the site.
>
> My page has a header, menu, and a footer (which are repeated throughout the site) and a body that changes for each page of the site,
> depending on the option chosen on the menu.
>
> CSRootComponent>>renderContentOn: html
>  html div
>   id:'allContent';
>   with:[
>    html render: header.
>    html render: menu.
>    self renderBodyOn: html.
>    html render: footer.
>   ]
>
> ---------------------------------------------------------------------------------------------
> The component menu, displays a horizontal menu with links to different pages on the site.
>
> CSMenuComponent>>renderContentOn: html
>  html div
>   id: 'menu';
>   with: [
>    html unorderedList: [
>     self  renderMenuItemsOn: html.
>     ].
>   ].
> ---------------------------------------------------------------------------------------------
> CSMenuComponent>>renderMenuItemsOn: html
>
>  menuItems do: [:item |
>   html listItem with: [
>    html anchor
>     callback: item value;
>     with: item key.
>   ].
>  ]
>
> ----------------------------------------------------------------------------------------------
> CSMenuComponent>>initialize
>  
>  super initialize.
>  menuItems := OrderedCollection new.
>  self addMenuItem: 'Company Info' withBlock: [ self companyInfo].
>  self addMenuItem: 'Products' withBlock: [ self products ].
>  self addMenuItem: 'Downloads' withBlock: [ self downloads ].
>  self addMenuItem: 'Resources' withBlock: [ self resources ].
>  self addMenuItem: 'Support' withBlock: [ self support ].
>  self addMenuItem: 'Contact Us' withBlock: [ self contactUs ].
>
> ----------------------------------------------------------------------------------------------
>
> where each of the links should display a new page with the same structure as before, but with a different body.
>
> It is right to create a component for each link ? For example, CSCompanyInfoComponent for companyInfo link.
> How I call that component, from CSMenuComponent>>companyInfo method, to render in a new page??
> I am confused by the fact that I don't have a renderCanvas to speak in that context.
>
> Thanks!!!
>
> Sebastian
>
>
> Sebastian Van Lacke | Developer |  caesar systems | see clearly. decide smarter.
>
> [hidden email]  | t: +1.281.598.8790 | t: +54.11.4389.0126 | www.caesarsystems.com
>
>  
>
> This message and any attached documents contain information from Caesar Systems LLC that may be confidential/trade secret and/or privileged.  If you are not the intended recipient, you may not read, copy, distribute or use this information.  If you have received this transmission in error, please notify the sender immediately by telephone or by reply e-mail and then delete this message.
>
>  
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Links and Components doubts

John McKeon
The Scriptaculous component SUTabPanel is a pretty cool script enabled component that works pretty much out of the box. Just call:
SUTabPanel>>add: yourSubComponent label: theMenuString
for each of your sub-components. It puts in all the div tags you need to make it look pretty and marks the selected tab for CSS highlghting etc. automagically.
 
An example can be seen on my  (sorry site for the shameless plug :) Football Pool website. You can login with email: guest pwd: football 
 
Regards
Johnny
(Note: to get a "menu" of the links on one line, you have to change the code to put <span>'s around the list items instead of div's. I THINK I was able to make that work, but I didnt like it so I changed it back)

 
On Thu, Oct 23, 2008 at 1:48 PM, Andres Fortier <[hidden email]> wrote:
Hi Sebastian,
                     you may be interested in WANavigation and WASimpleNavigation for the menu stuff (I based on those classes to make a custom menu).

You may also want to take a look at WADecoration, which can help you to decouple the header/footer from the main page:

WADecoration:
I am an abstract decoration around instances of WAComponent. I can be added to aComponent by calling #addDecoration: and I change the basic behaviour or look of a component. There are several methods that can be overriden to archive this:

- #renderContentOn: to emit xhtml around the decorated component. Call #renderOwnerOn: to let the owner emit its output.
- #processChildCallbacks: to intercept the callback processing of the owner.
- #handleAnswer: to intercept the answer processing.

HTH,
       Andrés

Sebastian Van Lacke escribió:
Hello,
I'm from Argentina and I am working on a Seaside project. I don't speak English very well, so I hope you understand...

I need to recreate an old site using Seaside, and I and I'm having problems with the structure of the site.

My page has a header, menu, and a footer (which are repeated throughout the site) and a body that changes for each page of the site, depending on the option chosen on the menu.

CSRootComponent>>renderContentOn: html
 html div
 id:'allContent';
 with:[
  html render: header.
  html render: menu.
  self renderBodyOn: html.
  html render: footer.
 ]

---------------------------------------------------------------------------------------------
The component menu, displays a horizontal menu with links to different pages on the site.

CSMenuComponent>>renderContentOn: html
 html div
 id: 'menu';
 with: [
  html unorderedList: [
   self  renderMenuItemsOn: html.
   ].
 ].
---------------------------------------------------------------------------------------------
CSMenuComponent>>renderMenuItemsOn: html

 menuItems do: [:item |
 html listItem with: [
  html anchor    callback: item value;
   with: item key.
 ].
 ]

----------------------------------------------------------------------------------------------
CSMenuComponent>>initialize
  super initialize.
 menuItems := OrderedCollection new.
 self addMenuItem: 'Company Info' withBlock: [ self companyInfo].
 self addMenuItem: 'Products' withBlock: [ self products ].
 self addMenuItem: 'Downloads' withBlock: [ self downloads ].
 self addMenuItem: 'Resources' withBlock: [ self resources ].
 self addMenuItem: 'Support' withBlock: [ self support ].
 self addMenuItem: 'Contact Us' withBlock: [ self contactUs ].

----------------------------------------------------------------------------------------------

where each of the links should display a new page with the same structure as before, but with a different body.

It is right to create a component for each link ? For example, CSCompanyInfoComponent for companyInfo link.
How I call that component, from CSMenuComponent>>companyInfo method, to render in a new page??
I am confused by the fact that I don't have a renderCanvas to speak in that context.

Thanks!!!

Sebastian


Sebastian Van Lacke | Developer |  caesar systems | see clearly. decide smarter.

[hidden email]  | t: +1.281.598.8790 | t: +54.11.4389.0126 | www.caesarsystems.com
 
This message and any attached documents contain information from Caesar Systems LLC that may be confidential/trade secret and/or privileged.  If you are not the intended recipient, you may not read, copy, distribute or use this information.  If you have received this transmission in error, please notify the sender immediately by telephone or by reply e-mail and then delete this message.

 

------------------------------------------------------------------------


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside