.. jQuery.sampling() documentation master file, created by
sphinx-quickstart2 on Fri Apr 20 17:25:06 2012.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to jQuery.sampling()'s documentation!
=============================================
jQuery.sampling() is a `jQuery `_ plugin for HTML Sampling / Template Animation.
Download
--------
First release is not still available but you can get the current RC from our `github repository `_
What is jQuery.sampling()
-------------------------
According to Iain Dooley from `http://www.workingsoftware.com.au `_
.. epigraph::
Template animation: the practice of using static HTML files as a resource from within your application to be manipulated via the DOM to generate dynamic output.
You can read more about this technique in `Your templating engine sucks and everything you have ever written is spaghetti code (yes, you) `_ but the idea is quite simple: use the *pure HTML* documents from your designer as the source for generating *dynamic content*.
In my opinion, the name is somewhat unfortunate and I prefer calling it *HTML sampling* since we use parts of the pure HTML documents as *samples for the dynamic content*.
The original concept assumes you will use HTML Sampling / Template animation in the backend but I find useful to have some library in the frontend as well.
This plugin enhances the coordination among designers and programmers. Look at this awesome interaction!
Designer
^^^^^^^^
He decorates part of the HTML with `_s` (or something else) class:
.. code-block:: html
Star Wars Spaceship Table
| Id |
Name |
Type |
Affiliation |
| sample_id1 |
sample_name1 |
sample_type1 |
sample_affiliation1 |
| sample_id2 |
sample_name2 |
sample_type2 |
sample_affiliation2 |
| sample_id3 |
sample_name3 |
sample_type3 |
sample_affiliation3 |
| sample_id4 |
sample_name4 |
sample_type4 |
sample_affiliation4 |
| sample_id5 |
sample_name5 |
sample_type5 |
sample_affiliation5 |
Programmer
^^^^^^^^^^
.. highlight:: javascript
1. Gather samples::
var $samples = $(document).sampling('gather');
2. Select one example::
var $row_sample = $samples.sampling('select', '.standard');
3. Customize and instanciate it::
var $rows = $row_sample.sampling('new', [
{
'.id':1,
'.name':'Tie Fighter',
'.type':'Starfighter',
'.affiliation':'Galactic Empire'
},
{
'.id':2,
'.name':'X-Wing Fighter',
'.type':'Starfighter',
'.affiliation':'Rebel Alliance'
},
{
'.id':3,
'.name':'Imperial Star Destroyer',
'.type':'Imperial cruiser',
'.affiliation':'Galactic Empire'
}
]);
4. Append to the table::
$('#spaceship_table').append($rows);
Features
========
* Improve designer / programmer developing cycle:
* **Frees the designer to know any template language**
* Lets the programmer use designer's templates as sample libraries
* Lets nested samples
* Several ways to customize samples
* Client side includes (CSI)
Contents
========
.. toctree::
:maxdepth: 2
jquery.sampling
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`