Customizing edit form for description

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

Customizing edit form for description

cnantais
I have created some custom subclasses of MADescription.  When editing
these descriptions through a web-based web description editor via
aDescription asComponent, there are just too many attributes in the
form for my users to handle.  How would I go about showing only a few
attributes like, say Label, Options, and Required as opposed to
showing everything including StringReader StringWriter, etc?

Thanks,

Chad

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Customizing edit form for description

Lukas Renggli-2
> I have created some custom subclasses of MADescription.  When editing
> these descriptions through a web-based web description editor via
> aDescription asComponent, there are just too many attributes in the
> form for my users to handle.  How would I go about showing only a few
> attributes like, say Label, Options, and Required as opposed to
> showing everything including StringReader StringWriter, etc?

Yep, for end users the descriptions usually have to be filtered to  
the most basic properties. This is a copy of the code I used in some  
commercial application a few years ago (I just say that because today  
there are many more attributes nowadays, so you probably need to add  
some more selectors to #rejectedDescriptionFields).

What the following code does is to remove some descriptions from the  
description to be edited. Moreover it makes the label to be required.

buildEditor: aDescription title: aString
        | desc |
        desc := aDescription description reject: [ :each |
                self rejectedDescriptionFields
                        includes: each accessor selector ].
        desc := desc collect: [ :each |
                (each accessor selector = #label)
                        ifTrue: [ each copy beRequired ]
                        ifFalse: [ each ] ].
        ^ (desc asComponentOn: aDescription)
                addValidatedForm;
                yourself.

rejectedDescriptionFields
        ^ #( priority visible readonly persistent nilLabel )

Hope this helps,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki