From 329a5bff0b9003185f0e55e2002c0291a32103ae Mon Sep 17 00:00:00 2001
From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com>
Date: Tue, 15 Dec 2020 12:23:19 +0100
Subject: [PATCH] Fix repository text field rendering [SCI-5304] (#3015)
---
.../javascripts/repositories/renderers/edit_renderers.js | 7 ++++---
.../javascripts/repositories/renderers/view_renderers.js | 3 ++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/app/assets/javascripts/repositories/renderers/edit_renderers.js b/app/assets/javascripts/repositories/renderers/edit_renderers.js
index 09692d640..e90ac8ee5 100644
--- a/app/assets/javascripts/repositories/renderers/edit_renderers.js
+++ b/app/assets/javascripts/repositories/renderers/edit_renderers.js
@@ -13,11 +13,12 @@ $.fn.dataTable.render.editRowName = function(formId, cell) {
form="${formId}"
type="text"
name="repository_row[name]"
- value="${text}"
+ value=""
placeholder="${I18n.t('repositories.table.enter_row_name')}"
data-type="RowName">
`);
+ $cell.find('input').val(text);
};
$.fn.dataTable.render.editRepositoryAssetValue = function(formId, columnId, cell) {
@@ -34,11 +35,11 @@ $.fn.dataTable.render.editRepositoryTextValue = function(formId, columnId, cell)
form="${formId}"
type="text"
name="repository_cells[${columnId}]"
- value="${text}"
+ value=""
placeholder="${I18n.t('repositories.table.text.enter_text')}"
data-type="RepositoryTextValue">
`);
-
+ $cell.find('input').val(text);
SmartAnnotation.init($cell.find('input'));
};
diff --git a/app/assets/javascripts/repositories/renderers/view_renderers.js b/app/assets/javascripts/repositories/renderers/view_renderers.js
index 8d23fce1f..dbabd2d46 100644
--- a/app/assets/javascripts/repositories/renderers/view_renderers.js
+++ b/app/assets/javascripts/repositories/renderers/view_renderers.js
@@ -26,7 +26,8 @@ $.fn.dataTable.render.defaultRepositoryAssetValue = function() {
};
$.fn.dataTable.render.RepositoryTextValue = function(data) {
- var text = $(`${data.value.view}`);
+ var text = $(`${data.value.view}`);
+ text.attr('data-edit-value', data.value.edit);
return text.prop('outerHTML');
};