Created
August 27, 2010 05:54
-
-
Save Paxa/552879 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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