Skip to content

Instantly share code, notes, and snippets.

View SweeD's full-sized avatar

Markus Schwed SweeD

View GitHub Profile
@SweeD
SweeD / breadcrumb.handlebars
Created December 7, 2012 07:53
EmberJS - Dynamic breadcrumb rendering (with action as variable)
<!---- Version 1 with #each -->
<ul class="breadcrumb">
{{#each view.breadcrumbElements}}
<li><a {{action lastObject href=true}}>{{firstObject}}</a><span class="divider">/</span></li>
{{/each}}
</ul>
<!--- Version 2 with custom helper -->
<ul class="breadcrumb">
{{renderBreadcrumb view.breadcrumb}}

Keybase proof

I hereby claim:

  • I am sweed on github.
  • I am sweed (https://keybase.io/sweed) on keybase.
  • I have a public key ASBVw4LlvjW7bKfkBV9k2jky_-OCqzJ6fzNsgmZE-Ey-cwo

To claim this, I am signing this object:

@SweeD
SweeD / base_menu_view.js
Created November 22, 2012 11:49
EmberJS - Add a computed property via method
App.BaseMenuView = Ember.View.extend{
statesForActiveCheck: [],
init: function(){
this._super()
this.get('statesForActiveCheck').forEach(this.addActiveCheckMethod, this)
},
addActiveCheckMethod: function(statePart){
functionName = statePart.replace('.', '_').camelize() + 'Active'; // the function name for 'account.settings' should be 'accountSettingsActive'