Merge pull request #15180 from owncloud/ext-tabbing

Use individual timers for separate config rows
remotes/origin/etag-endpoint
Morris Jobke 10 years ago
commit d83741396a
  1. 51
      apps/files_external/js/settings.js

@ -412,7 +412,7 @@ MountConfigListView.prototype = {
/** /**
* Flag whether the list is about user storage configs (true) * Flag whether the list is about user storage configs (true)
* or global storage configs (false) * or global storage configs (false)
* *
* @type bool * @type bool
*/ */
_isPersonal: false, _isPersonal: false,
@ -488,35 +488,12 @@ MountConfigListView.prototype = {
_initEvents: function() { _initEvents: function() {
var self = this; var self = this;
this.$el.on('paste', 'td input', function() { var onChangeHandler = _.bind(this._onChange, this);
var $me = $(this); //this.$el.on('input', 'td input', onChangeHandler);
var $tr = $me.closest('tr'); this.$el.on('keyup', 'td input', onChangeHandler);
setTimeout(function() { this.$el.on('paste', 'td input', onChangeHandler);
highlightInput($me); this.$el.on('change', 'td input:checkbox', onChangeHandler);
self.saveStorageConfig($tr); this.$el.on('change', '.applicable', onChangeHandler);
}, 20);
});
var timer;
this.$el.on('keyup', 'td input', function() {
clearTimeout(timer);
var $tr = $(this).closest('tr');
highlightInput($(this));
if ($(this).val) {
timer = setTimeout(function() {
self.saveStorageConfig($tr);
}, 2000);
}
});
this.$el.on('change', 'td input:checkbox', function() {
self.saveStorageConfig($(this).closest('tr'));
});
this.$el.on('change', '.applicable', function() {
self.saveStorageConfig($(this).closest('tr'));
});
this.$el.on('click', '.status>span', function() { this.$el.on('click', '.status>span', function() {
self.recheckStorageConfig($(this).closest('tr')); self.recheckStorageConfig($(this).closest('tr'));
@ -529,6 +506,20 @@ MountConfigListView.prototype = {
this.$el.on('change', '.selectBackend', _.bind(this._onSelectBackend, this)); this.$el.on('change', '.selectBackend', _.bind(this._onSelectBackend, this));
}, },
_onChange: function(event) {
var self = this;
var $target = $(event.target);
highlightInput($target);
var $tr = $target.closest('tr');
var timer = $tr.data('save-timer');
clearTimeout(timer);
timer = setTimeout(function() {
self.saveStorageConfig($tr);
}, 2000);
$tr.data('save-timer', timer);
},
_onSelectBackend: function(event) { _onSelectBackend: function(event) {
var $target = $(event.target); var $target = $(event.target);
var $el = this.$el; var $el = this.$el;

Loading…
Cancel
Save