Skip to content

Instantly share code, notes, and snippets.

@xlozinguez
Last active December 15, 2015 16:09
Show Gist options
  • Save xlozinguez/5287029 to your computer and use it in GitHub Desktop.
Save xlozinguez/5287029 to your computer and use it in GitHub Desktop.
Emblem sexyness
<ul class="dropdown-menu">
<li id="ember328" class="ember-view active" href="#/edit_profile">
<a href="view.href"><i class="icon-user"></i>Profile</a>
</li>
<li id="ember331" class="ember-view" href="#/schedule">
<a href="view.href"><i class="icon-calendar"></i>Schedule</a></li>
</ul>
ul.dropdown-menu
linkTo "edit_profile" tagName="li"
a href="view.href"
i.icon-user
| Profile
linkTo "schedule" tagName="li"
a href="view.href"
i.icon-calendar
| Schedule
@machty
Copy link

machty commented Apr 1, 2013

I'd recommend the following, both HTML-semantically and emblem-wise:

ul.dropdown-menu
  li
    linkTo "edit_profile"
      i.icon-user Profile
  li
    linkTo "schedule"
      i.icon-calendar Schedule

/ I like things concise so I'd use the new syntax:
ul.dropdown-menu
  li: linkTo "edit_profile": i.icon-user Profile
  li: linkTo "schedule": i.icon-calendar Schedule

Regardless of your fav emblem syntax, it's more important that you keep the linkTo's on linkable elements (a, button, etc.) when you can.

@xlozinguez
Copy link
Author

While that syntax makes a lot fo sense, works and is cleaner, I need to set up the active class on the current view... I believe that could be done some other way.
Here's the result with your code: http://screencast.com/t/Czgu3tXGDvft
And the result in my code (witness the fact that the current menu is already highlighted): http://screencast.com/t/vJalhalN4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment