From c5ccc4ef9af5821ff3050df20f810c17bd45dc31 Mon Sep 17 00:00:00 2001 From: Andy Heathershaw Date: Fri, 14 Sep 2018 11:15:40 +0100 Subject: [PATCH] #71: Updated deployed JS file with the new SettingsViewModel --- public/js/blue-twilight.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/public/js/blue-twilight.js b/public/js/blue-twilight.js index a189213..6bc6872 100644 --- a/public/js/blue-twilight.js +++ b/public/js/blue-twilight.js @@ -22245,6 +22245,44 @@ function AboutViewModel(urls) { } }; } + +/** + * This model is used by admin/settings.blade.php. + * @constructor + */ +function SettingsViewModel(urls, lang) { + this.el = '#settings-app'; + + this.data = { + is_rebuilding_permissions_cache: false + }; + + this.methods = { + rebuildPermissionsCache: function (e) { + var self = this; + + $.ajax( + urls.rebuild_permissions_cache, + { + complete: function() { + self.is_rebuilding_permissions_cache = false; + }, + dataType: 'json', + error: function (xhr, textStatus, errorThrown) { + alert(lang.permissions_cache_rebuild_failed); + }, + method: 'POST', + success: function (data) { + alert(lang.permissions_cache_rebuild_succeeded); + } + } + ); + + e.preventDefault(); + return false; + } + }; +} /** * This model is used by admin/analyse_album.blade.php, to analyse all images. * @constructor