Skip to content

Instantly share code, notes, and snippets.

@hojberg
Created June 9, 2011 14:35
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 hojberg/1016844 to your computer and use it in GitHub Desktop.
Save hojberg/1016844 to your computer and use it in GitHub Desktop.
// THIS IS A SUPER PRESENTER?!
YUI.add("presenters:your_rewards", function (Y) {
Y.YourRewardsPresenter = Y.Base.create("YourRewardsPresenter", Y.Presenter, [], {
initializer: function (options) {
this.yourPlacesPresenter = new Y.YourPlacesPresenter({});
this.yourCashPresenter = new Y.YourCashPresenter({});
this.yourCashPresenter.on("balance loaded", this.renderYourCashTabCount, this);
this.yourPlacesPresenter.render();
var P = this;
Y.one("#sidebar .your_cash_tab").on("click", function (ev) {
ev.preventDefault();
P.yourCashPresenter.render();
});
},
renderYourCashTabCount: function (count) {
Y.one(".sometab").append(Y.Node.create("<span class='coun'>" + count + "</span>"));
}
}, { ATTRS: {} });
}, "1.0.0", {requires: []});
YUI.add("presenters:your_cash", function (Y) {
Y.YourCashPresenter = Y.Base.create("YourCashPresenter", Y.Presenter, [], {
initializer: function (options) {
var P = this;
Y.YourCash.getBalance({
succes: function (yourCash) {
P.yourCash = yourCash;
P.fire("balance loaded");
},
error: function () {}
});
},
render: function () {
// set up dom stuff and show the right template..
}
}, { ATTRS: {} });
}, "1.0.0", {requires: []});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment