bshardi/barcode — pull request #1 by bengotow (2013-12-08 23:19:26+00:00)
Title: Switched to Mustache

Hey Bart—this is looking great! I think you're right about needing a better way to generate the user rows. Your code looked nice and jquery is a fine way to go, but it's a bit tough to follow the code because things are appended and inserted to make the final HTML.

I switched it over to using Mustache, which is a really simple templating language you can use from almost any language. The idea is that we have some HTML with variables embedded in it like "

{{first}}

". You can use Mustache's library to "render" that HTML, filling all of the blanks with values from an object.

I think this is a more flexible way to do what you need, and you can see the template in straight HTML in scanconsole.html, so it won't start getting confusing as the code for each row gets more complicated.

If you want to do more with these sort of templates, http://handlebarsjs.com is like the super sophisticated version of Mustache.

Looking awesome so far!