adobe/brackets-registry — pull request #36 by njx (2013-04-16 00:21:44+00:00)
Title: Make template helpers reusable in Brackets

* Refactor them out of routes.js
* Make the helpers Mustache-compatible by making them all just use "this"

Also adds keywords to registry list display.

Note that I didn't end up actually changing the template to use Mustache. I looked into switching to Mustache or Hogan, but neither of them seems to support the "layout" functionality I'm using from `hbs`. I don't think it's worth spending a lot of time to make the actual template consistent with Brackets since the template in the Brackets dialog will end up being significantly different from the one in the web app anyway. However, by making the template helpers all just use `this` instead of taking an argument (and updating the Handlebars version of the template), we can make them work for both Mustache and Handlebars.

This does introduce one little ugly bit: `formatUserId` now takes a context object that has an `owner` property, so the place where we were calling it directly from the `index` route (which originally just passed a user name) now has to cons up an object that looks like this. I didn't feel it was worth refactoring `formatUserId` further to support direct calling in addition to its template helper usage.