YaleSTC/shifts

View on GitHub
app/views/time_slots/update.js.erb

Summary

Maintainability
Test Coverage
<% if !@ajax_error_message %>
  $("#timeslot<%= @time_slot.id %>").remove();
  <% ul_id = "location#{@time_slot.location.id}_#{@time_slot_day.strftime('%Y-%m-%d')}_timeslots" %>
  <% new_li = escape_javascript render partial: "time_slots/time_slot", object: @time_slot, locals: {time_slot_day: @time_slot_day} %>

  $('#<%= ul_id %>').append("<%= new_li %>");
  $("#timeslot<%= @time_slot.id %>").effect("highlight", 1100);
  $("#tooltip").remove()
  $('#timeslot<%=@time_slot.id%>').click(function (e) {popup_edit_timeslot($(this), e); return false;});
<% else %>
  $('#flash').html("<%= escape_javascript render partial: 'layouts/flash', locals: {flash: flash} %>");
  $("#tooltip").html("<%= j @ajax_error_message.html_safe %>")
  <% flash.discard %>
<% end %>