[Seaside] Is your code for your Seaside web-app using concisemethods?

Rick Flower rickf at ca-flower.com
Tue Jan 30 21:24:54 UTC 2007

Ramon Leon wrote:
> [ ... ]
> Ok, with those removed, some methods renamed, most of the breaks removed
> from the rendering, and a more Smalltalkish code formatting where blocks
> don't begin/end on their own lines, we could shorten the render method to
> this.
> renderAddPaperOrderOn: html 
>     html div class: #fieldsetLookalike; with: 
>         [self renderOrg: org on: html.
>         html form: 
>             [self renderUsers: self userList on: html.
>             html div id: #vendorListDropDown; with: 
>                 [self renderScripts: self scripList on: html].
>             html div id: #denominationListDropDown; with: 
>                 [html div: '3) Select Scrip Denomination'.
>                 html select 
>                     list: #('Select a Vendor First' );
>                     callback: [self error: 'Should not come here'].
>                 html div id: 'cart-contents']]]

Ok.. I ended up with something that very much resembled that code.. I 
realized the other day that some of this might fit better as part of 
a shopping cart that has a "header" and "footer" and some divs with 
"content" in the middle.. I figured I could rip out the guts of the 
code and move it into a new object (aka MSAShoppingCart in my case) 
and have the caller specify the blocks to be used to deal with the 
respective rendering of content for each div along with the respective 
callbacks, etc to effectively make a generic shoppingcart that only 
knows how to render itself at a high level and maintain some class 
variables for quantities, what was purchased, user-record for purchaser,etc.

Anyway, I've gotten stuck now with the ST syntax and think I've gotten
lost in the forest and am hoping someone can kindly point me in the 
right direction.  Perhaps I should not bother with the shoppingCart 
paradigm in the same way I'm heading with it.. Any comments would be 
greatly appreciated.. Below is the code mostly as I've got it loaded
into VW now (I took some liberties and edited some things I wanted to
change anyway):

Here's my code for the above :

MSWLI_Admin_Organization>>renderAddPaperOrderOn: html
   self shoppingCart renderCart: [ self renderFamilyAndOrg: (self session org) on: html]
            renderScripBlockAs:  [ self renderScrip: self scripListForOrg on: html]
            renderDenomBlockAs:  [ self renderDenomFiller: self on: html ]
            renderQtyBlockAs:    [ self renderQtyBox:      self on: html ]
            renderSubmitBlockAs: [ html submitButton liveCallback: [:r |  ]; text: 'Add to Cart' ]
            renderCartBlockAs:   [ ... ]
            on: html.

MSAShoppingCart>>renderCart: headerBlock renderScripBlock:  scripBlock  renderDenomBlock:  denomBlock
            renderQtyBlock:    qtyBlock renderSubmitBlock: submitBlock  renderCartBlock:   cartBlock
            on: html
   html div class: #fieldset_lookalike; with:
     html form: [ 
       headerBlock on: html. 
       html div id: #vendorListDropDown;        with: [ scripBlock ].
       html div id: #denominationListDropDown ; with: [ denomBlock ]. 
       html div id: #quantityEntry;             with: [ qtyBlock   ]. 
       html div id: #addToCart;                 with: [ submitDiv  ].
       html div id: 'cart-contents';            with: [ cartBlock  ].

With this, I run into issues with the passing of the "on: html" args
(particularly for the headerBlock and likely for the others as well)
and how to properly deal with them.. In nosing around a bit with what
others have done, I could break out each block into separate classes
and just "render" them, but that doesn't seem right since it starts 
breaking my code down too small (in my opinion).. 

Anyway, I'm hoping someone can give me some insight for this sort of 

Thanks -- 

Signed -- "Stuck in the woods"

More information about the Seaside mailing list