summaryrefslogtreecommitdiffstats
path: root/apps/files_external/js
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2015-08-12 22:01:21 +0100
committerRobin McCorkell <rmccorkell@owncloud.com>2015-08-25 00:22:10 +0100
commitf505883e452f3c1e2653096f57e3494e0546fc46 (patch)
tree8787f7d4cf23ea9ddd952dd12137fdaaf61935b3 /apps/files_external/js
parent09808a9007511c2d06da31daed7a9e2061646401 (diff)
downloadnextcloud-server-f505883e452f3c1e2653096f57e3494e0546fc46.tar.gz
nextcloud-server-f505883e452f3c1e2653096f57e3494e0546fc46.zip
Add on-backend and on-auth-mechanism events to JS
Diffstat (limited to 'apps/files_external/js')
-rw-r--r--apps/files_external/js/settings.js34
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');