Sha256: 8277379f14e63551a1370d9553de55e1958935df13c4acbc2a8fa30f990e4862

Contents?: true

Size: 1.69 KB

Versions: 6

Compression:

Stored size: 1.69 KB

Contents

$('#new-exam-exam-portion').slide();
$('#new-exam-exam-portion-link').show();
showNotice("<%= render_flash %>");

$('#exam-exam-portions-index tbody').append('<%= render_js_partial("gaku/exams/exam_portions/exam_portion", {exam_portion: @exam_portion}) %>');

$('.exam-exam-portions-count').html("<%= print_count(@count+1, t_exam_portion_list) %>");

<% if @exam.use_weighting? %>

  //if no portion added yet
  if($('.exam-portions-weight thead tr').length == 0){
    $('.exam-portions-weight thead').append('<tr></tr>');
    $('.exam-portions-weight tbody').append('<tr></tr>');
  }

  $('.exam-portions-weight thead tr').append('<th class="btn-warning" data-id=<%= @exam.exam_portions.last.id%>> <%= @exam.exam_portions.last.name+ " " + t("exam.weight") %> </th>');
  $('.exam-portions-weight tbody tr').append('<%= render_js_partial("gaku/exams/exam_portions/exam_portion_weight_td", {portion: @exam.exam_portions.last}) %>');

  weights = ('<%= @exam.exam_portions.pluck(:weight) %>');
  weights = weights.slice(1, -1).split(',');

  total   = 0;
  for (var i = 0; i < weights.length; i++) {
    total += parseFloat(weights[i]);
  }
  
  $('.exam-portions-weight tbody form').each(function(i, form){
    $(form).find('input.exam-portion-weight').val(parseFloat(weights[i]))
  })

  $('#exam-exam-portions-index tbody tr').each(function(i, tr){
    tdWeight = $(tr).find('td')[3]
    $(tdWeight).text(weights[i])
  })
  
  $('#weight-total').text(total);
<% end %>



error = '<%= @exam_portion.custom_errors %>'

if(error){
  $('.exam-portion-error').html('<%= render_js_partial("gaku/exams/exam_portions/custom_exam_portion_error", {error: @exam_portion.custom_errors}) %>')
}else{
  $('.exam-portion-error').html('');
}

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
gaku_core-0.0.3 app/views/gaku/exams/exam_portions/create.js.erb
gaku-0.0.3 core/app/views/gaku/exams/exam_portions/create.js.erb
gaku-0.0.2 core/app/views/gaku/exams/exam_portions/create.js.erb
gaku_core-0.0.2 app/views/gaku/exams/exam_portions/create.js.erb
gaku-0.0.1 core/app/views/gaku/exams/exam_portions/create.js.erb
gaku_core-0.0.1 app/views/gaku/exams/exam_portions/create.js.erb