unepwcmc/SAPI

View on GitHub
app/views/admin/events/_list.html.erb

Summary

Maintainability
Test Coverage
<thead>
  <th width="20%">Designation</th>
  <th>Name</th>
  <th>Effective from</th>
  <th>End date</th>
  <th>Description</th>
  <th>Type</th>
  <th>Subtype</th>
  <th>URL</th>
  <th width="10%">Actions</th>
  <th width="5%">Info</th>
</thead>
<tbody>
  <% collection.each do |event| -%>
    <tr class="<%= if event.is_current? then "current_listing" end %>">
      <td>
        <a href="#" class="editable editable-click editable-required" data-type="select" data-resource="event" data-name="designation_id"
          data-placeholder="Required" data-original-title="Enter the change type's designation" data-source="/admin/designations/"
          data-url="<%= resource_url(event) %>" data-pk="<%= event.id %>" data-value="<%= event.designation && event.designation.id %>">
          <%= event.designation && event.designation.name %>
        </a>
      </td>
      <td>
        <a href="#" class="editable editable-click editable-required"
          data-type="text" data-resource="event" data-name="name"
          data-placeholder="Required" data-original-title="Enter the event's name"
          data-url="<%= resource_url(event) %>" data-pk="<%= event.id %>">
          <%= event.name %>
        </a>
      </td>
      <td><%= event.effective_at_formatted %></td>
      <td><%= event.end_date_formatted %></td>
      <td><%= event.description %></td>
      <td><%= event.type %></td>
      <td><%= event.subtype %></td>
      <td>
        <%= link_to_unless(
          event.url.blank?,
          '<i class="icon-share" title="Go to URL"></i>'.html_safe,
          event.url
        ) { '' } %>
      </td>
      <td>
        <%= link_to edit_icon, edit_resource_url(event), :remote => true %>
        <%= link_to delete_icon, resource_url(event),
          data: { confirm: "Warning: you are about to delete data. Are you sure?" }, :method => :delete
        %>
      </td>
      <td><%= tracking_info(event) %></td>
    </tr>
  <% end -%>
</tbody>