ATLAS-4326: Atlas UI: Multiple continuous space is accepted on Short description for Classifications, Gloassarys, Categorys & Terms, fixed #2.
Signed-off-by: nixonrodrigues <nixon@apache.org>
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index bb3fa3f..8c2df51 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -710,6 +710,9 @@
"okText": model ? "Update" : "Create",
"allowCancel": true
}).open();
+ modal.$el.find('input[data-id=shortDescription]').on('input keydown', function(e) {
+ $(this).val($(this).val().replace(/\s+/g, ' '));
+ });
modal.$el.find('button.ok').attr("disabled", "true");
modal.on('ok', function() {
modal.$el.find('button.ok').showButtonLoader();
diff --git a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
index 8e7e6c3..be33e7c 100644
--- a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
@@ -276,14 +276,14 @@
});
},
textAreaChangeEvent: function(view) {
- if (this.model.get('description') === view.ui.description.val() || view.ui.description.val().length == 0) {
+ if (this.model.get('description') === view.ui.description.val() || view.ui.description.val().length == 0 || view.ui.description.val().trim().length === 0) {
this.modal.$el.find('button.ok').prop('disabled', true);
} else {
this.modal.$el.find('button.ok').prop('disabled', false);
}
},
onPublishClick: function(view) {
- var saveObj = _.extend(this.model.toJSON(), { 'description': view.ui.description.val() });
+ var saveObj = _.extend(this.model.toJSON(), { 'description': view.ui.description.val().trim() });
this.onSaveButton(saveObj, Messages.tag.updateTagDescriptionMessage);
this.ui.description.show();
},
@@ -303,6 +303,7 @@
allowCancel: true,
}).open();
view.ui.description.on('keyup input', function(e) {
+ $(this).val($(this).val().replace(/\s+/g, ' '));
that.textAreaChangeEvent(view);
e.stopPropagation();
});
diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js
index 9dd15b4..38df187 100644
--- a/dashboardv2/public/js/views/tag/TagLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagLayoutView.js
@@ -403,7 +403,10 @@
}).open();
modal.$el.find('button.ok').attr("disabled", "true");
view.ui.tagName.on('keyup input', function(e) {
- view.ui.description.val(this.value);
+ view.ui.description.val($(this).val().replace(/\s+/g, ' '));
+ });
+ view.ui.description.on('input keydown', function(e) {
+ $(this).val($(this).val().replace(/\s+/g, ' '));
});
modal.on('shownModal', function() {
view.ui.parentTag.select2({
diff --git a/dashboardv3/public/js/utils/CommonViewFunction.js b/dashboardv3/public/js/utils/CommonViewFunction.js
index 34afa2d..e739544 100644
--- a/dashboardv3/public/js/utils/CommonViewFunction.js
+++ b/dashboardv3/public/js/utils/CommonViewFunction.js
@@ -730,6 +730,9 @@
"okText": model ? "Update" : "Create",
"allowCancel": true
}).open();
+ modal.$el.find('input[data-id=shortDescription]').on('input keydown', function(e) {
+ $(this).val($(this).val().replace(/\s+/g, ' '));
+ });
modal.$el.find('button.ok').attr("disabled", "true");
modal.on('ok', function() {
modal.$el.find('button.ok').showButtonLoader();
diff --git a/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
index 18d3650..3bfc201 100644
--- a/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
+++ b/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
@@ -687,7 +687,10 @@
}).open();
modal.$el.find("button.ok").attr("disabled", "true");
view.ui.tagName.on('keyup input', function(e) {
- view.ui.description.val(this.value);
+ view.ui.description.val($(this).val().replace(/\s+/g, ' '));
+ });
+ view.ui.description.on('input keydown', function(e) {
+ $(this).val($(this).val().replace(/\s+/g, ' '));
});
modal.on("shownModal", function() {
view.ui.parentTag.select2({
diff --git a/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js
index cabf32b..52ff043 100644
--- a/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js
+++ b/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js
@@ -280,14 +280,14 @@
});
},
textAreaChangeEvent: function(view) {
- if (this.model.get('description') === view.ui.description.val() || view.ui.description.val().length == 0) {
+ if (this.model.get('description') === view.ui.description.val() || view.ui.description.val().length == 0 || view.ui.description.val().trim().length === 0) {
this.modal.$el.find('button.ok').prop('disabled', true);
} else {
this.modal.$el.find('button.ok').prop('disabled', false);
}
},
onPublishClick: function(view) {
- var saveObj = _.extend(this.model.toJSON(), { 'description': view.ui.description.val() });
+ var saveObj = _.extend(this.model.toJSON(), { 'description': view.ui.description.val().trim() });
this.onSaveButton(saveObj, Messages.tag.updateTagDescriptionMessage);
this.ui.description.show();
},
@@ -307,6 +307,7 @@
allowCancel: true,
}).open();
view.ui.description.on('keyup input', function(e) {
+ $(this).val($(this).val().replace(/\s+/g, ' '));
that.textAreaChangeEvent(view);
e.stopPropagation();
});