mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-14 10:12:21 +00:00
paypal: conslidate buy gems modals
This commit is contained in:
parent
09cd132420
commit
5de0c928fe
11 changed files with 50 additions and 52 deletions
|
|
@ -168,4 +168,8 @@ a
|
|||
word-wrap: break-word
|
||||
|
||||
.btn
|
||||
margin-right: 5px
|
||||
margin-right: 5px
|
||||
|
||||
.buy-gems-list
|
||||
margin-left: 10px;
|
||||
padding-left: 10px;
|
||||
|
|
@ -114,7 +114,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
|||
|
||||
$scope.create = function(group){
|
||||
if (User.user.balance < 1) {
|
||||
return $rootScope.modals.moreGems = true;
|
||||
return $rootScope.modals.buyGems = true;
|
||||
// $('#more-gems-modal').modal('show');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ habitrpg.controller("MarketCtrl", ['$rootScope', '$scope', 'User', 'API_URL', '$
|
|||
storePath = type === 'egg' ? 'items.eggs' : 'items.hatchingPotions'
|
||||
|
||||
if(gems < item.value){
|
||||
return $rootScope.modals.moreGems = true;
|
||||
return $rootScope.modals.buyGems = true;
|
||||
}
|
||||
|
||||
var message = "Buy this " + (type == 'egg' ? 'egg' : 'hatching potion') + " with " + item.value + " of your " + gems + " Gems?"
|
||||
|
|
|
|||
|
|
@ -42,25 +42,24 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||
}
|
||||
|
||||
$rootScope.showStripe = function() {
|
||||
var disableAds = User.user.flags.ads == 'hide' ? '' : 'Disable Ads, ';
|
||||
StripeCheckout.open({
|
||||
key: window.env.STRIPE_PUB_KEY,
|
||||
address: false,
|
||||
amount: 500,
|
||||
name: "Checkout",
|
||||
description: "Buy 20 Gems, " + disableAds + "Support the Developers",
|
||||
panelLabel: "Checkout",
|
||||
token: function(data) {
|
||||
$scope.$apply(function(){
|
||||
$http.post("/api/v1/user/buy-gems", data)
|
||||
.success(function() {
|
||||
window.location.href = "/";
|
||||
}).error(function(err) {
|
||||
alert(err);
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
StripeCheckout.open({
|
||||
key: window.env.STRIPE_PUB_KEY,
|
||||
address: false,
|
||||
amount: 500,
|
||||
name: "Checkout",
|
||||
//description: "Buy 20 Gems, Disable Ads, Support the Developers",
|
||||
panelLabel: "Checkout",
|
||||
token: function(data) {
|
||||
$scope.$apply(function(){
|
||||
$http.post("/api/v1/user/buy-gems", data)
|
||||
.success(function() {
|
||||
window.location.href = "/";
|
||||
}).error(function(err) {
|
||||
alert(err);
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
a.pull-right.gem-wallet(popover-trigger='mouseenter', popover-title='Gems', popover="Used for buying special items (reroll, eggs, hatching potions, etc). You'll need to unlock those features before being able to use Gems.", popover-placement='bottom')
|
||||
span.task-action-btn.tile.flush.bright.add-gems-btn(ng-click='showStripe()') +
|
||||
span.task-action-btn.tile.flush.bright.add-gems-btn(ng-click='modals.buyGems = true') +
|
||||
span.task-action-btn.tile.flush.neutral
|
||||
.Gems
|
||||
| {{user.balance * 4 | number:0}} Gems
|
||||
21
views/shared/modals/buy-gems.jade
Normal file
21
views/shared/modals/buy-gems.jade
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
div(modal='modals.buyGems')
|
||||
.modal-header
|
||||
h3 Buy Gems / Donate
|
||||
|
||||
.modal-body
|
||||
include ../gems
|
||||
p <span class='label label-info'>$5 USD</span> will:
|
||||
ul.buy-gems-list
|
||||
li Add 20 gems to your account, which are used to buy special items.
|
||||
li Disable ads.
|
||||
li Donate to the developers (as an open source project, we can us all the help we can get).
|
||||
.row-fluid
|
||||
.span6.well
|
||||
h3 Pay with Card
|
||||
.btn.btn-primary(ng-click='showStripe()') Pay with Card
|
||||
.span6.well
|
||||
h3 Pay with PayPal
|
||||
script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=tylerrenelle-facilitator@gmail.com', data-button='buynow', data-name='20 Gems, Disable Ads, Donation to the Developers', data-quantity='1', data-amount='.1', data-currency='USD', data-shipping='0', data-tax='0', data-callback='#{env.BASE_URL}/api/v1/user/buy-gems/paypal-ipn', data-env='sandbox', data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}')
|
||||
|
||||
.modal-footer
|
||||
button.btn.btn-default.cancel(ng-click='modals.buyGems = false') Cancel
|
||||
|
|
@ -3,8 +3,7 @@ include ./login
|
|||
include ./reroll
|
||||
include ./death
|
||||
include ./new-stuff
|
||||
include ./why-ads
|
||||
include ./more-gems
|
||||
include ./buy-gems
|
||||
include ./members
|
||||
include ./settings
|
||||
include ./pets
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
div(modal='modals.moreGems', header='Out Of Gems')
|
||||
.modal-header
|
||||
h3 Out Of Gems
|
||||
.modal-body
|
||||
include ../gems
|
||||
p.
|
||||
Oops, out of Gems, which are used to buy special items! Habit is an open source project, and can use all the help
|
||||
it can get - buy more Gems to receive this pet, and consider it a donation to the contributors.
|
||||
.modal-footer
|
||||
button.btn.btn-default.cancel(ng-click='modals.moreGems = false') Cancel
|
||||
|
|
@ -11,7 +11,7 @@ div(modal='modals.reroll')
|
|||
|
||||
.modal-footer
|
||||
span(ng-if='user.balance < 1')
|
||||
a.btn.btn-success.btn-large(ng-click="showStripe()") Buy More Gems
|
||||
a.btn.btn-success.btn-large(ng-click="modals.buyGems = true") Buy More Gems
|
||||
span.gem-cost Not enough Gems
|
||||
span(ng-if='user.balance >= 1', ng-controller='SettingsCtrl')
|
||||
a.btn.btn-danger.btn-large(ng-click='reroll()') Re-Roll
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
div(modal='modals.whyAds')
|
||||
.modal-header
|
||||
h3 Why Ads?
|
||||
.modal-body
|
||||
p.
|
||||
Habit is an open source project, and can use all the help it can get - consider this a donation to the contributors. You also get 20 Gems from the purchase, which you can use to buy special items.
|
||||
p.
|
||||
"Hey, I backed the Kickstarter!" - follow <a target='_blank' href='http://community.habitrpg.com/node/22'> these instructions.</a>
|
||||
script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=tylerrenelle-facilitator@gmail.com', data-button='buynow', data-name='20 Gems, Disable Ads, Donation to the Developers', data-quantity='1', data-amount='.1', data-currency='USD', data-shipping='0', data-tax='0', data-callback='#{env.BASE_URL}/api/v1/user/buy-gems/paypal-ipn', data-env='sandbox', data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}')
|
||||
|
||||
.modal-footer
|
||||
button.btn.btn-default.cancel(ng-click='modals.whyAds = false') Ok
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
div(ng-if='authenticated() && user.flags.ads!="hide"')
|
||||
span.pull-right(ng-if='list.type!="reward"')
|
||||
a(ng-click='showStripe()', tooltip='Remove Ads')
|
||||
a(ng-click='modals.buyGems=true', tooltip='Remove Ads')
|
||||
i.icon-remove
|
||||
br
|
||||
a(ng-click='modals.whyAds=true', tooltip='Why Ads?')
|
||||
i.icon-question-sign
|
||||
|
||||
div(ng-if='list.type=="habit"', habitrpg-adsense)
|
||||
script(async='async', src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js')
|
||||
|
|
|
|||
Loading…
Reference in a new issue