Skip to content

Home Information - Your home, your data, organized.

Python

Fixed autosize failing bug for textareas in modals.

Anthony Cassandra94acab0289d2
diff --git a/src/hi/apps/attribute/templates/attribute/panes/attribute_form_field_value.html b/src/hi/apps/attribute/templates/attribute/panes/attribute_form_field_value.html
index ee9b4d59..8a211459 100644
--- a/src/hi/apps/attribute/templates/attribute/panes/attribute_form_field_value.html
+++ b/src/hi/apps/attribute/templates/attribute/panes/attribute_form_field_value.html
@@ -5,4 +5,15 @@
name="{{ attribute_form.value.html_name }}">{{ attribute_form.value.value|default_if_none:'' }}</textarea>
</div>
<div class="form-error text-danger" >{{ attribute_form.value.errors }}</div>
-<script type="text/javascript">autosize($('#{{ attribute_form.value.id_for_label }}'));</script>
+<script type="text/javascript">
+(function() {
+ let textareaSelector = '#{{ attribute_form.value.id_for_label }}';
+ autosize($(textareaSelector));
+
+ // In case this is in a modal, need to wait for autosize to work.
+ $('.modal').on('shown.bs.modal', function () {
+ autosize.update($(textareaSelector));
+ });
+ })();
+
+</script>
diff --git a/src/hi/apps/attribute/templates/attribute/panes/attribute_form_new.html b/src/hi/apps/attribute/templates/attribute/panes/attribute_form_new.html
index 8158b6a3..3cc8e740 100644
--- a/src/hi/apps/attribute/templates/attribute/panes/attribute_form_new.html
+++ b/src/hi/apps/attribute/templates/attribute/panes/attribute_form_new.html
@@ -12,7 +12,7 @@
<label for="{{ attribute_form.value.id_for_label }}">{{ attribute_form.value.label }}</label>
<textarea rows="2" cols="40"
id="{{ attribute_form.value.id_for_label }}"
- name="{{ attribute_form.value.html_name }}"
+ name="{{ attribute_form.value.html_name }}"
>{{ attribute_form.value.value|default_if_none:'' }}</textarea>
<div class="form-error text-danger" >{{ attribute_form.value.errors }}</div>
diff --git a/src/hi/static/js/status.js b/src/hi/static/js/status.js
index e341079f..32f92314 100644
--- a/src/hi/static/js/status.js
+++ b/src/hi/static/js/status.js
@@ -189,9 +189,6 @@
if ( $(elem).attr( 'hi-id-replace-hash' ) != contentHash ) {
$(elem).replaceWith( replacementContent );
$(`#${html_id}`).attr( 'hi-id-replace-hash', contentHash );
- console.log( `UPDATED (CHANGED): ${html_id}, hash=${contentHash}` );
- } else {
- console.log( `SKIPPED (UNCHANGED): ${html_id}` );
}
}
}