5 ms·
JSON and clientside templating, folks. It's a wee bit more work, but it's a lot more pure, and that purity pays off in multiple regards, including security.
by cheald 13y ago
JSON and clientside templating, folks. It's a wee bit more work, but it's a lot more pure, and that purity pays off in multiple regards, including security.
- viseztrance 13y agoI beg to differ. You can for instance return plain html and process it from a separate js file.
- aantix 13y ago"wee" is subjective... I have existing templates that exist server side. I don't want to recreate them client side. Rails JS responses to the rescue.. It's quite elegant and works well with the existing Rails workflow.
- stephenr 13y agoNothing that relies on JS eval() is elegant, by any definition of the word.
- Kequc 13y agoClient side templating would be useful as a default feature in Rails, the framework already makes great use of partials. But to get client side templating to work you have to choose one of the new javascript frameworks and duplicate your partials into its' related js directory. The Rails way has you transmitting html. That isn't great in cases where there may be thousands of entries, in this case the Rails way isn't the best.
- cheald 13y agoI've been tinkering with a setup internally that uses a modified Hamlbars with Draper to generate serverside HTML and clientside templates from the same source template. It needs a bit of fleshing out, but the idea works.