From cafec6a1b4ad0d1d475d68c39cbc3371656fedc0 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Thu, 4 Aug 2016 16:05:03 +0200 Subject: [PATCH] Fix controls on experiment contents Also fix bug with adjencent elements not updating controls. Fixes SCI-35. --- app/assets/javascripts/reports/new.js | 4 ++++ app/controllers/reports_controller.rb | 1 + 2 files changed, 5 insertions(+) diff --git a/app/assets/javascripts/reports/new.js b/app/assets/javascripts/reports/new.js index ecebfd444..6f5c4918d 100644 --- a/app/assets/javascripts/reports/new.js +++ b/app/assets/javascripts/reports/new.js @@ -979,6 +979,10 @@ function addElements(newElToBeReplaced, elements) { // Initialize everything on all elements _.each(newElements, function(element) { initializeReportElements($(element)); + + // Update previous and next element controls + updateElementControls(element.prev()) + updateElementControls(element.next()) }); } diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 0e161ac37..897cd968d 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -482,6 +482,7 @@ class ReportsController < ApplicationController ) el[:children] = generate_module_contents_json(my_module) res << el + res << generate_new_el(false) end end res