Questions tagged [eco]

Embedded Coffeescript (ECO) templates lets you embed coffeescript directly in your templates.

Embedded Coffeescript (ECO) templates lets you embed coffeescript directly in your templates.

ECO templating documentation and code are available at https://github.com/sstephenson/eco.

59 questions
21
votes
2 answers

Getting the loop index in an eco template

Is it possible to get the current loop index using the eco template engine? For example in Jinja2 you can do {% for var in array %} {{ loop.index0 }} {% endfor %} If not is there a more idiomatic way of getting at the index?
Chris Glace
  • 215
  • 1
  • 2
  • 5
4
votes
2 answers

How to remove unnecessary blank spaces from compiled Eco template

Supose i have this simple but fairly nested Eco template:
<% for thing, i in @things: %>
<% if i % 2 == 0: %> This block is fairly nested. <% end %>
<% end…
epidemian
  • 18,817
  • 3
  • 62
  • 71
3
votes
1 answer

Eco JavaScript templates in Rails without duplicate code?

I am using 'eco' gem with my Rails application to load Eco templates. The templates are really handy and automatically loaded by Rails 3.1 asset pipeline. The only problem is that each .js file generated by eco includes the same javascript code that…
Evgenii
  • 36,389
  • 27
  • 134
  • 170
3
votes
1 answer

Eco Error Message: Unexpected 'INDENT' in Windows

I'm currently using spinejs and eco template system in rails project. It's work perfectly on my Mac, however there is a strange indent error when I deploy it on Windows. And the code is:
<% for contact_record in…
Ray Shih
  • 933
  • 8
  • 18
3
votes
1 answer

Strange Eco Template Behavior

I am using Backbone and Eco templates in my Rails application. My template has the following code: <% @collection.each (model)-> %> <% console.log model.get('name') %>

<%= model.get('name') %>

<%= model.get('description')…

Andrew
  • 227,796
  • 193
  • 515
  • 708
3
votes
0 answers

Rails: sharing eco templates between Ruby and JavaScript

I understand sharing templates between Ruby and JavaScript can be done in Rails (as seen in Railscast #295). There is something about Mustache that I don't like, though. I would love to accomplish this using eco (Embedded CoffeeScript). I created…
Feech
  • 4,072
  • 4
  • 28
  • 36
2
votes
2 answers

Eco templates: Combine multiple templates from the command-line?

I'm trying use eco for client-side templating. I have multiple .eco templates that I'd like to combine into one js file - I know I can just combine the js files after they are generated but that's a lot of repeated boilerplate. Is there a better way…
Naren
  • 1,910
  • 1
  • 17
  • 22
2
votes
2 answers

Can I use a Coffeescript `switch` block in eco?

Can I use a Coffeescript switch block in the eco templating engine? I tried a couple of variations, but I keep getting unexpected dedent errors. Update: To appease the downvoters, here is what I expected to work <% switch x : %> <% when 1 : %> …
Thilo
  • 257,207
  • 101
  • 511
  • 656
2
votes
1 answer

golang and go-socket.io parameters in the path

I need to send a parameter to the page like this (every time I call a new chat it will have a different code) http://192.168.0.10:3000/chat.html/**?mycode1** http://192.168.0.10:3000/chat.html/**?mycode2** Question: How and where are the parameters…
cesin
  • 99
  • 5
2
votes
2 answers

Comments in Embedded Coffeescript (ECO) templates

Is there a way to put comments (single and multiline) in ECO templates such that they do not appear in the rendered output? For example, Django templates let you do this on a single line: {# greeting #}hello or on multiple lines:

Rendered text…

Erik
  • 7,479
  • 8
  • 62
  • 99
2
votes
1 answer

ECO templates with Backbone + Marionette but without Rails

I am trying to use ECO templates with Backbone and Marionette but without Rails. Rather, I am using Django with RequireJS managing my front-end asset pipeline. How do I load ECO templates? Here is what a simple Marionette view looks like for me…
Erik
  • 7,479
  • 8
  • 62
  • 99
2
votes
1 answer

Rails Backbone Render Nested JSON in jst.eco template

I have this set JSON data JSON [{ "country": { "name": "Malaysia", "total_amount": 0.0, "count": 0 } }, { "country": { "name": "Philippines", "total_amount": 0.0, "count": 0 } }, { …
kilua
  • 711
  • 1
  • 9
  • 16
2
votes
1 answer

Grunt Image Paths in CoffeeScript (eco) Templates

I've ran into a slight issue referring to images in production environment. Image files are generated using imagemin and I end up with /images/.. files – which is totally fine, but I don't know how to refer to them in CoffeeScript. Specifically in…
Nima Gardideh
  • 575
  • 1
  • 4
  • 10
2
votes
0 answers

Inline eco templates with coffeescript and rails

Is it possible to use eco.render inside rails coffeescript file? JST become availabel only after we include template, so maybe we can require some file(inside application.js) to make eco available
timfjord
  • 1,759
  • 19
  • 20
2
votes
1 answer

Backbone, Bootstrap modal within template not showing

I am trying to generate a modal for each of my posts so that each post has a modal containing the post content(and eventually comments). When the comment link is clicked the modal will appear. The thing is I have to create a bootstrap modal block…
1
2 3 4