[Dojo-interest] DomWidget.js -- feature add for Template variable substitution?

C Sawyer csawyer at yumaed.org
Tue Feb 20 15:20:30 MST 2007


Karl, like these:

http://trac.dojotoolkit.org/ticket/2312
http://trac.dojotoolkit.org/ticket/1186



On 2/20/07, Karl Tiedt <ktiedt at gmail.com> wrote:
>
> create patches against latest svn or realease and create enhancement
> tickets. then post back with a reference to the tickets and a brief
> description of each preferably in an email with a descriptive subject.
> that is the best way.
>
> -Karl
>
> On 2/20/07, C Sawyer <csawyer at yumaed.org> wrote:
> > Hi All!
> >
> > I've put together a feature on templates for the variable substitution,
> > which I call Modifiers.  I got the idea from Trimpath's Expression
> > Modifiers.
> >
> > In dojo, you do variable substitution with ${this.property} and it will
> be
> > replaced with the value of the property.  The problem is, if it doesn't
> > exist, then you get the ${} string back, and not null or something else.
> > Rather than fix this, I've added Modifiers, which allow one to
> change/alter
> > the value as you see fit.
> >
> > To use, works just like Trimpath's.  ${this.property|modifier}, where
> > modifier is one of the defined ones(you can define your own).  So far
> the
> > ones that I've written are:
> >
> > eat: always returns an empty string.
> > escape: escapes our common HTML values.
> > captialize: capitalizes the value.
> > lower: lowrcases the value.
> > clean: if it's null it returns an empty string, and also escapes html
> > elements.
> >
> > so: in your template if you were to say ${this.property|clean}, and
> > this.property is null you WILL get back an empty string,
> regardless.  This
> > is nice when exposing data from an SQL table, where null values are
> > definitely possible.
> >
> > The downsides, is currently no arguments are passed thru (except the
> value)
> > to the modifier function.  Also it's not super clean, it's thrown right
> in
> > the middle of buildFromTemplate() in DomWidget.js
> >
> > Anyways, I can make this available as a patch if people are interested.
> > Otherwise I guess I'll keep it in my tree. I have a CLA on file.  I just
> > don't know the right way to go about doing 'feature' adds like this.  In
> the
> > past just throwing them in the bug tracker hasn't seemed to help any, so
> I
> > figure I'll try here.  I'll happily share my changes, doc updates,
> etc.  I
> > just don't know the best way to get it out there.
> >
> > I've also built an Editable Table widget, made changes to ComboBox to
> fix
> > focus bugs, defaultValues and other things.  I've also documented chunks
> of
> > dojo(in src) as I've had to go digging around in the src to figure
> things
> > out.
> >
> > If any of you want this stuff, it's all yours.
> >
> > Lost in dojo patch land,
> > -birlcathy on #dojo
> >
> > References:
> >     Variable Substitution:
> > http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book61
> >     Trimpath JST Expression Modifiers:
> > http://trimpath.com/project/wiki/JavaScriptTemplateSyntax
> >
>
>
> --
> -Karl Tiedt
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20070220/c24fcc3b/attachment-0001.html


More information about the Dojo-interest mailing list