HTMLCanvas snippet: , how does one uses that?

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

HTMLCanvas snippet: , how does one uses that?

philippeback
I am walking through the Dynamic WebDev with Seaside book and trying out the examples with Amber.

So, I am now looking into the various HTMLCanvas methods to find matches.

What is the snippet: method for?

Phil

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: HTMLCanvas snippet: , how does one uses that?

Nicolas Petton
Hi!

Helios has a pretty good documentation system ;)

My sole instance is the registry of html snippets. HTMLSnippet current is the public singleton instance.

On startup, it scans the document for any html elements with 'data-snippet="foo"' attribute and takes them off the document, remembering them in the store under the specified name. It also install method #foo into HTMLCanvas dynamically.

Every html snippet should mark a 'caret', a place where contents can be inserted, by 'data-snippet="*"' (a special name for caret). For example:

<li data-snippet='menuelement' class='...'><a data-snippet='*'></a></li>

defines a list element with a link inside; the link itself is marked as a caret.

You can later issue

html menuelement href: '/foo'; with: 'A foo'

to insert the whole snippet and directly manipulate the caret, so it renders:

<li class='...'><a href='/foo'>A foo</a></li>

For a self-careting tags (not very useful, but you do not need to fill class etc. you can use

<div class='lots of classes' attr1='one' attr2='two' data-snippet='*bar'></div>

and in code later do:

html bar with: [ xxx ]

to render

<div class='lots of classes' attr1='one' attr2='two'>...added by xxx...</div>



On May 21, 2013, at 4:44 PM, "[hidden email]" <[hidden email]> wrote:

I am walking through the Dynamic WebDev with Seaside book and trying out the examples with Amber.

So, I am now looking into the various HTMLCanvas methods to find matches.

What is the snippet: method for?

Phil

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: HTMLCanvas snippet: , how does one uses that?

philippeback
Wow, sweet!


On Tue, May 21, 2013 at 4:57 PM, Nicolas Petton <[hidden email]> wrote:
Hi!

Helios has a pretty good documentation system ;)

My sole instance is the registry of html snippets. HTMLSnippet current is the public singleton instance.

On startup, it scans the document for any html elements with 'data-snippet="foo"' attribute and takes them off the document, remembering them in the store under the specified name. It also install method #foo into HTMLCanvas dynamically.

Every html snippet should mark a 'caret', a place where contents can be inserted, by 'data-snippet="*"' (a special name for caret). For example:

<li data-snippet='menuelement' class='...'><a data-snippet='*'></a></li>

defines a list element with a link inside; the link itself is marked as a caret.

You can later issue

html menuelement href: '/foo'; with: 'A foo'

to insert the whole snippet and directly manipulate the caret, so it renders:

<li class='...'><a href='/foo'>A foo</a></li>

For a self-careting tags (not very useful, but you do not need to fill class etc. you can use

<div class='lots of classes' attr1='one' attr2='two' data-snippet='*bar'></div>

and in code later do:

html bar with: [ xxx ]

to render

<div class='lots of classes' attr1='one' attr2='two'>...added by xxx...</div>



On May 21, 2013, at 4:44 PM, "[hidden email]" <[hidden email]> wrote:

I am walking through the Dynamic WebDev with Seaside book and trying out the examples with Amber.

So, I am now looking into the various HTMLCanvas methods to find matches.

What is the snippet: method for?

Phil

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.