« Return to Thread: WebCommand - adding a handy callback to a link

Re: WebCommand - adding a handy callback to a link

by Janko Mivsek :: Rate this Message:

Reply to Author | View in Thread

Hi Masashi,

I think that having some solution for that pattern is good idea and I
also have many times a need to simplify it.

But first, me must avoid using links but use buttons instead for such
commands . Url links for any actions, that's not web friendly and it can
be even dangerous, just imagine some Google crawler visiting each of
those links. Your content would be unintentionally deleted.

That's why I'm thinking about extending WebButtons first to add
parameter:value: as we have in WebLinks. That way we will solve above
problem, then we can extend this in direction as you proposed.

Is it good to introduce a new class or maybe just extend support in
existing ones, that's a question I currently have...

JAnko


Masashi UMEZAWA wrote:

> Hi all,
>
> I've written a small extension called WebCommand. This is helpful for
> creating a link callback in a handy way.
>
> Suppose we display address table and each row has a 'Remove' link.
> Before the extension, typically you have to write:
>
> YourApp>>viewAddresses
>  (self session lastRequest includesQuery: 'command') ifTrue:[
>     [command := (self session lastRequest queryAt: 'command').
>     command = 'remove' ifTrue: [self observee removeAddressBy: (self
> session lastRequest queryAt: 'uuid')] ].
>
>  elem := WebElement new.
>  self observee addresses
>     do: [:each |
>         elem cell addText: each name.
>         elem newCell addLinkTo:self observee text: 'Remove' view: #addresses
>             parameter: 'uuid' value: each uuid parameter: 'command'
> value: 'remove'.
>         elem newRow].
> ...
>
> By installing this small extension, now you can write shorter code in your app:
>
> YourApp>>viewAddresses
>  elem := WebElement new.
>  self observee addresses
>     do: [:each |
>         elem cell addText: each name.
>         elem newCell addLinkDo:[self observee addresses remove: each
> ifAbsent:[]] text: 'Remove'.
>         elem newRow].
> ...
>
> What do you think? Since I felt some awkwardness in implementing a
> 'remove' feature in AIDA, I made this small extension. However, I'm
> still a novice in AIDA, so I would like to hear your suggestions.
>
> Best regards,
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Aida mailing list
> Aida@...
> http://lists.aidaweb.si/mailman/listinfo/aida

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
Aida@...
http://lists.aidaweb.si/mailman/listinfo/aida

 « Return to Thread: WebCommand - adding a handy callback to a link

LightInTheBox - Buy quality products at wholesale price