
var appendTestTrafficLight = function() {
  var testColour = "<%= @test_colour %>";
  var lightsCount = $('.diff-traffic-light').size();
  var img = $('<img>', {
    'src': '/images/bulb_' + testColour + '.png',
    'alt': testColour + ' traffic-light'
  });
  var div = $('<div>', {
    'class': 'diff-traffic-light',
    'data-tip':'simple_review_traffic_light',
    'data-colour': testColour,
    'data-was-tag': lightsCount,
    'data-now-tag': lightsCount + 1
  });
  var td = $('<td>');
  div.append(img);
  td.append(div);
  $('.traffic-lights-count').parent().before(td);
  cd.setupReviewTrafficLight(div);
};

//- - - - - - - - - - - - - - - - - - - - - -

$('#output')
  .html("<%= js_partial('output') %>");

appendTestTrafficLight();

$('.traffic-lights-count')
  .html("<%= js_partial('traffic_lights_count') %>");

$('#traffic-lights-pie-chart')
  .html("<%= js_partial('traffic_lights_pie_chart') %>");

cd.scrollAvatarImageIntoView();




var appendTestTrafficLight = function() {
  var testColour = "<%= @test_colour %>";
  var lightsCount = $('.diff-traffic-light').size();
  var img = $('<img>', {
    'src': '/images/bulb_' + testColour + '.png',
    'alt': testColour + ' traffic-light'
  });
  var div = $('<div>', {
    'class': 'diff-traffic-light',
    'data-tip':'simple_review_traffic_light',
    'data-colour': testColour,
    'data-was-tag': lightsCount,
    'data-now-tag': lightsCount + 1
  });
  var td = $('<td>');
  div.append(img);
  td.append(div);
  $('.traffic-lights-count').parent().before(td);
  cd.setupReviewTrafficLight(div);
};

//- - - - - - - - - - - - - - - - - - - - - -

$('#output')
  .html("<%= js_partial('output') %>");

cd.switchEditorToCodeMirror('output');

appendTestTrafficLight();

$('.traffic-lights-count')
  .html("<%= js_partial('traffic_lights_count') %>");

$('#traffic-lights-pie-chart')
  .html("<%= js_partial('traffic_lights_pie_chart') %>");

cd.scrollAvatarImageIntoView();



Switch 'output' editor back to CodeMirror when the tests have been run
Switch 'output' editor back to CodeMirror when the tests have been run
