Skip to content

Instantly share code, notes, and snippets.

@hojberg
Created June 9, 2011 14:35

Revisions

  1. hojberg revised this gist Jun 9, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@ YUI.add("presenters:your_cash", function (Y) {
    initializer: function (options) {
    var P = this;

    new Y.YourCash.getBalance({
    Y.YourCash.getBalance({
    succes: function (yourCash) {
    P.yourCash = yourCash;
    P.fire("balance loaded");
  2. hojberg revised this gist Jun 9, 2011. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -37,11 +37,13 @@ YUI.add("presenters:your_cash", function (Y) {
    initializer: function (options) {
    var P = this;

    P.yourCash = new Y.YourCash({});
    P.yourCash.on("balance loaded", function () {
    P.fire("balance loaded");
    new Y.YourCash.getBalance({
    succes: function (yourCash) {
    P.yourCash = yourCash;
    P.fire("balance loaded");
    },
    error: function () {}
    });
    P.yourCash.getBalance();
    },

    render: function () {
  3. hojberg revised this gist Jun 9, 2011. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -36,3 +36,19 @@ YUI.add("presenters:your_cash", function (Y) {

    initializer: function (options) {
    var P = this;

    P.yourCash = new Y.YourCash({});
    P.yourCash.on("balance loaded", function () {
    P.fire("balance loaded");
    });
    P.yourCash.getBalance();
    },

    render: function () {
    // set up dom stuff and show the right template..
    }

    }, { ATTRS: {} });


    }, "1.0.0", {requires: []});
  4. hojberg revised this gist Jun 9, 2011. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ YUI.add("presenters:your_rewards", function (Y) {
    this.yourPlacesPresenter = new Y.YourPlacesPresenter({});
    this.yourCashPresenter = new Y.YourCashPresenter({});

    this.yourCashPresenter.on("loaded", this.renderYourCashTabCount, this);
    this.yourCashPresenter.on("balance loaded", this.renderYourCashTabCount, this);

    this.yourPlacesPresenter.render();

    @@ -28,3 +28,11 @@ YUI.add("presenters:your_rewards", function (Y) {


    }, "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;
  5. hojberg revised this gist Jun 9, 2011. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    // THIS IS A SUPER PRESENTER?!
    YUI.add("presenters:your_rewards", function (Y) {

    Y.YourRewardsPresenter = Y.Base.create("YourRewardsPresenter", Y.Presenter, [], {
    @@ -8,6 +9,15 @@ YUI.add("presenters:your_rewards", function (Y) {
    this.yourCashPresenter = new Y.YourCashPresenter({});

    this.yourCashPresenter.on("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) {
  6. hojberg created this gist Jun 9, 2011.
    20 changes: 20 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    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("loaded", this.renderYourCashTabCount, this);
    },

    renderYourCashTabCount: function (count) {
    Y.one(".sometab").append(Y.Node.create("<span class='coun'>" + count + "</span>"));
    }

    }, { ATTRS: {} });


    }, "1.0.0", {requires: []});