restore ability to edit user preferences from admin screen

This commit is contained in:
Luke Pulverenti 2016-07-11 15:25:27 -04:00
parent 65a75eb894
commit b90d8515b1
8 changed files with 203 additions and 196 deletions

View File

@ -15,12 +15,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.76",
"_release": "1.4.76",
"version": "1.4.77",
"_release": "1.4.77",
"_resolution": {
"type": "version",
"tag": "1.4.76",
"commit": "6221303e81236b1cc47ccc4fd81b536d4c09f752"
"tag": "1.4.77",
"commit": "22897eca3cd924d46ea6b612b8959b6bc8912f7c"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0",

View File

@ -0,0 +1,4 @@
define(['userSettingsBuilder'], function (userSettingsBuilder) {
return new userSettingsBuilder();
});

View File

@ -1,7 +1,15 @@
define(['appSettings', 'apiClientResolver', 'events'], function (appsettings, apiClientResolver, events) {
return function (configuredUserId) {
var self = this;
function getUserId() {
if (configuredUserId) {
return configuredUserId;
}
var apiClient = apiClientResolver();
if (apiClient) {
@ -11,10 +19,6 @@ define(['appSettings', 'apiClientResolver', 'events'], function (appsettings, ap
return null;
}
return new function () {
var self = this;
self.set = function (name, value) {
var userId = getUserId();
@ -94,5 +98,5 @@ define(['appSettings', 'apiClientResolver', 'events'], function (appsettings, ap
});
}
};
}();
};
});

View File

@ -1,4 +1,9 @@
define(['userSettings', 'appStorage'], function (userSettings, appStorage) {
define(['userSettingsBuilder', 'appStorage'], function (userSettingsBuilder, appStorage) {
return function (view, params) {
var userId = params.userId || Dashboard.getCurrentUserId();
var userSettings = new userSettingsBuilder(userId);
function loadForm(page, user) {
@ -28,8 +33,6 @@
function save(page) {
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
if (!AppInfo.enableAutoSave) {
Dashboard.showLoadingMsg();
}
@ -52,8 +55,6 @@
});
}
return function (view, params) {
view.querySelector('.displayPreferencesForm').addEventListener('submit', function (e) {
save(view);
e.preventDefault();
@ -72,8 +73,6 @@
Dashboard.showLoadingMsg();
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
ApiClient.getUser(userId).then(function (user) {
loadForm(page, user);

View File

@ -187,12 +187,10 @@
});
}
function save(page) {
function save(page, userId) {
Dashboard.showLoadingMsg();
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
if (!AppInfo.enableAutoSave) {
Dashboard.showLoadingMsg();
}
@ -252,9 +250,11 @@
return function (view, params) {
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
function onSubmit(e) {
save(view);
save(view, userId);
// Disable default form submission
e.preventDefault();
@ -318,7 +318,7 @@
Dashboard.showLoadingMsg();
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
var userId = params.userId || Dashboard.getCurrentUserId();
ApiClient.getUser(userId).then(function (user) {
@ -334,7 +334,7 @@
var page = this;
if (AppInfo.enableAutoSave) {
save(page);
save(page, userId);
}
});
};

View File

@ -1,4 +1,4 @@
define(['appSettings', 'userSettings'], function (appSettings, userSettings) {
define(['appSettings', 'userSettingsBuilder'], function (appSettings, userSettingsBuilder) {
function populateLanguages(select, languages) {
@ -16,6 +16,11 @@
select.innerHTML = html;
}
return function (view, params) {
var userId = params.userId || Dashboard.getCurrentUserId();
var userSettings = new userSettingsBuilder(userId);
function loadForm(page, user, loggedInUser, allCulturesPromise) {
allCulturesPromise.then(function (allCultures) {
@ -63,8 +68,6 @@
Dashboard.showLoadingMsg();
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
var promise1 = ApiClient.getUser(userId);
var promise2 = Dashboard.getCurrentUser();
@ -113,8 +116,6 @@
appSettings.maxChromecastBitrate(page.querySelector('#selectMaxChromecastBitrate').value);
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
if (!AppInfo.enableAutoSave) {
Dashboard.showLoadingMsg();
}
@ -137,8 +138,6 @@
});
}
return function (view, params) {
view.querySelector('#selectSubtitlePlaybackMode').addEventListener('change', function () {
var subtitlesHelp = view.querySelectorAll('.subtitlesHelp');

View File

@ -1202,7 +1202,7 @@ var Dashboard = {
}
if (browserInfo.mobile || browserInfo.tv) {
quality -= 30;
quality -= 35;
}
if (AppInfo.hasLowImageBandwidth) {
@ -1976,7 +1976,8 @@ var AppInfo = {};
define("scrollHelper", [embyWebComponentsBowerPath + "/scrollhelper"], returnFirstDependency);
define("appSettings", [embyWebComponentsBowerPath + "/appsettings"], updateAppSettings);
define("userSettings", [embyWebComponentsBowerPath + "/usersettings"], returnFirstDependency);
define("userSettings", [embyWebComponentsBowerPath + "/usersettings/usersettings"], returnFirstDependency);
define("userSettingsBuilder", [embyWebComponentsBowerPath + "/usersettings/usersettingsbuilder"], returnFirstDependency);
define("material-icons", ['css!' + embyWebComponentsBowerPath + '/fonts/material-icons/style']);
define("robotoFont", ['css!' + embyWebComponentsBowerPath + '/fonts/roboto/style']);

View File

@ -9,7 +9,7 @@
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);">${TabParentalControl}</a>
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">${TabPassword}</a>
</div>
<p class="lnkEditUserPreferencesContainer hide">
<p class="lnkEditUserPreferencesContainer">
<a class="lnkEditUserPreferences" href="#" target="_blank">${ButtonEditOtherUserPreferences}</a>
</p>
<form class="editUserProfileForm">