update components
This commit is contained in:
parent
ad0970d09f
commit
6da165c3c2
51 changed files with 1715 additions and 454 deletions
|
@ -197,12 +197,37 @@
|
|||
displayPreferences.CustomPrefs.home2 = $('#selectHomeSection3', page).val();
|
||||
displayPreferences.CustomPrefs.home3 = $('#selectHomeSection4', page).val();
|
||||
|
||||
ApiClient.updateDisplayPreferences('home', displayPreferences, user.Id, AppSettings.displayPreferencesKey()).then(function () {
|
||||
return ApiClient.updateDisplayPreferences('home', displayPreferences, user.Id, AppSettings.displayPreferencesKey()).then(function () {
|
||||
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).then(function () {
|
||||
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||
return ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||
});
|
||||
}
|
||||
|
||||
function save(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
Dashboard.showLoadingMsg();
|
||||
}
|
||||
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
ApiClient.getDisplayPreferences('home', user.Id, AppSettings.displayPreferencesKey()).then(function (displayPreferences) {
|
||||
|
||||
saveUser(page, user, displayPreferences).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||
}
|
||||
|
||||
}, function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
loadForm(page, user, displayPreferences);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -211,25 +236,13 @@
|
|||
|
||||
var page = $(this).parents('.page')[0];
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
ApiClient.getDisplayPreferences('home', user.Id, AppSettings.displayPreferencesKey()).then(function (displayPreferences) {
|
||||
|
||||
saveUser(page, user, displayPreferences);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
save(page);
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#homeScreenPreferencesPage", function () {
|
||||
pageIdOn('pageinit', "homeScreenPreferencesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -272,7 +285,15 @@
|
|||
|
||||
$('.homeScreenPreferencesForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshow', "#homeScreenPreferencesPage", function () {
|
||||
if (AppInfo.enableAutoSave) {
|
||||
page.querySelector('.btnSave').classList.add('hide');
|
||||
} else {
|
||||
page.querySelector('.btnSave').classList.remove('hide');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
pageIdOn('pageshow', "homeScreenPreferencesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -290,4 +311,13 @@
|
|||
});
|
||||
});
|
||||
|
||||
pageIdOn('pagebeforehide', "homeScreenPreferencesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
if (AppInfo.enableAutoSave) {
|
||||
save(page);
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery, window, document);
|
Loading…
Add table
Add a link
Reference in a new issue