vegantech/sims

View on GitHub
app/views/unattached_interventions/index.html.erb

Summary

Maintainability
Test Coverage
<h2>Unattached Interventions<%=help_popup Intervention::UNATTACHED_DESCRIPTION %> </h2>




<p>The red fields show why that intervention is considered unattached.</p>
<%=form_tag do %>
<table id="unattached_interventions">
  <thead>
    <tr>
      <th>Student</th>
      <th>Intervention</th>
      <th>Start Date</th>
      <th>End Date 
        <%=help_popup "You can change the end date by clicking 
        on the icon next to the date and then choosing a new one." %>
      </th>
<th>Participants
  <%=help_popup "You can add participants by selecting them from 
  the dropdown in each intervention row.  
  The X next to a participant will remove him/her.  If a name is red, it means the teacher does not have access to the student." %>
</th>
      <th class="screen-only">End Intervention
        <%=help_popup" To end one or more interventions, 
        check the boxes at the right, and then press 
        the \"Update\" Button. " %>
      </th>
  </tr>

  </thead>
  <tbody>
    <%@interventions.each do |intervention| %>
      <tr>
        <td><%=link_to intervention.student, intervention.student, :target => "_blank" %> </td>
        <td><%=intervention.title %></td>
        <td><%=intervention.start_date %> </td>
        <td <%= "style='color: red;'".html_safe  if intervention.end_date < Date.today%> class="end_date" > <center>
          <span id = "print_end_date<%=intervention.id%>" class ="print-only"> <%= intervention.end_date %> </span>
          
          <%= unobtrusive_date_picker_tags intervention.end_date, 
            {:order => [:month, :day, :year], :start_year => intervention.start_date.year, :end_year => 2.years.since().year, 
              :prefix => "end_date#{intervention.id}", :range_low => intervention.start_date}
           %>
           * <div "<%=style_display_none_unless(intervention.end_date < Date.today) %>" class="end_date_expired screen-only">Expired end date.</div>
         </center>
         </td>
        <td style="padding-left: 15px"><%=render :partial => "participant_list", :locals=>{:intervention => intervention} %></td>
        <td class = "screen-only"><center><%= check_box_tag 'id[]',intervention.id, false, :id => "ck_#{intervention.id}" %></center></td>
      </tr>
    <% end %>

  </tbody>
</table>
<% if @interventions.empty? %>
  <p> There are no unattached interventions. </p>
<% end %>

<%=submit_tag 'Update', :class => "screen-only" %> <%=help_popup("This will end the checked interventions and remove interventions that are no longer unattached.  Changes to end dates and participants are immediate.") %>
<% end %>