diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-07-05 00:41:59 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-07-05 14:33:08 +0200 |
commit | 772bbd99bee83d17707c73a630a4d47c4b8bc807 (patch) | |
tree | 9cc5293fe3454e3e71be018b80825a5686516ae5 /core/js/public | |
parent | cbfcfb236f3e8ace6c64ab5a654b9a331a3ce1c0 (diff) | |
download | nextcloud-server-772bbd99bee83d17707c73a630a4d47c4b8bc807.tar.gz nextcloud-server-772bbd99bee83d17707c73a630a4d47c4b8bc807.zip |
Backend work to provide NC whats New info to users
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'core/js/public')
-rw-r--r-- | core/js/public/whatsnew.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/core/js/public/whatsnew.js b/core/js/public/whatsnew.js new file mode 100644 index 00000000000..dc5862e8572 --- /dev/null +++ b/core/js/public/whatsnew.js @@ -0,0 +1,54 @@ +/** + * @copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de> + * + * @author Arthur Schiwon <blizzz@arthur-schiwon.de> + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + */ + +(function(OCP) { + "use strict"; + + OCP.WhatsNew = { + + query: function(options) { + options = options || {}; + $.ajax({ + type: 'GET', + url: options.url || OC.linkToOCS('core', 2) + 'whatsnew?format=json', + success: options.success || this._onQuerySuccess, + error: options.error || this._onQueryError + }); + }, + + dismiss: function(version, options) { + options = options || {}; + $.ajax({ + type: 'POST', + url: options.url || OC.linkToOCS('core', 2) + 'whatsnew', + data: {version: encodeURIComponent(version)}, + success: options.success || this._onDismissSuccess, + error: options.error || this._onDismissError + }); + }, + + _onQuerySuccess: function(data, statusText) { + console.debug('querying Whats New data was successful: ' + data || statusText); + console.debug(data); + }, + + _onQueryError: function (o, t, e) { + console.debug(o); + console.debug('querying Whats New Data resulted in an error: ' + t +e); + }, + + _onDismissSuccess: function(data) { + console.debug('dismissing Whats New data was successful: ' + data); + }, + + _onDismissError: function (data) { + console.debug('dismissing Whats New data resulted in an error: ' + data); + } + }; +})(OCP); |