2

EDIT: Updated code and explanation

Here's the application.html.erb:

<div class="container">
  <div class="row">
    {{outlet}} 
  </div>

  <hr>

  <footer>
    <p>&copy; 2013</p>
  </footer>

</div>

And then here's the countries.hbs file I'm trying to convert to emblem.

    <div class="span3">
      <div class="well sidebar-nav">
        <ul class="nav nav-list">
          <li class="nav-header">Countries</li>
          {{#each model}}
            <li>
              {{#linkTo "country" this}}{{title}}{{/linkTo}}
            </li>
          {{/each}}
        </ul>
      </div>
    </div>
    <div class='span9'>
      {{outlet}}
    </div>

Based on the Emblem docs, this was as close as I could get, and I've tried variations, but I couldn't get it to work. What's the syntax?

.span3
  .well.sidebar-nav
    ul.nav.nav-list
      li.nav-header Countries
      each model
        li = linkTo "country" #{title}

.span9
  {{outlet}}

Part of the problem, I know, is that emblem doesn't seem to have {{outlet}}, so I know those last 2 lines won't work.

I'm using the better_errors Rails gem, and here's the error:

Pre compilation failed for: .span3
  .well.sidebar-nav
    ul.nav.nav-list
      li.nav-header Countries
      each model

So is there something with the each loop?

Community
  • 1
  • 1
nickcoxdotme
  • 6,567
  • 9
  • 46
  • 72

2 Answers2

1

This should work for you.

  .span3
    .well.sidebar-nav
      ul.nav.nav-list
        li.nav-header Countries
        each model
          li
            linkTo "country"
              = title

Cheers

kiwiupover
  • 1,782
  • 12
  • 26
  • Thanks for answering, Dave! You were actually the one that introduced me to emblem at a Rails meetup. Unfortunately, that snippet didn't work. I'm using the `emblem-rails` and `ember-rails` gems. Can you think of anything else I could be doing wrong? – nickcoxdotme Jul 03 '13 at 06:09
0

There are a few syntax errors in your code. This should work:

.span3
  .well.sidebar-nav
    ul.nav.nav-list
      li.nav-header Countries
      each model
        li
          = link-to "country" | #{title}

.span9
  = outlet