mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-18 09:52:20 +00:00
feat(premium): backport client-side premium code to public repo, it's
client-side anyway (@colegleason @paglias)
This commit is contained in:
parent
cc934b577e
commit
2e18f0eb82
8 changed files with 231 additions and 52 deletions
|
|
@ -191,4 +191,30 @@ a
|
|||
right: auto
|
||||
margin: 0 auto 20px
|
||||
z-index: 1
|
||||
max-width: 100%
|
||||
max-width: 100%
|
||||
|
||||
.buy-gems
|
||||
.nav-tabs
|
||||
margin-top: 0.5em
|
||||
.gem-wallet
|
||||
padding-top: 2px
|
||||
|
||||
.subscription-features
|
||||
tr
|
||||
td
|
||||
height 59px
|
||||
/*font-size: 1.75em;*/
|
||||
/*line-height: 1.714285714em;*/
|
||||
vertical-align middle
|
||||
text-align center
|
||||
th
|
||||
max-width: 150px
|
||||
font-weight normal
|
||||
th.feature-name
|
||||
text-align center
|
||||
font-weight: bold
|
||||
.dashed-underline
|
||||
border-bottom:1px dashed #000
|
||||
text-decoration:none
|
||||
cursor pointer
|
||||
|
||||
|
|
|
|||
|
|
@ -205,6 +205,10 @@ window.habitrpg = angular.module('habitrpg',
|
|||
url: "/export",
|
||||
templateUrl: "partials/options.settings.export.html"
|
||||
})
|
||||
.state('options.settings.subscription', {
|
||||
url: "/subscription",
|
||||
templateUrl: "partials/options.settings.subscription.html"
|
||||
})
|
||||
|
||||
var settings = JSON.parse(localStorage.getItem(STORAGE_SETTINGS_ID));
|
||||
if (settings && settings.auth) {
|
||||
|
|
|
|||
|
|
@ -79,27 +79,39 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||
$rootScope.flash[type].splice($index, 1);
|
||||
}
|
||||
|
||||
$rootScope.showStripe = function() {
|
||||
$rootScope.showStripe = function(subscription) {
|
||||
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",
|
||||
name: subscription ? "Subscribe" : "Checkout",
|
||||
description: subscription ?
|
||||
"Buy gems with Gold, No Ads, Support the Devs" :
|
||||
"20 Gems, No Ads, Support the Devs",
|
||||
panelLabel: subscription ? "Subscribe" : "Checkout",
|
||||
token: function(data) {
|
||||
var url = '/api/v2/user/buy-gems';
|
||||
if (subscription) url += '?plan=basic_earned';
|
||||
// if (subscription) url += '?plan=test';
|
||||
$scope.$apply(function(){
|
||||
$http.post("/api/v2/user/buy-gems", data)
|
||||
.success(function() {
|
||||
window.location.href = "/";
|
||||
}).error(function(err) {
|
||||
alert(err);
|
||||
});
|
||||
$http.post(url, data).success(function() {
|
||||
window.location.reload(true);
|
||||
}).error(function(err) {
|
||||
alert(err);
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$scope.cancelSubscription = function(){
|
||||
if (!confirm("Are you sure you want to cancel your subscription?")) return;
|
||||
//TODO use Stripe API to keep subscription till end of their month
|
||||
$http.post('/api/v2/user/cancel-subscription').success(function(){
|
||||
window.location.reload(true);
|
||||
})
|
||||
}
|
||||
|
||||
$scope.contribText = function(contrib, backer){
|
||||
if (!contrib && !backer) return;
|
||||
if (backer && backer.npc) return backer.npc;
|
||||
|
|
|
|||
|
|
@ -152,3 +152,9 @@ script(type='text/ng-template', id='partials/options.inventory.drops.html')
|
|||
p
|
||||
| 8
|
||||
span.Pet_Currency_Gem1x.inline-gems
|
||||
div(ng-if='user.purchased.plan.planId')
|
||||
button.customize-option(ng-click='user.ops.purchase({params:{type:"gems",key:"gem"}})')
|
||||
span.Pet_Currency_Gem.inline-gems
|
||||
p
|
||||
| 20
|
||||
span.shop_gold
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ script(id='partials/options.settings.html', type="text/ng-template")
|
|||
li(ng-class="{ active: $state.includes('options.settings.export') }")
|
||||
a(ui-sref='options.settings.export')
|
||||
=env.t('dataexport')
|
||||
li(ng-class="{ active: $state.includes('options.settings.subscription') }")
|
||||
a(ui-sref='options.settings.subscription')
|
||||
| Subscription
|
||||
|
||||
.tab-content
|
||||
.tab-pane.active
|
||||
|
|
@ -108,3 +111,144 @@ script(id='partials/options.settings.export.html', type="text/ng-template")
|
|||
=env.t('exportuserdata')
|
||||
a(href="/export/userdata.xml")= ' ' + env.t('xml') + ' '
|
||||
a(href="/export/userdata.json")= env.t('json')
|
||||
|
||||
script(id='partials/options.settings.subscription.perks.html',type='text/ng-template')
|
||||
table.table.table-striped
|
||||
tr
|
||||
td
|
||||
span.dashed-underline(popover="Ads will stay disabled while you have an active account (original users with disabled ads are grandfathered).",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Disable ads
|
||||
tr
|
||||
td
|
||||
span.dashed-underline(popover="(1 Gem costs {{Shared.planGemLimits.convRate}} Gold) Addresses the \"pay to win\" concern, as everything is now achievable through hard work. There's a {{Shared.planGemLimits.convCap}}G monthly conversion cap to prevent farming.",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Buy Gems with Gold
|
||||
tr
|
||||
td
|
||||
span.dashed-underline(popover="Makes your full history available in graphs and export. Non-subscriber histories get consolidated for database optimization.",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Retain full history entries
|
||||
tr
|
||||
td
|
||||
span.dashed-underline(popover="Complete your stable faster!",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Daily drop-caps doubled
|
||||
//-tr
|
||||
//- td +20 gems to your account
|
||||
tr
|
||||
td
|
||||
span.dashed-underline(popover="This open source project can use all the help it can get. Help us keep Habit alive!",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Supports the developers
|
||||
tr
|
||||
td.alert.alert-info $5 USD / Month
|
||||
|
||||
script(id='partials/feature-matrix-check.html',type='text/ng-template')
|
||||
span.task-checker.action-yesno
|
||||
input.focusable(type='checkbox', checked)
|
||||
label
|
||||
|
||||
script(id='partials/options.settings.subscription.html',type='text/ng-template')
|
||||
|
||||
.well
|
||||
h2 Individual Subscription
|
||||
div(ng-if='!user.purchased.plan.customerId')
|
||||
div(ng-include="'partials/options.settings.subscription.perks.html'")
|
||||
.btn.btn-primary(ng-click='showStripe(true)') Subscribe
|
||||
//-small.muted PayPal coming soon.
|
||||
|
||||
div(ng-if='user.purchased.plan.customerId')
|
||||
.well
|
||||
div(style='font-size:22px')
|
||||
i.icon-ok
|
||||
| Subscribed
|
||||
div(ng-include="'partials/options.settings.subscription.perks.html'")
|
||||
.btn.btn-small.btn-danger(ng-click='cancelSubscription()') Cancel Subscription
|
||||
|
||||
|
||||
//-.well.subscription-features
|
||||
h2 Administrator Subscriptions
|
||||
|
||||
table.table.table-striped
|
||||
tr
|
||||
th.feature-name
|
||||
//th.feature-name.muted Family (Coming Soon)
|
||||
//th.feature-name.muted Bronze (Coming Soon)
|
||||
//th.feature-name.muted Silver (Coming Soon)
|
||||
th.feature-name Gold
|
||||
th.feature-name.muted More Plans<br/>Coming Soon
|
||||
tr
|
||||
th
|
||||
span.dashed-underline(popover="Members of the organization participate outside of HabitRPG proper, providing focus for your participants.",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Private Organization
|
||||
//td(ng-include="'partials/feature-matrix-check.html'")
|
||||
//td(ng-include="'partials/feature-matrix-check.html'")
|
||||
//td(ng-include="'partials/feature-matrix-check.html'")
|
||||
td(ng-include="'partials/feature-matrix-check.html'")
|
||||
td
|
||||
tr
|
||||
th
|
||||
span.dashed-underline(popover="Shared hosting means your organization uses the same database as HabitRPG proper even though you don't interact with Habitica. Dedicated means you get your own database and server. You can choose to have HabitRPG host your server/db, or we can install it on your own servers.",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Hosting Type
|
||||
//td Shared
|
||||
//td Shared
|
||||
//td Shared
|
||||
td Dedicated
|
||||
td
|
||||
|
||||
tr
|
||||
th
|
||||
span.dashed-underline(popover="We can optionally give you your own domain for the installation.",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Custom Domain
|
||||
//td.muted
|
||||
//td.muted
|
||||
//td.muted
|
||||
td(ng-include="'partials/feature-matrix-check.html'")
|
||||
td
|
||||
tr
|
||||
th
|
||||
span.dashed-underline(popover="The maximum number of players in your private organization.",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Max Participants
|
||||
//td.muted 10
|
||||
//td.muted 50
|
||||
//td.muted 150
|
||||
td Unlimited
|
||||
td
|
||||
tr
|
||||
th
|
||||
span.dashed-underline(popover="First to be provided for with support.",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Priority support on tickets & hosting
|
||||
//td.muted
|
||||
//td.muted
|
||||
//td.muted
|
||||
td(ng-include="'partials/feature-matrix-check.html'")
|
||||
td
|
||||
tr
|
||||
th
|
||||
span.dashed-underline(popover="We will provide support for training, bugs, installation, and feature requests.",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Support Hours / Month
|
||||
//td.muted 10
|
||||
//td.muted 20
|
||||
//td.muted 30
|
||||
td Unlimited
|
||||
td
|
||||
tr
|
||||
th
|
||||
h5 In-Game features
|
||||
ul(style='margin:0 0 10px 25px;')
|
||||
li Ads disabled for members
|
||||
li
|
||||
span.dashed-underline(popover="Members will be able to purchase gems with gold, meaning none of your participants need to buy anything with real money.",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Gems purchasable with gold
|
||||
li
|
||||
span.dashed-underline(popover="We will provide the organization leaders with as many gems as they need, for things like challenge prizes, guild-creation, etc.",popover-trigger='mouseenter',popover-placement='right')
|
||||
| Infinite leader gems
|
||||
//td(ng-include="'partials/feature-matrix-check.html'")
|
||||
//td(ng-include="'partials/feature-matrix-check.html'")
|
||||
//td(ng-include="'partials/feature-matrix-check.html'")
|
||||
td(ng-include="'partials/feature-matrix-check.html'")
|
||||
td
|
||||
tr
|
||||
th
|
||||
| Price
|
||||
//td.alert.alert-info ??? USD / Month
|
||||
//td.alert.alert-info ??? USD / Month
|
||||
//td.alert.alert-info ??? USD / Month
|
||||
td.alert.alert-info ??? USD / Month
|
||||
td
|
||||
|
|
@ -1,43 +1,30 @@
|
|||
div(modal='modals.buyGems')
|
||||
.modal-header
|
||||
include ../gems
|
||||
h3=env.t('buyGemsDonate')
|
||||
|
||||
.modal-body
|
||||
table
|
||||
tr
|
||||
td
|
||||
.npc_justin
|
||||
td
|
||||
.popover.static-popover.fade.right.in.wide-popover
|
||||
.arrow
|
||||
h3.popover-title
|
||||
a(target='_blank', href='https://twitter.com/bowenNstuff')=env.t('justin')
|
||||
.popover-content
|
||||
.buy-gems
|
||||
include ../gems
|
||||
.well
|
||||
h3 Buy Gems
|
||||
table.table
|
||||
tr
|
||||
td
|
||||
span.dashed-underline(popover=env.t('donateText1'),popover-trigger='mouseenter',popover-placement='right')
|
||||
| +20 <span class="Pet_Currency_Gem1x inline-gems"/>
|
||||
tr
|
||||
td
|
||||
span.dashed-underline(popover=env.t('donateText3'),popover-trigger='mouseenter',popover-placement='right')
|
||||
=env.t('donateText2')
|
||||
tr
|
||||
td.alert.alert-info=env.t('fiveUSD1')
|
||||
tr
|
||||
td
|
||||
.btn.btn-primary(ng-click='showStripe()',style='margin-left:10px;')=env.t('payWithCard')
|
||||
div(style='float:left;')
|
||||
//-script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=#{env.PAYPAL_MERCHANT}', data-button='buynow', data-name=env.t('paypalText'), data-quantity='1', data-amount='5', data-currency='USD', data-tax='0', data-callback='#{env.BASE_URL}/api/v2/user/buy-gems/paypal-ipn', data-env="#{env.NODE_ENV == 'production' ? '' : 'sandbox'}", data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}', data-return='#{env.BASE_URL}', data-rm='1', data-no_shipping='1')
|
||||
script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=#{env.PAYPAL_MERCHANT}', data-button='buynow', data-name=env.t('paypalText'), data-quantity='1', data-amount='5', data-currency='USD', data-tax='0', data-callback='#{env.BASE_URL}/api/v2/user/buy-gems/paypal-ipn', data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}', data-return='#{env.BASE_URL}', data-rm='1', data-no_shipping='1')
|
||||
p
|
||||
span(class='label label-info')=env.t('fiveUSD1')
|
||||
|
|
||||
=env.t('fiveUSD2')
|
||||
ul.modal-indented-list
|
||||
li=env.t('donateText1')
|
||||
li=env.t('donateText2')
|
||||
li=env.t('donateText3')
|
||||
br
|
||||
.row-fluid
|
||||
.span6.well
|
||||
h3=env.t('payWithCard')
|
||||
.btn.btn-primary(ng-click='showStripe()')=env.t('payWithCard')
|
||||
br
|
||||
br
|
||||
small
|
||||
.alert.alert-info=env.t('payRecommended')
|
||||
.span6.well
|
||||
h3=env.t('payWithPaypal')
|
||||
//-script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=#{env.PAYPAL_MERCHANT}', data-button='buynow', data-name=env.t('paypalText'), data-quantity='1', data-amount='5', data-currency='USD', data-tax='0', data-callback='#{env.BASE_URL}/api/v2/user/buy-gems/paypal-ipn', data-env="#{env.NODE_ENV == 'production' ? '' : 'sandbox'}", data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}', data-return='#{env.BASE_URL}', data-rm='1', data-no_shipping='1')
|
||||
script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=#{env.PAYPAL_MERCHANT}', data-button='buynow', data-name=env.t('paypalText'), data-quantity='1', data-amount='5', data-currency='USD', data-tax='0', data-callback='#{env.BASE_URL}/api/v2/user/buy-gems/paypal-ipn', data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}', data-return='#{env.BASE_URL}', data-rm='1', data-no_shipping='1')
|
||||
br
|
||||
small
|
||||
.alert=env.t('payNote')
|
||||
small.muted(style='line-height:10px;')=env.t('payNote')
|
||||
|
||||
div(ng-include="'partials/options.settings.subscription.html'")
|
||||
|
||||
.modal-footer
|
||||
button.btn.btn-default.cancel(ng-click='modals.buyGems = false')=env.t('cancel')
|
||||
button.btn.btn-default.cancel(ng-click='modals.buyGems = false')=env.t('cancel')
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ div(ng-controller='SettingsCtrl')
|
|||
.option-group.option-medium
|
||||
input.option-content(type='number', step="any", data-for='stats.exp', ng-model='restoreValues.stats.exp')
|
||||
span.input-suffix=env.t('experience')
|
||||
.option-group.option-medium
|
||||
.option-group.option-medium(ng-if='!user.purchased.plan.customerId')
|
||||
//input.option-content(type='number', step="any", data-for='stats.gp', ng-model='restoreValues.stats.gp')
|
||||
input.option-content(type='number', step="any", data-for='stats.gp', ng-model='restoreValues.stats.gp',disabled)
|
||||
span.input-suffix=env.t('gold')
|
||||
|
|
|
|||
|
|
@ -102,9 +102,9 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
br
|
||||
|
||||
// Ads
|
||||
div(bo-if='main && !user.purchased.ads && list.type!="reward"')
|
||||
div(bo-if='main && !user.purchased.ads && !user.purchased.plan.customerId && list.type!="reward"')
|
||||
span.pull-right
|
||||
a(ng-click='modals.buyGems=true', tooltip=env.t('removeAds'))
|
||||
a(ui-sref='options.settings.subscription', popover=env.t('removeAds'), popover-trigger='mouseenter')
|
||||
i.icon-remove
|
||||
// Habit3
|
||||
ins.adsbygoogle(ng-init='initAds()', style='display: inline-block; width: 234px; height: 60px;', data-ad-client='ca-pub-3242350243827794', data-ad-slot='9529624576')
|
||||
|
|
|
|||
Loading…
Reference in a new issue