From 99c854f7d5359ef98f5ff8196a7070463d24a85a Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Tue, 30 May 2023 19:21:09 -0700 Subject: [PATCH] Remove redundant client-side render Incidentally resolves a JavaScript error introduced in #3138 affecting pages without the proposal form: Uncaught TypeError: text is undefined at word_count (app/assets/javascripts/osem.js:134) --- app/assets/javascripts/osem.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/osem.js b/app/assets/javascripts/osem.js index 55c528b2c5..0122a34d1f 100644 --- a/app/assets/javascripts/osem.js +++ b/app/assets/javascripts/osem.js @@ -145,7 +145,7 @@ function word_count(text, divId, maxcount) { /* Wait for the DOM to be ready before attaching events to the elements */ $( document ).ready(function() { /* Set the minimum and maximum proposal abstract word length */ - function updateEventTypeRequirements() { + $("#event_event_type_id").change(function () { var $selected = $("#event_event_type_id option:selected") var max = $selected.data("max-words"); var min = $selected.data("min-words"); @@ -153,9 +153,7 @@ $( document ).ready(function() { $("#abstract-maximum-word-count").text(max); $("#abstract-minimum-word-count").text(min); word_count($('#event_abstract').get(0), 'abstract-count', max); - } - $("#event_event_type_id").change(updateEventTypeRequirements); - updateEventTypeRequirements(); + }); /* Count the proposal abstract length */ $("#event_abstract").on('input', function() {