[Seaside] TwitterBootstrap dropdowns and submitting on change

gettimothy gettimothy at zoho.com
Thu Oct 17 20:55:29 UTC 2013


I have a tbsNavBar that I want to put buttons on and be able to disable/enable the rendering of them depending on what component is using the navBar.
For example, If I am on the Documentation component, I do not want to show a link to the Documentation component when I am on it.

In the NavBar, I initialized a couple of dictionaries--one with a selector and the other with a lable to display.




initialize
 super initialize.
 linkDisplay = Dictionary new.
 "enable all links by default"
 linkDisplay 
 at: #signin put: true;
 at: #documentation put: true;
 at: #support put: true;
 at: #signup put: true.
 linkLabel = Dictionary new. 
 linkLabel 
 at: #signin put: 'Sign In';
 at: #documentation put: 'Documentation';
 at: #support put: 'Help & Support';
 at: #signup put: 'Sign Up'.
 

Then on render, I want to invoke a callback with a selector named what the key in the dictionary is so that this:


html tbsNavItem: [ html anchor callback: [self signup]; with: 'Sign Up' ].
html tbsNavItem: [ html anchor callback: [self documentation]; with: 'Documentation' ].
html tbsNavItem: [ html anchor callback: [self support]; with: 'Help & Support'].
html tbsNavItem: [ html anchor callback: [self signin]; with: 'Sign In']]]

 
Becomes:

...
linkDisplay keysAndValuesDo: [ :key :value | value
 ifTrue: [ 
 html tbsNavItem: [ html anchor callback: [self key]; with: (linkLabel at: key) ]]....

 

I am getting an error

MessageNotUnderstood: MyComponent>>key
 
Does anybody have a generic way to dynamically set a callback to a selector?

thx in advance

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20131017/8fe06001/attachment-0001.htm


More information about the seaside mailing list