From fcebebc601e77410d5764851d5e6a253925550ee Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Fri, 10 May 2013 16:42:21 +0100 Subject: [PATCH] use _items.next for the store, so we can access other _items throughout the app --- src/app/items.coffee | 11 +++++------ views/app/rewards.html | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/app/items.coffee b/src/app/items.coffee index 68e66d43b5..abdd9b6ac2 100644 --- a/src/app/items.coffee +++ b/src/app/items.coffee @@ -78,6 +78,7 @@ _.each items.hatchingPotions, (hatchingPotion) -> hatchingPotion.notes = "Pour t server exports ### module.exports.server = (model) -> + model.set '_items', items updateStore(model) ### @@ -127,6 +128,7 @@ module.exports.app = (appExports, model) -> update store ### module.exports.updateStore = updateStore = (model) -> + model.setNull '_items.next', {} user = model.at('_user') equipped = user.get('items') @@ -141,12 +143,9 @@ module.exports.updateStore = updateStore = (model) -> else if i is items[type].length showNext = false - model.set "_items.#{type}", if showNext then items[type][i] else {hide:true} - - model.set '_items.potion', items.potion - model.set '_items.reroll', items.reroll - model.set '_items.pets', items.pets - model.set '_items.hatchingPotions', items.hatchingPotions + model.set "_items.next.#{type}", if showNext then items[type][i] else {hide:true} + + diff --git a/views/app/rewards.html b/views/app/rewards.html index bde72795f2..95eec9ec55 100644 --- a/views/app/rewards.html +++ b/views/app/rewards.html @@ -36,12 +36,12 @@ @@ -61,24 +61,24 @@ -
  • +
  • - +
    - {#if @reroll} + {#if equal(@item.type),'reroll')} {else} - - {:item.value} + + {@item.value} {/}
    - -

    {:item.text}

    + +

    {@item.text}