Skip to content

Commit

Permalink
Fix dnnsoftware#5900: use correct selector.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyhfish committed Feb 19, 2024
1 parent 8b3a35c commit 517fc21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3 data-bind="html: $root.resx.title_Connections"></h3>
</tr>
<tr class="edit-row" data-bind="css: {'in-edit': inEdit()}">
<td colspan="4">
<div data-bind="attr: {id: 'connector-' + name.replace(/ /g,''), class: 'edit-form ' + ($parent.isOpen() ? 'open' : '')}">
<div data-bind="attr: {id: wrapperId, class: 'edit-form ' + ($parent.isOpen() ? 'open' : '')}">
<!-- ko if: componentInitialized -->
<div class="edit-items edit-fields" data-bind="component: {name: uniqueNumber + 'component', params: $data}"></div>
<!-- /ko -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ define(['jquery', 'knockout', 'main/pager', 'main/validator', 'main/config', 'ma
var koConnectionObject = {
name: conn.name,
displayName: ko.observable(conn.displayName),
wrapperId: ko.computed(function() {
return 'connector-' + conn.name.replace(/ /g, '');
}),
previousDisplayName: ko.observable(conn.displayName),
icon: conn.icon,
supportsMultiple: conn.supportsMultiple,
Expand Down Expand Up @@ -178,7 +181,7 @@ define(['jquery', 'knockout', 'main/pager', 'main/validator', 'main/config', 'ma

(function (connection) {
setTimeout(function () {
var $root = $('#connector-' + connection.displayName().replace(/ /g, ''));
var $root = $('#' + connection.wrapperId());
$root.find('input, select').each(function () {
var $this = $(this);
if (!$this.attr('id') || !$root.find('label[for="' + $this.attr('id') + '"]').length) {
Expand Down Expand Up @@ -207,7 +210,7 @@ define(['jquery', 'knockout', 'main/pager', 'main/validator', 'main/config', 'ma
}


$('#connector-' + koConnectionObject.displayName()).find('.edit-fields').children().each(function () {
$('#' + koConnectionObject.wrapperId()).find('.edit-fields').children().each(function () {
ko.applyBindings(koConnectionObject, this);
});
});
Expand Down Expand Up @@ -302,7 +305,7 @@ define(['jquery', 'knockout', 'main/pager', 'main/validator', 'main/config', 'ma
}
}

var primaryButtons = $('#connector-' + conn.displayName()).find('a.primarybtn');
var primaryButtons = $('#' + conn.wrapperId()).find('a.primarybtn');
if (!allEmpty && !allFilled && !forceSave) {
primaryButtons.addClass('disabledbtn');
return;
Expand Down Expand Up @@ -335,7 +338,7 @@ define(['jquery', 'knockout', 'main/pager', 'main/validator', 'main/config', 'ma
};

var onSaveFailed = function (conn, xhr, status) {
var primaryButtons = $('#connector-' + conn.displayName()).find('a.primarybtn');
var primaryButtons = $('#' + conn.wrapperId()).find('a.primarybtn');
primaryButtons.html(viewModel.resx.btn_Save);
if (xhr.responseJSON) {
utility.notifyError(xhr.responseJSON.Message || status || 'Failed...');
Expand Down Expand Up @@ -465,7 +468,7 @@ define(['jquery', 'knockout', 'main/pager', 'main/validator', 'main/config', 'ma
var newConn = onAddNew(connectionCategory, true);
connections.push(newConn);
connectionCategory.connections(connections);
$('#connector-' + newConn.name.replace(/ /g, '')).slideUp(200, 'linear', function () {
$('#' + newConn.wrapperId()).slideUp(200, 'linear', function () {
viewModel.connections().forEach(function (v) {
if (v.connections().length === 1) {
v.isOpen(false);
Expand Down

0 comments on commit 517fc21

Please sign in to comment.