From 9c0a640f9f935461a6430211b8232c7897a10630 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sat, 16 Mar 2013 19:10:58 -0400 Subject: [PATCH 1/9] add ads back in --- src/server/private.coffee | 2 +- views/app/modals.html | 9 +++++++++ views/app/tasks.html | 37 +++++++++++++++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/server/private.coffee b/src/server/private.coffee index 3f7bc8e5cc..a016ede9a4 100644 --- a/src/server/private.coffee +++ b/src/server/private.coffee @@ -25,7 +25,7 @@ module.exports.app = (appExports, model) -> address: false amount: 500 name: "Checkout" - description: "Purchase 20 Tokens." + description: "Purchase 20 Tokens, Disable Ads." panelLabel: "Checkout" token: token diff --git a/views/app/modals.html b/views/app/modals.html index 5b0b26792f..e46cf671a9 100644 --- a/views/app/modals.html +++ b/views/app/modals.html @@ -37,6 +37,15 @@ + +

+ Habit an open source project, and can use all the help it can get - consider this a donation to the contributors. You also get 20 tokens from the purchase, which you can use to buy special items. +

+ <@footer> + + +
+ diff --git a/views/app/tasks.html b/views/app/tasks.html index c038cfdb8d..6a254f49ba 100644 --- a/views/app/tasks.html +++ b/views/app/tasks.html @@ -1,3 +1,26 @@ + + {{#if and( _loggedIn, notEqual(_user.flags.ads,'hide') )}} + +
+ +
+ + + + {{/}} + + + @@ -6,7 +29,11 @@

Habits

-
    {#each _habitList as :task}{/}
+
    + {#each _habitList as :task}{/} +
+
+
@@ -15,7 +42,11 @@

Daily

-
    {#each _dailyList as :task}{/}
+
    + {#each _dailyList as :task}{/} +
+
+
@@ -41,6 +72,8 @@
    {#each _todoList as :task}{/}
+
+ From 00db85dff6653733a085f2c998f8e258b536db09 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sat, 16 Mar 2013 19:48:15 -0400 Subject: [PATCH 2/9] protocol agnostic ads --- views/app/tasks.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/views/app/tasks.html b/views/app/tasks.html index da1af0d18a..feba91b9ee 100644 --- a/views/app/tasks.html +++ b/views/app/tasks.html @@ -15,12 +15,10 @@ //--> {{/}} - - From 30d92a1583f3334a638226e94e6c93f55a69bcc2 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Wed, 27 Mar 2013 16:02:29 -0700 Subject: [PATCH 3/9] add username to tokens migration --- migrations/20130327_apply_tokens.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/migrations/20130327_apply_tokens.js b/migrations/20130327_apply_tokens.js index 5f62f55ac3..e958c232b4 100644 --- a/migrations/20130327_apply_tokens.js +++ b/migrations/20130327_apply_tokens.js @@ -58,7 +58,10 @@ var mapping = [ _.each(mapping, function(tier){ db.users.update( { - _id: { $in: tier.users }, + $or: [ + { _id: { $in: tier.users } }, + { 'auth.local.username': { $in: tier.users } } + ], 'backer.tokensApplied': { $exists: false } }, From a84d1920bf5dc91dbc9818dfccf400b9abcaad5c Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Wed, 27 Mar 2013 17:57:39 -0700 Subject: [PATCH 4/9] pets: remove unecessary css --- public/img/sprites/PetEggs.css | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/public/img/sprites/PetEggs.css b/public/img/sprites/PetEggs.css index 3d42804a1a..bd70a03b65 100644 --- a/public/img/sprites/PetEggs.css +++ b/public/img/sprites/PetEggs.css @@ -19,21 +19,4 @@ .Pet_HatchingPotion_Zombie {background-position: -48px -306px; width: 48px; height: 51px} .Pet_HatchingPotion_CottonCandyPink {background-position: -48px -357px; width: 48px; height: 51px} .Pet_HatchingPotion_CottonCandyBlue {background-position: -48px -408px; width: 48px; height: 51px} -.Pet_HatchingPotion_Golden {background-position: -48px -459px; width: 48px; height: 54px} /* This sprite was a bit taller than everything else, will affect the math of anything inserted below it */ - -/* Temporary until we get the other hatching potions */ -/* Commenting this out since it's no longer needed, feel free to completely remove -Shaners -.Pet_HatchingPotion_Zombie, .Pet_HatchingPotion_CottonCandyPink, .Pet_HatchingPotion_CottonCandyBlue, .Pet_HatchingPotion_Golden {background-position: -48px -0px; width: 48px; height: 51px} -.Pet_HatchingPotion_Zombie { - -webkit-filter: invert(1); -} -.Pet_HatchingPotion_CottonCandyPink { - -webkit-filter: hue-rotate(120deg); -} -.Pet_HatchingPotion_CottonCandyBlue { - -webkit-filter: saturate(3); -} -.Pet_HatchingPotion_Golden { - -webkit-filter: hue-rotate(220deg); -} -*/ \ No newline at end of file +.Pet_HatchingPotion_Golden {background-position: -48px -459px; width: 48px; height: 54px} /* This sprite was a bit taller than everything else, will affect the math of anything inserted below it */ \ No newline at end of file From 83bfee0fa308038ebce9620b13fb70523a4eac9e Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Wed, 27 Mar 2013 23:23:19 -0700 Subject: [PATCH 5/9] and include email in apply_tokens --- migrations/20130327_apply_tokens.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migrations/20130327_apply_tokens.js b/migrations/20130327_apply_tokens.js index e958c232b4..917a7650b4 100644 --- a/migrations/20130327_apply_tokens.js +++ b/migrations/20130327_apply_tokens.js @@ -60,7 +60,8 @@ _.each(mapping, function(tier){ { $or: [ { _id: { $in: tier.users } }, - { 'auth.local.username': { $in: tier.users } } + { 'auth.local.username': { $in: tier.users } }, + { 'auth.local.email': { $in: tier.users } } ], 'backer.tokensApplied': { $exists: false } }, From 157f0400e167ef89afdad844ec347b999a62fbad Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Thu, 28 Mar 2013 00:25:45 -0700 Subject: [PATCH 6/9] fix tokens migration script --- migrations/20130327_apply_tokens.js | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/migrations/20130327_apply_tokens.js b/migrations/20130327_apply_tokens.js index 917a7650b4..73b0d1b997 100644 --- a/migrations/20130327_apply_tokens.js +++ b/migrations/20130327_apply_tokens.js @@ -55,6 +55,38 @@ var mapping = [ } ]; +db.users.find().forEach(function(user){ + + _.each(mapping, function(tier){ + if( + (!user.backer || !user.backer.tokensApplied) && + + ( + _.contains(tier.users, user._id) || + !!user.local && ( + _.contains(tier.users, user.local.username) || + _.contains(tier.users, user.local.email) + ) + ) + ) { + try { + db.users.update( + {_id:user._id}, + { + $set: { 'backer.tokensApplied': true, 'flags.ads': 'hide' }, + $inc: { balance: (tier.tokens/4) } + } + ); + } catch(e) { + print(e); + } + } + }) + +}) + +// This doesn't work, but shows the idea we're after better than the above +/* _.each(mapping, function(tier){ db.users.update( { @@ -74,3 +106,4 @@ _.each(mapping, function(tier){ { multi: true} ) }) +*/ From a966c2ce655c39f9b4fb0a016368a0ebd1daa8c5 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Thu, 28 Mar 2013 00:34:05 -0700 Subject: [PATCH 7/9] pets: rename base.name to from "Common" to "Base" for technical reasons --- src/app/items.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/items.coffee b/src/app/items.coffee index 9f15bb3908..17a7c40e3b 100644 --- a/src/app/items.coffee +++ b/src/app/items.coffee @@ -51,7 +51,7 @@ items = module.exports.items = ] hatchingPotions: [ - {text: 'Common', name: 'Base', notes: "Hatches your pet in it's base form.", value: 1} + {text: 'Base', name: 'Base', notes: "Hatches your pet in it's base form.", value: 1} {text: 'White', name: 'White', notes: 'Turns your animal into a White pet.', value: 2} {text: 'Desert', name: 'Desert', notes: 'Turns your animal into a Desert pet.', value: 2} {text: 'Red', name: 'Red', notes: 'Turns your animal into a Red pet.', value: 3} From 88badc492929bfd91ba5c1fe041df8ddf3cbb627 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Thu, 28 Mar 2013 00:36:57 -0700 Subject: [PATCH 8/9] pets: list cost of items in market --- views/app/pets.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/views/app/pets.html b/views/app/pets.html index 51e7896471..8bd02bb78c 100644 --- a/views/app/pets.html +++ b/views/app/pets.html @@ -23,14 +23,14 @@ -
- {.text} +
+ {.text}
{.value} tokens -
- {.text} +
+ {.text}
{.value} tokens From d2b4072ad6bcb9774ede4c0a1c2f37dd316f0e62 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Thu, 28 Mar 2013 00:49:57 -0700 Subject: [PATCH 9/9] better wording on buying tokens --- src/server/private.coffee | 4 +++- views/app/modals.html | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/server/private.coffee b/src/server/private.coffee index a016ede9a4..1606395bf5 100644 --- a/src/server/private.coffee +++ b/src/server/private.coffee @@ -20,12 +20,14 @@ module.exports.app = (appExports, model) -> .error (err) -> alert err.responseText + disableAds = if (model.get('_user.flags.ads') is 'hide') then '' else 'Disable Ads, ' + StripeCheckout.open key: model.get('_stripePubKey') address: false amount: 500 name: "Checkout" - description: "Purchase 20 Tokens, Disable Ads." + description: "Buy 20 Tokens, #{disableAds}Support the Developers" panelLabel: "Checkout" token: token diff --git a/views/app/modals.html b/views/app/modals.html index 57f1ed5185..b435bcf479 100644 --- a/views/app/modals.html +++ b/views/app/modals.html @@ -32,7 +32,7 @@ -

You're out of tokens, which are used to buy pets and mounts.

+

Oops, out of tokens, which are used to buy special items! Habit is an open source project, and can use all the help it can get - buy more tokens to receive this pet, and consider it a donation to the contributors

<@footer> Buy More TokensNot enough tokens @@ -42,6 +42,9 @@

Habit an open source project, and can use all the help it can get - consider this a donation to the contributors. You also get 20 tokens from the purchase, which you can use to buy special items.

+

+ "Hey, I backed the Kickstarter!" - follow these instructions. +

<@footer>