diff options
Diffstat (limited to 'apps/files_external/js')
-rw-r--r-- | apps/files_external/js/settings.js | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index d3e20e38445..b542fe63d64 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -550,7 +550,7 @@ var MountConfigListView = function($el, options) { /** * @memberOf OCA.External.Settings */ -MountConfigListView.prototype = { +MountConfigListView.prototype = _.extend({ /** * jQuery element containing the config list @@ -644,11 +644,31 @@ MountConfigListView.prototype = { addSelect2(this.$el.find('tr:not(#addMountPoint) .applicableUsers'), this._userListLimit); - this.$el.find('tr:not(#addMountPoint)').each(function(i, tr) { + this._initEvents(); + + this.$el.find('tbody tr:not(#addMountPoint)').each(function(i, tr) { self.recheckStorageConfig($(tr)); }); + }, - this._initEvents(); + /** + * Custom JS event handlers + * Trigger callback for all existing configurations + */ + whenSelectBackend: function(callback) { + this.$el.find('tbody tr:not(#addMountPoint)').each(function(i, tr) { + var backend = $(tr).find('.backend').data('class'); + callback($(tr), backend); + }); + this.on('selectBackend', callback); + }, + whenSelectAuthMechanism: function(callback) { + var self = this; + this.$el.find('tbody tr:not(#addMountPoint)').each(function(i, tr) { + var authMechanism = $(tr).find('.selectAuthMechanism').val(); + callback($(tr), authMechanism, self._allAuthMechanisms[authMechanism]['scheme']); + }); + this.on('selectAuthMechanism', callback); }, /** @@ -728,6 +748,8 @@ MountConfigListView.prototype = { var $td = $tr.find('td.configuration'); $.each(backendConfiguration['configuration'], _.partial(this.writeParameterInput, $td)); + this.trigger('selectBackend', $tr, backend); + selectAuthMechanism.trigger('change'); // generate configuration parameters for auth mechanism var priorityEl = $('<input type="hidden" class="priority" value="' + backendConfiguration['priority'] + '" />'); @@ -758,6 +780,10 @@ MountConfigListView.prototype = { this.writeParameterInput, $td, _, _, ['auth-param'] )); + this.trigger('selectAuthMechanism', + $tr, authMechanism, authMechanismConfiguration['scheme'] + ); + if ($tr.data('constructing') !== true) { // row is ready, trigger recheck this.saveStorageConfig($tr); @@ -1045,7 +1071,7 @@ MountConfigListView.prototype = { self.saveStorageConfig($tr); }); } -}; +}, OC.Backbone.Events); $(document).ready(function() { var enabled = $('#files_external').attr('data-encryption-enabled'); |