diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-10-16 10:54:45 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-10-16 10:54:45 +0200 |
commit | 3af2ad0cd99998ef5102a0dfe4c29416321dae07 (patch) | |
tree | 421e010b659822154b2833620a58ef376dd6a51a /core/js/sharedialogview.js | |
parent | 7224e99ccd47a0c9320ef9fd7a297b67cbbfd67c (diff) | |
download | nextcloud-server-3af2ad0cd99998ef5102a0dfe4c29416321dae07.tar.gz nextcloud-server-3af2ad0cd99998ef5102a0dfe4c29416321dae07.zip |
Fix DOM element ids in share dialog
- Rely on class names instead of global ids
- When global ids are needed for label+checkbox, append the view id
(cid) to the element's id
This fixes the checkboxes when multiple sidebars exist in the DOM.
Diffstat (limited to 'core/js/sharedialogview.js')
-rw-r--r-- | core/js/sharedialogview.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 7b02e6a3a50..dd07adceac4 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -16,9 +16,9 @@ var TEMPLATE_BASE = '<div class="resharerInfoView subView"></div>' + '{{#if isSharingAllowed}}' + - '<label for="shareWith" class="hidden-visually">{{shareLabel}}</label>' + + '<label for="shareWith-{{cid}}" class="hidden-visually">{{shareLabel}}</label>' + '<div class="oneline">' + - ' <input id="shareWith" type="text" placeholder="{{sharePlaceholder}}" />' + + ' <input id="shareWith-{{cid}}" class="shareWithField" type="text" placeholder="{{sharePlaceholder}}" />' + ' <span class="shareWithLoading icon-loading-small hidden"></span>'+ '{{{remoteShareInfo}}}' + '</div>' + @@ -127,7 +127,7 @@ $loading.addClass('hidden'); $loading.removeClass('inlineblock'); if (result.status == 'success' && result.data.length > 0) { - $("#shareWith").autocomplete("option", "autoFocus", true); + $('.shareWithField').autocomplete("option", "autoFocus", true); response(result.data); } else { response(); @@ -184,7 +184,7 @@ this._loadingOnce = true; // the first time, focus on the share field after the spinner disappeared _.defer(function() { - self.$('#shareWith').focus(); + self.$('.shareWithField').focus(); }); } }, @@ -193,13 +193,14 @@ var baseTemplate = this._getTemplate('base', TEMPLATE_BASE); this.$el.html(baseTemplate({ + cid: this.cid, shareLabel: t('core', 'Share'), sharePlaceholder: this._renderSharePlaceholderPart(), remoteShareInfo: this._renderRemoteShareInfoPart(), isSharingAllowed: this.model.sharePermissionPossible() })); - var $shareField = this.$el.find('#shareWith'); + var $shareField = this.$el.find('.shareWithField'); if ($shareField.length) { $shareField.autocomplete({ minLength: 2, |