mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Adding 1 year expire to admin.
This commit is contained in:
parent
3bb7aa4b42
commit
83d7357306
2 changed files with 19 additions and 2 deletions
|
@ -567,9 +567,13 @@ def upgrade_premium(request):
|
|||
@json.json_view
|
||||
def never_expire_premium(request):
|
||||
user_id = request.POST.get('user_id')
|
||||
years = request.POST.get('years', 0)
|
||||
user = User.objects.get(pk=user_id)
|
||||
if user.profile.is_premium:
|
||||
user.profile.premium_expire = None
|
||||
if years:
|
||||
user.profile.premium_expire = datetime.datetime.now() + datetime.timedelta(days=365*years)
|
||||
else:
|
||||
user.profile.premium_expire = None
|
||||
user.profile.save()
|
||||
return {'code': 1}
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ _.extend(NEWSBLUR.ReaderUserAdmin.prototype, {
|
|||
$actions.append($.make('div', { className: "NB-modal-submit-button NB-modal-submit-green NB-admin-action-refund", style: "float: left" }, "Full Refund"));
|
||||
$actions.append($.make('div', { className: "NB-modal-submit-button NB-modal-submit-green NB-admin-action-refund-partial", style: "float: left" }, "Refund $12"));
|
||||
$actions.append($.make('div', { className: "NB-modal-submit-button NB-modal-submit-green NB-admin-action-never-expire", style: "float: left" }, "Never expire"));
|
||||
$actions.append($.make('div', { className: "NB-modal-submit-button NB-modal-submit-green NB-admin-action-1yr-expire", style: "float: left" }, "Expire 1 YR"));
|
||||
} else {
|
||||
$actions.append($.make('div', { className: "NB-modal-submit-button NB-modal-submit-green NB-admin-action-upgrade" }, "Upgrade to premium"));
|
||||
}
|
||||
|
@ -183,6 +184,18 @@ _.extend(NEWSBLUR.ReaderUserAdmin.prototype, {
|
|||
$(".NB-admin-action-never-expire").replaceWith($.make('div', 'Error: ' + JSON.stringify(data)));
|
||||
});
|
||||
});
|
||||
$.targetIs(e, { tagSelector: '.NB-admin-action-1yr-expire' }, function($t, $p) {
|
||||
e.preventDefault();
|
||||
|
||||
NEWSBLUR.assets.never_expire_premium({
|
||||
'user_id': self.user.get('user_id'),
|
||||
'years': 1
|
||||
}, function(data) {
|
||||
self.fetch_payment_history();
|
||||
}, function(data) {
|
||||
$(".NB-admin-action-never-expire").replaceWith($.make('div', 'Error: ' + JSON.stringify(data)));
|
||||
});
|
||||
});
|
||||
$.targetIs(e, { tagSelector: '.NB-admin-action-upgrade' }, function($t, $p) {
|
||||
e.preventDefault();
|
||||
|
||||
|
@ -211,4 +224,4 @@ _.extend(NEWSBLUR.ReaderUserAdmin.prototype, {
|
|||
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue