Closed sandstrom closed 12 years ago
You could create and include a JavaScript object that has all these types of helpers. For example, you could have:
class Helpers
localizedTime: (utcTime) ->
(new Date).getTimezoneOffset() / -60
and then in your template:
<%= Helpers.localizedTime(@theTime) %>
Good idea!
A nice addition would be helper functions that aren't tied to the model. One example would be a function to localize time (see below). If I've understood things correctly that would now require the localizedTime function on each model. If view/template helpers could be passed as as third argument that would be neat.
Or perhaps this is already possible, and I've just missed it.