From d90f17d1eb1439ff7c2afb36fa3ab94196a8606a Mon Sep 17 00:00:00 2001 From: zmagod Date: Wed, 5 Oct 2016 08:42:32 +0200 Subject: [PATCH] clean comments date duplication [fixes SCI-469] --- app/assets/javascripts/comments.js | 10 +++++++++- app/assets/javascripts/results/result_assets.js | 1 - app/assets/javascripts/results/result_tables.js | 1 - app/assets/javascripts/results/result_texts.js | 1 - 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/comments.js b/app/assets/javascripts/comments.js index bf4d5b41f..14ad457c7 100644 --- a/app/assets/javascripts/comments.js +++ b/app/assets/javascripts/comments.js @@ -63,7 +63,15 @@ var Comments = (function() { moreBtn.trigger('blur'); } - debugger; + var date; + $.each(list.find('.comment-date-separator'), function() { + if ( $(this).find('p').html() === date ) { + $(this).remove(); + } else { + date = $(this).find('p').html(); + } + }); + // Reposition dropdown comment options scrollCommentOptions(listItem .closest('.content-comments') diff --git a/app/assets/javascripts/results/result_assets.js b/app/assets/javascripts/results/result_assets.js index 73aade08e..1b51b4814 100644 --- a/app/assets/javascripts/results/result_assets.js +++ b/app/assets/javascripts/results/result_assets.js @@ -61,7 +61,6 @@ function formAjaxResultAsset($form) { applyCollapseLinkCallBack(); toggleResultEditButtons(true); - initResultCommentTabAjax(); expandResult($newResult); $imgs = $newResult.find("img"); reloadImages($imgs); diff --git a/app/assets/javascripts/results/result_tables.js b/app/assets/javascripts/results/result_tables.js index eca1279d2..c168c0959 100644 --- a/app/assets/javascripts/results/result_tables.js +++ b/app/assets/javascripts/results/result_tables.js @@ -99,7 +99,6 @@ function formAjaxResultTable($form) { applyCollapseLinkCallBack(); initHandsOnTables($result); toggleResultEditButtons(true); - initResultCommentTabAjax(); expandResult($result); }); $form.on("ajax:error", function(e, xhr, status, error) { diff --git a/app/assets/javascripts/results/result_texts.js b/app/assets/javascripts/results/result_texts.js index d98aaa540..cbe9f1cac 100644 --- a/app/assets/javascripts/results/result_texts.js +++ b/app/assets/javascripts/results/result_texts.js @@ -60,7 +60,6 @@ function formAjaxResultText($form) { applyEditResultTextCallback(); applyCollapseLinkCallBack(); toggleResultEditButtons(true); - initResultCommentTabAjax(); expandResult(newResult); }); $form.on("ajax:error", function(e, xhr, status, error) {