summaryrefslogtreecommitdiffstats
path: root/settings/js/usersettings.js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@owncloud.com>2016-04-20 17:03:50 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-11-21 11:29:24 +0100
commit20739c93a680d7085d0e71c0e4f9c0bb24018fb9 (patch)
treeca8659d0fe9de7388a301fe14cee8f2cf2e88a96 /settings/js/usersettings.js
parentc42d977185648fcc34c8e0135973ebc1c4776512 (diff)
downloadnextcloud-server-20739c93a680d7085d0e71c0e4f9c0bb24018fb9.tar.gz
nextcloud-server-20739c93a680d7085d0e71c0e4f9c0bb24018fb9.zip
Persist settings on the server
Persist personal settings federated sharing scopes Show new settings fields in read-only mode too Insert values on page load Return updated values; show inline success feedback Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'settings/js/usersettings.js')
-rw-r--r--settings/js/usersettings.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/settings/js/usersettings.js b/settings/js/usersettings.js
new file mode 100644
index 00000000000..d8d089f83de
--- /dev/null
+++ b/settings/js/usersettings.js
@@ -0,0 +1,47 @@
+/* global OC */
+
+/**
+ * Copyright (c) 2016, Christoph Wurst <christoph@owncloud.com>
+ *
+ * This file is licensed under the Affero General Public License version 3 or later.
+ * See the COPYING-README file.
+ */
+
+(function() {
+ 'use strict';
+
+ /**
+ * Model for storing and saving user settings
+ *
+ * @class UserSettings
+ */
+ var UserSettings = OC.Backbone.Model.extend({
+ url: OC.generateUrl('/settings/users/{id}/settings', {id: OC.currentUser}),
+ parse: function(data) {
+ if (_.isUndefined(data)) {
+ return null;
+ }
+ if (_.isUndefined(data.data)) {
+ return null;
+ }
+ data = data.data;
+
+ var ignored = [
+ 'userId',
+ 'message'
+ ];
+
+ _.each(ignored, function(ign) {
+ if (!_.isUndefined(data[ign])) {
+ delete data[ign];
+ }
+ });
+
+ return data;
+ }
+ });
+
+ OC.Settings = OC.Settings || {};
+
+ OC.Settings.UserSettings = UserSettings;
+})(); \ No newline at end of file