Skip to content

Instantly share code, notes, and snippets.

@Paxa
Created August 27, 2010 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Paxa/552879 to your computer and use it in GitHub Desktop.
Save Paxa/552879 to your computer and use it in GitHub Desktop.
new Haml('userbar', function (params, render, use) {
with (params) {
this.use({
user: user.merge({full_name: user.first_name + ' ' + user.last_name}),
session: session
});
}
this.setOptions({
box_class: 'paid'
});
this.use('date', Date());
// in haml available: params, this, options, hash passed in use
this.render('
#userbar.right.{options.box_class}
%img.userpic@src={user.pic.small}/
%span.username= {user.full_name}
%a.logout(href="/sessions/{session.id}" method="delete")= "logout"
');
});
Haml.userbar({user: User.find(30), session: Session.current})
.injectTo(document.body);
Haml.template('userbar');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment