-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Built-in View Helpers #233
Comments
Just came across this library, which I think would be a greats staring point for the view helpers: https://github.com/HubSpot/humanize |
Here's another great one for dates. Would be killer if moment was built in: http://momentjs.com/ |
I've used moment before. It is super awesome - would trust it over the HubSpot one any day (any code I've used from HubSpot breaks bower in roots so I no trusty) in terms of time formatting. For capitalizing, titleizing and the like, I'd use underscore.string. |
+1000 momentjs |
Woah, underscore.string looks great. I'll look into that a little further, but looks incredible. |
underscore.string is great, I used it for string manipulation to test out my CSS preprocessor idea, as I didn't have any knowledge of compilers at the time. But now I've got an understanding of parsing, tokenizing and so on. :) underscore.string gave me nothing but joy at the time! You'll enjoy it too, for sure. |
This feature has landed on the release branch. Roots ships with underscore, underscore.string, and moment by default, and you can also include your own view helper bundles through app.coffee. Whoo! |
@Jenius can you elaborate more on how we can bundle our own view helpers? ideally I was hoping for this :
Or even better, simply require each file in
|
@airtonix You can do it this way with roots v3, which is currently what's being actively developed. You can test out the latest v3 prerelease with In v3, you can run this in your module.exports =
ignore: ['view_helpers/*']
locals:
foo: require('./view_helpers/foo') |
So sometimes I miss rails' built-in view helpers that generally make life a lot easier with regards to parsing strings especially. I think it would be cool to include a couple of modules that help out with common tasks that you might need in views.
Reference: http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html
It's worth thinking about how we could modularize and package up these helpers as well. Should we just include them in views and document them, or offer a way for users to toggle them on, etc.
The text was updated successfully, but these errors were encountered: