X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=frontend%2Fjs%2Fapp.js;h=6303a892984868c4d496b92efe04c556033e0028;hb=f43b3c162f5a0857d9fd56f4d8005763fcdca4cc;hp=1500457e0a3993c402a18860ac47a7ce2d69acbc;hpb=d0803a0432f50d6d32b498d50f37f4325984e85c;p=perso%2FImmae%2FProjets%2FNodejs%2FSurfer.git diff --git a/frontend/js/app.js b/frontend/js/app.js index 1500457..6303a89 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -35,7 +35,13 @@ function getProfile(accessToken, callback) { app.session.username = result.body.username; app.session.valid = true; - callback(); + superagent.get('/api/settings').query({ access_token: localStorage.accessToken }).end(function (error, result) { + if (error) console.error(error); + + app.folderListingEnabled = !!result.body.folderListingEnabled; + + callback(); + }); }); } @@ -124,10 +130,6 @@ function open(row, event, column) { window.open(encode(path)); } -function up() { - window.location.hash = sanitize(app.path.split('/').slice(0, -1).filter(function (p) { return !!p; }).join('/')); -} - function uploadFiles(files) { if (!files || !files.length) return; @@ -215,7 +217,9 @@ var app = new Vue({ }, onOptionsMenu: function (command) { if (command === 'folderListing') { - console.log('Not implemented'); + superagent.put('/api/settings').send({ folderListingEnabled: this.folderListingEnabled }).query({ access_token: localStorage.accessToken }).end(function (error) { + if (error) console.error(error); + }); } else if (command === 'about') { this.$msgbox({ title: 'About Surfer', @@ -328,7 +332,9 @@ var app = new Vue({ return filesize(cellValue); }, loadDirectory: loadDirectory, - up: up, + onUp: function () { + window.location.hash = sanitize(app.path.split('/').slice(0, -1).filter(function (p) { return !!p; }).join('/')); + }, open: open, drop: drop, dragOver: dragOver