[Seaside] Refactoring menu bar code for Seaside App..

Rick Flower rickf at ca-flower.com
Mon Aug 16 20:21:50 UTC 2010

Hi all..

I've got an existing Seaside 2.8(w/ Async) app that I'm 
refactoring as I move it to Seaside 3.0 +Jquery.  I'm 
taking the time to completely refactor everything from the
ground up.  I've already gone thru all of my data objects
and cleaned things up and now I'm on to the menu bar 
content as my initial starting point.. This is nothing more 
than populating a series of links that are placed in a bar
within the page "header" and are relevant to the current 
user and more importantly what sort of user they are.. 
It may also be the case that the contents may change as 
a user moves from one area of the app to another.

In this case I've got menus for :

1) Visitors -- people not logged in.  These menus are 
   generally things like "about", "enroll", "contact" ,etc.

2) Regular users -- people logged in but with no special
   permissions.. These menus are generally things like 
   "update profile", "generate reports", "place order",etc.

3) Organization admins -- people logged in with org admin
   privs such as "user maint", "order handling", reports,
   etc.  There are a lot of different pages associated with
   this user -- a whole user maintenance section, another one
   for handling orders, another one for various reports,etc.

4) Site admins -- this is kinda the super-user type of 
   login which can add/edit/delete entire organizations,
   run site-wide reports,etc.. 

Anyway, I think you can get the picture that these menus
are very tailored to the type of user and where they are
within the application and I imagine this sort of thing is
in the vast majority of Seaside apps.

To that end, I was watching some of the Seaside 3 tutorial
webcasts done on the Smalltalk Daily blog back in May and
they used a design pattern of sorts where there's an 
association list of menu names and blocks to be executed 
for each menu item callback.  I believe that will work OK 
and is arguably better than what I had rolled up in my 
Seaside 2.8 app several years back but I figured I'd check
on the net 'wisdom' as I'm sure a number of you have been 
around the block on this area before and might have some
well tested patterns you could suggest in this area.. 

Thanks in advance!

More information about the seaside mailing list