YaleSTC/shifts

View on GitHub
app/views/calendars/schedule/_shift.html.erb

Summary

Maintainability
Test Coverage
<li id="shift<%=shift.id%>" style="<%=shift_style(shift)%><%= " display:none;" if !shift.calendar.active? %> background:#<%= @color[shift.calendar] %>;" class="click_to_edit_shift calendar<%=shift.calendar_id%>">
  <div class="shift-time-overlay" style="position: absolute; left: -1px; top:-<%= @table_pixels / (@table_height) * @location_row + @location_row + @location_group_row + @location_group_row * 0.25 * @table_pixels / (@table_height) + @timeslot_rows / 2.0 * @table_pixels / (@table_height) %>px;">
    </div>
  <div class="time-slot">
    <% if @right_overflow or @left_overflow %>
      <%= image_tag "overflow_arrow_right.png", {class: "right_arrow", alt: "right arrow", height: @table_pixels / @table_height + 1 } if @right_overflow %>
      <%= image_tag "overflow_arrow_left.png",  {class: "left_arrow",  alt: "left arrow",  height: @table_pixels / @table_height + 1 } if @left_overflow %>
    <% end %>
    <div class="center_container">
      <div class="center_content">
        <% if current_user.is_admin_of?(@department) or current_user == shift.user %>
          <% unless shift.repeating_event %>
            <%= link_to "x", {url: {controller: 'shifts', action: 'destroy', id: shift.id, calendar: (params[:calendar] || true) },  remote: true, confirm: 'Are you sure?', method: :delete}, style: "float:right;margin-right:3px", class: 'delete_link' %>
          <% else %>
            <%= link_to_function "x", class: 'click_to_delete_repeating_shift', id: 'delete_repeating_'+shift.id.to_s %>
          <% end %>
        <%= shift.user.name %>
        <% end %>
      </div>
    </div>
  </div>
</li>