rubycentral/cfp-app

View on GitHub
app/views/staff/grids/bulk_time_slots/preview.js.erb

Summary

Maintainability
Test Coverage
(function($) {
  var grid = window.Schedule.Grid;
  var $dialog = $('#bulk-time-slot-create-dialog');
  var $gridDay = $('#schedule_day_<%= @bulk.day %>');
  var $bar = $gridDay.closest('.grid-wrapper').find('.bulk-preview-bar');

  $bar.html('<%=j render partial: 'preview_bar', locals: { bulk: @bulk} %>');
  $gridDay.replaceWith('<%=j render partial: 'staff/grids/grid', locals: { schedule: @schedule, day: @bulk.day} %>');

  grid.initGridDay(<%= @bulk.day %>);

  var $tabs = $('.nav-tabs > li');
  $tabs.removeClass('active');
  $('.tab-pane').removeClass('active');
  $('a[href="#grid_day_<%= @bulk.day %>"]').parent().addClass('active');
  $('#grid_day_<%= @bulk.day %>').addClass('active');

  $dialog.modal('hide');

})(jQuery);