diff --git a/app/assets/javascripts/my_modules/results.js b/app/assets/javascripts/my_modules/results.js index 369a277c6..484428265 100644 --- a/app/assets/javascripts/my_modules/results.js +++ b/app/assets/javascripts/my_modules/results.js @@ -187,29 +187,6 @@ function expandResult(result) { renderTable($(result).find("div.step-result-hot-table")); } - -initHandsOnTables($(document)); -initResultCommentTabAjax(); -expandAllResults(); -initTutorial(); -applyCollapseLinkCallBack(); - -initCommentOptions("ul.content-comments"); -initEditComments("#results"); -initDeleteComments("#results"); - -$(function () { - $("#results-collapse-btn").click(function () { - $('.result .panel-collapse').collapse('hide'); - $(document).find("span.collapse-result-icon").each(function() { - $(this).addClass("glyphicon-collapse-down"); - $(this).removeClass("glyphicon-collapse-up"); - }); - }); - - $("#results-expand-btn").click(expandAllResults); -}); - function renderTable(table) { $(table).handsontable("render"); // Yet another dirty hack to solve HandsOnTable problems @@ -364,6 +341,28 @@ function processResult(ev, resultTypeEnum, editMode, forS3) { // This checks if the ctarget param exist in the // rendered url and opens the comment tab $(document).ready(function(){ + initHandsOnTables($(document)); + initResultCommentTabAjax(); + expandAllResults(); + initTutorial(); + applyCollapseLinkCallBack(); + + initCommentOptions("ul.content-comments"); + initEditComments("#results"); + initDeleteComments("#results"); + + $(function () { + $("#results-collapse-btn").click(function () { + $('.result .panel-collapse').collapse('hide'); + $(document).find("span.collapse-result-icon").each(function() { + $(this).addClass("glyphicon-collapse-down"); + $(this).removeClass("glyphicon-collapse-up"); + }); + }); + + $("#results-expand-btn").click(expandAllResults); + }); + if( getParam('ctarget') ){ var target = "#"+ getParam('ctarget'); $(target).find('a.comment-tab-link').click();