From 40f3365596574735595840328eaa0d96e757fe4f Mon Sep 17 00:00:00 2001 From: mlorb Date: Mon, 11 Jun 2018 14:47:25 +0200 Subject: [PATCH 1/2] fix bug with truncating string --- app/assets/javascripts/sitewide/string_utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/sitewide/string_utils.js b/app/assets/javascripts/sitewide/string_utils.js index 44ef3057c..e801152cb 100644 --- a/app/assets/javascripts/sitewide/string_utils.js +++ b/app/assets/javascripts/sitewide/string_utils.js @@ -28,12 +28,12 @@ function truncateLongString( el, chars ) { } if ( html ) { - el.html(html.outerHTML + newText + '...' ); + el.text(html.outerHTML + newText + '...' ); } else { if($.type(el) === 'string'){ return newText + '...'; } else { - el.html(newText + '...' ); + el.text(newText + '...' ); } } } else { From 1e1330847fc4ea9e81bcc60973d42a4c829995c2 Mon Sep 17 00:00:00 2001 From: mlorb Date: Mon, 11 Jun 2018 14:49:03 +0200 Subject: [PATCH 2/2] remove unused code --- app/assets/javascripts/reports/new.js.erb | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/app/assets/javascripts/reports/new.js.erb b/app/assets/javascripts/reports/new.js.erb index e456c9474..cc2a7aa40 100644 --- a/app/assets/javascripts/reports/new.js.erb +++ b/app/assets/javascripts/reports/new.js.erb @@ -32,10 +32,6 @@ var ignoreUnsavedWorkAlert; initializeAddContentsModal(); initializeUnsavedWorkDialog(); - $('.report-nav-link').each(function() { - truncateLongString($(this), <%= Constants::NAME_TRUNCATION_LENGTH %>); - }); - // Automatically display the "Add content" modal $('.new-element.initial').click(); } @@ -955,11 +951,3 @@ $(document).ready(function() { init(); } }) - -$(document).change(function(){ - setTimeout(function(){ - $(".report-nav-link").each( function(){ - truncateLongString( $(this), <%= Constants::NAME_TRUNCATION_LENGTH %>); - }); - }, 1000); -});