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

add language to startup wizard

This commit is contained in:
Luke Pulverenti 2014-04-27 00:35:04 -04:00
parent 28ea06a627
commit 57eb18290f
4 changed files with 81 additions and 12 deletions

View file

@ -1,6 +1,59 @@
var WizardStartPage = {
(function (window, $) {
gotoNextPage: function () {
Dashboard.navigate('wizarduser.html');
function loadPage(page, config, languageOptions) {
$('#selectLocalizationLanguage', page).html(languageOptions.map(function (l) {
return '<option value="' + l.Value + '">' + l.Name + '</option>';
})).val(config.UICulture).selectmenu('refresh');
Dashboard.hideLoadingMsg();
}
};
function save(page) {
Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) {
config.UICulture = $('#selectLocalizationLanguage', page).val();
ApiClient.updateServerConfiguration(config).done(function (result) {
Dashboard.navigate('wizarduser.html');
});
});
}
$(document).on('pageshow', "#wizardStartPage", function () {
Dashboard.showLoadingMsg();
var page = this;
var promise1 = ApiClient.getServerConfiguration();
var promise2 = $.getJSON(ApiClient.getUrl("Localization/Options"));
$.when(promise1, promise2).done(function (response1, response2) {
loadPage(page, response1[0], response2[0]);
});
});
window.WizardStartPage = {
onSubmit: function () {
save($(this).parents('.page'));
return false;
}
};
})(window, jQuery);