1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

localize plugin installation process

This commit is contained in:
Luke Pulverenti 2014-08-31 15:15:33 -04:00
parent c444daa6e8
commit 7a319688de
7 changed files with 215 additions and 185 deletions

View file

@ -32,7 +32,7 @@
//change command back
$('#ppCmd', page).val('_xclick');
}
function setItemNumber(page, itemNumber) {
$('#ppItemNo', page).val(itemNumber);
}
@ -67,6 +67,61 @@
$("#donateAmt", page).val(getDonationAmount(page));
}
function loadUserInfo(page) {
ApiClient.getJSON(ApiClient.getUrl('System/SupporterInfo')).done(function (info) {
$('.hfPlanType', page).val(info.PlanType || '');
$('.hfIsActive', page).val(info.IsActiveSupporter.toString());
$('.radioDonationType', page).checked(false).checkboxradio('refresh');
if (info.PlanType == 'Lifetime' && info.IsActiveSupporter) {
// If they have an active lifetime plan, select the one-time option
$('#radioOneTimeDonation', page).checked(true).checkboxradio('refresh');
} else {
// For all other statuses, select lifetime, to either acquire or upgrade
$('#radioLifetimeSupporter', page).checked(true).checkboxradio('refresh');
}
$('.radioDonationType:checked', page).trigger('change');
if (info.IsActiveSupporter || info.IsExpiredSupporter) {
$('.currentPlanInfo', page).show();
} else {
$('.currentPlanInfo', page).hide();
}
if (info.IsActiveSupporter && info.PlanType == 'Lifetime') {
$('.planSummary', page)
.html('You have a lifetime supporter club membership. You can provide additional donations on a one-time or recurring basis using the options below. Thank you for supporting Media Browser.')
.css('color', 'green');
}
else if (info.IsActiveSupporter) {
$('.planSummary', page)
.html('You have an active ' + info.PlanType + ' membership. You can upgrade your plan using the options below.')
.css('color', 'green');
}
else if (info.IsExpiredSupporter) {
var expirationDate = info.ExpirationDate ? parseISO8601Date(info.ExpirationDate, { toLocal: true }) : new Date();
expirationDate = expirationDate.toLocaleDateString();
$('.planSummary', page)
.html('Your ' + info.PlanType + ' membership expired on ' + expirationDate + '.')
.css('color', 'red');
}
});
}
$(document).on('pageinit', "#supporterPage", function () {
var page = this;
@ -102,7 +157,6 @@
$('.fldOneTimeDonationAmount', page).hide();
removeRecurringFields(page);
setItemNumber(page, 'MBSupporter');
$('#oneTimeDescription').hide();
}
});
@ -123,10 +177,29 @@
$('.radioDonationType', page).trigger('change');
// TODO: Pull down supporter status
// If already lifetime, had that option, but allow them to add monthly - many supporters probably will
// If already monthly, hide monthly option
// Or possibly not hide and select that option, but that will imply that changing the option will update their PP (can we do that?)
loadUserInfo(page);
});
window.SupporterPage = {
onSubmit: function () {
var form = this;
var page = $(form).parents('.page');
if ($('.hfIsActive', page).val() == 'true') {
var currentPlanType = $('.hfPlanType', page).val();
if (currentPlanType != 'Lifetime') {
// Use a regular alert to block the submission process until they hit ok
alert('After completing this transaction you will need to cancel your previous recurring donation from within your PayPal account. Thank you for supporting Media Browser.');
}
}
}
};
})();